Created
March 16, 2019 18:22
-
-
Save ducksoupdev/145345e2087f56ff47a0f7e3a62bf8e4 to your computer and use it in GitHub Desktop.
Dedupe objects from Array
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
| 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