JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 32
  • Score
    100M100P100Q66039F
  • License MIT

JavaScript array.filter() compatible unique filter

Package Exports

  • array-filter-unique
  • array-filter-unique/dist/source/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (array-filter-unique) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

array-filter-unique

NPM Version node

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());
//=> ['a', 'b', 'c']

[{name: 'Alice',}, {name: 'Peter',}, {name: 'Alice',}}]
  .filter(arrayFilterUnique(o => o.name));
//=> [{name: 'Alice', …}, {name: 'Peter', …}]

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());