/uniq-with

Remove duplicates based on a predicate function

Primary LanguageJavaScriptMIT LicenseMIT

uniq-with

Remove duplicates based on a predicate function.

build status npm version dependency status license code style: standard

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 

License

MIT