array-filter-unique
JavaScript array.filter() compatible unique filter
As all unique libraries are used as a function and not within the easily stackable and immutable arr.format() style I made my own.
Install
npm install array-filter-unique
Usage
import {arrayFilterUnique} from 'array-filter-unique';
['a', 'a', 'b', 'c']
.filter(arrayFilterUnique());
[{name: 'Alice', …}, {name: 'Peter', …}, {name: 'Alice', …}}]
.filter(arrayFilterUnique(o => o.name));
API
arrayFilterUnique([selector])
selector
Type: item => string
Select what to check in the given item
Migrate from v2 to v3
-const arrayFilterUnique = require('array-filter-unique');
+import {arrayFilterUnique} from 'array-filter-unique';
someArray.filter(arrayFilterUnique());