mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-29 18:45:48 -05:00
11 lines
563 B
JavaScript
11 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); });
|