Created
July 28, 2017 22:58
-
-
Save jeanpaulsio/bdd5ddb95ef6c5e56059a1eaa1e291ed to your computer and use it in GitHub Desktop.
Algorithm for Sorting Duplicate Items
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const filterEmails = emails => { | |
let resultsMap = {}; | |
let results = [] | |
for (let i = 0; i < emails.length; i++) { | |
let email = emails[i].toLowerCase(); | |
if (!resultsMap[email]) { | |
resultsMap[email] = true | |
results.push(email) | |
} | |
} | |
return results; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment