JSPM

posable-array-uniq

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

Create an array or array-like without duplicates

Package Exports

  • posable-array-uniq

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 (posable-array-uniq) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

array-uniq Build Status

Create an array without duplicates

It's already pretty fast, but will be much faster when Set becomes available in V8 (especially with large arrays).

Install

$ npm install --save array-uniq

Usage

var arrayUniq = require('array-uniq')();

arrayUniq([1, 1, 2, 3, 3]);
//=> [1, 2, 3]

arrayUniq(['foo', 'foo', 'bar', 'foo']);
//=> ['foo', 'bar']

var Collection = require('poser').Array();
var collectionUniq = require('array-uniq')(Collection);
var col = new Collection().concat(['foo', 'foo', 'bar', 'foo'])

arrayUniq(col) instanceof Collection
//=> false
collectionUniq(col) instanceof Collection
//=> true

This is only necessary when no Set implementation exists, because when using Set, array-uniq delegates to the array's filter method.

License

MIT © Sindre Sorhus