Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save leslie-alldridge/2ea3c56c3d29fec7823e803d23004e71 to your computer and use it in GitHub Desktop.
Save leslie-alldridge/2ea3c56c3d29fec7823e803d23004e71 to your computer and use it in GitHub Desktop.
object single item only
const obj = faves.reduce((acc, entry, i, arr) => {
if (!acc.hasOwnProperty(entry.id)) acc[entry.id] = entry
return acc
}, {})
const noDupes = Object.keys(obj).map(key => obj[key])
@leslie-alldridge
Copy link
Author

change faves. to whatever array you're using

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment