https://codehandbook.org/how-to-remove-duplicates-from-javascript-array/
Last active
October 17, 2018 12:21
-
-
Save peponi/5a950953d9d6aff8e86ad0b436209700 to your computer and use it in GitHub Desktop.
prevent doubeled objects in 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 getUniqueObjectArray = ({arr, compKey}) => arr.filter((el, index, self) => index === self.findIndex(item => item[compKey] === el[compKey])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment