Skip to content

Instantly share code, notes, and snippets.

@LuigiClaudio
Created April 28, 2021 19:09
Show Gist options
  • Save LuigiClaudio/5689549e5de1248883778659f75f96a8 to your computer and use it in GitHub Desktop.
Save LuigiClaudio/5689549e5de1248883778659f75f96a8 to your computer and use it in GitHub Desktop.
remove duplicates by new set and filter
const removeDuplicates = (data, key) => {
const item = new Set();
return data.filter((obj) => !item.has(obj[key]) && item.add(obj[key]));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment