Skip to content

Instantly share code, notes, and snippets.

@jeanpaulsio
Created July 28, 2017 22:58
Show Gist options
  • Save jeanpaulsio/bdd5ddb95ef6c5e56059a1eaa1e291ed to your computer and use it in GitHub Desktop.
Save jeanpaulsio/bdd5ddb95ef6c5e56059a1eaa1e291ed to your computer and use it in GitHub Desktop.
Algorithm for Sorting Duplicate Items
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