Created
July 27, 2017 00:58
-
-
Save Sequoya42/58b465ae48553c079a787cd8f46de64a to your computer and use it in GitHub Desktop.
This file contains 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 removeDuplicate = (arr, key, value, nkey = key, nvalue = value) => { | |
const bail = arr.reduce((a, b) => Object.assign(a, { [b[key]]: b[value] })); | |
return Object.keys(bail).map(key => ({ | |
[nkey]: key, | |
[nvalue]: bail[key] | |
})); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment