Skip to content

Instantly share code, notes, and snippets.

@BerkeleyTrue
Created August 18, 2016 22:06
Show Gist options
  • Select an option

  • Save BerkeleyTrue/ddf1f0b03152700a2019c696e22f281c to your computer and use it in GitHub Desktop.

Select an option

Save BerkeleyTrue/ddf1f0b03152700a2019c696e22f281c to your computer and use it in GitHub Desktop.
var fs = require('fs');
var emailName = process.argv[2];
var percent = process.argv[3];
var emails = require('./' + emailName + '.json');
var newEmails = emails.slice((emails.length * (percent / 100)));
console.log(
'Do emails end the same? %s',
emails[emails.length - 1] === newEmails[newEmails.length -1]
);
console.log('Original email list size: %s', emails.length);
console.log('New Email list size: %s', newEmails.length);
fs.writeFileSync('./emails.json', JSON.stringify(newEmails));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment