array of objects how to check if property is duplicate code example
Example: find duplicates in an object array
npm i find-array-duplicates
import duplicates from 'find-array-duplicates'
const names = [
{ 'age': 36, 'name': 'Bob' },
{ 'age': 40, 'name': 'Harry' },
{ 'age': 1, 'name': 'Bob' }
]
duplicates(names, 'name').single()
// => [{ 'age': 36, 'name': 'Bob' }]