mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-11 00:02:19 -05:00
10 lines
563 B
JavaScript
10 lines
563 B
JavaScript
// Finds all email addresses of users, normalizes, and produces SHA1 hashes.
|
|
// Run while piping output to user_emails.txt.
|
|
// Then run python email-sha1s.py to get user_sha1s.txt.
|
|
|
|
var normalizedEmails = [];
|
|
var usersWithEmails = db.users.find({emailLower: {$exists: true}}, {emailLower: 1}).forEach(function(u) {
|
|
if(u.emailLower && u.emailLower.trim().length)
|
|
normalizedEmails.push(u.emailLower.trim().toLowerCase().replace('googlemail', 'gmail').replace(/\.(?=.*@)/g, '').replace(/\+.*@/g, '@'));
|
|
});
|
|
normalizedEmails.forEach(function(e) { print(e); });
|