make-unique
Creates and makes an array without duplicates. Even with array of objects with a specified matcher.
If no matcher
specified, it will use Set
if Set
is available in V8.
Install
$ npm install make-unique --save
Usage
let unique = // [1, 2, 3]
unique(array, matcher)
- array
Array
the input array - matcher
function(a, b)
ifmatcher
returnstrue
, then it will treata
equals tob
.
Cleans an array of objects with a specified filter to tell unique
how to determine if two items are the 'same'
// [// {a: 1},// {a: 2}// ]
License
MIT