uniq-with
v0.1.2
Published
Remove duplicates based on a predicate function
Downloads
2
Maintainers
Readme
uniq-with
Remove duplicates based on a predicate function.
Installation
$ npm install uniq-with
Example
const uniqWith = require('uniq-with')
const data = [
{ id: 1 },
{ id: 5 },
{ id: 2 },
{ id: 2 },
{ id: 2 },
{ id: 5 }
]
console.log(uniqWith((a, b) => a.id === b.id, data))
// ->
// [
// { id: 1 },
// { id: 5 },
// { id: 2 }
// ]
Tests
$ npm test