1 |
3a515b92
|
cagy
|
# array-uniq [![Build Status](https://travis-ci.org/sindresorhus/array-uniq.svg?branch=master)](https://travis-ci.org/sindresorhus/array-uniq)
|
2 |
|
|
|
3 |
|
|
> Create an array without duplicates
|
4 |
|
|
|
5 |
|
|
It's already pretty fast, but will be much faster when [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) becomes available in V8 (especially with large arrays).
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
## Install
|
9 |
|
|
|
10 |
|
|
```
|
11 |
|
|
$ npm install --save array-uniq
|
12 |
|
|
```
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
## Usage
|
16 |
|
|
|
17 |
|
|
```js
|
18 |
|
|
const arrayUniq = require('array-uniq');
|
19 |
|
|
|
20 |
|
|
arrayUniq([1, 1, 2, 3, 3]);
|
21 |
|
|
//=> [1, 2, 3]
|
22 |
|
|
|
23 |
|
|
arrayUniq(['foo', 'foo', 'bar', 'foo']);
|
24 |
|
|
//=> ['foo', 'bar']
|
25 |
|
|
```
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
## License
|
29 |
|
|
|
30 |
|
|
MIT © [Sindre Sorhus](https://sindresorhus.com)
|