Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getUniqueProps(arrayOfObjects, propToCheck) {
- let newObj = new Set();
- arrayOfObjects.forEach(item => {
- newObj.add(JSON.stringify(item[propToCheck]))
- })
- let result = Array.from(newObj).map(item => {
- return { [propToCheck]: JSON.parse(item) }
- })
- return result
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement