Skip to content

Instantly share code, notes, and snippets.

@ducksoupdev
Created March 16, 2019 18:22
Show Gist options
  • Select an option

  • Save ducksoupdev/145345e2087f56ff47a0f7e3a62bf8e4 to your computer and use it in GitHub Desktop.

Select an option

Save ducksoupdev/145345e2087f56ff47a0f7e3a62bf8e4 to your computer and use it in GitHub Desktop.
Dedupe objects from Array
const books = [
{ name: "x", author: "y" },
{ name: "a", author: "b" },
{ name: "x", author: "y" }
]
const filteredBooks = [...new Set(books.map(b => JSON.stringify(b)))].map(b => JSON.parse(b))
console.log(filteredBooks)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment