You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.
3
+
Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.
4
4
5
5
## Install
6
6
7
-
Install with [npm](https://www.npmjs.com/)
7
+
Install with [npm](https://www.npmjs.com/):
8
8
9
9
```sh
10
-
$ npm i arr-diff --save
10
+
$ npm install arr-diff --save
11
11
```
12
+
12
13
Install with [bower](http://bower.io/)
13
14
14
15
```sh
15
16
$ bower install arr-diff --save
16
17
```
17
18
18
-
## API
19
-
20
-
### [diff](index.js#L33)
21
-
22
-
Return the difference between the first array and additional arrays.
23
-
24
-
**Params**
19
+
## Usage
25
20
26
-
*`a`**{Array}**
27
-
*`b`**{Array}**
28
-
*`returns`**{Array}**
29
-
30
-
**Example**
21
+
Returns the difference between the first array and additional arrays.
31
22
32
23
```js
33
24
var diff =require('arr-diff');
@@ -39,36 +30,70 @@ console.log(diff(a, b))
39
30
//=> ['a', 'd']
40
31
```
41
32
33
+
## Benchmarks
34
+
35
+
This library versus [array-differ](https://github.com/sindresorhus/array-differ), on May 07, 2016:
36
+
37
+
```
38
+
# benchmark/fixtures/long.js (94529 bytes)
39
+
current x 1,246 ops/sec ±0.98% (85 runs sampled)
40
+
array-differ x 993 ops/sec ±1.35% (87 runs sampled)
41
+
42
+
# benchmark/fixtures/med.js (708 bytes)
43
+
current x 583,612 ops/sec ±1.24% (87 runs sampled)
44
+
array-differ x 464,480 ops/sec ±1.42% (85 runs sampled)
45
+
46
+
# benchmark/fixtures/short.js (60 bytes)
47
+
current x 788,823 ops/sec ±0.95% (89 runs sampled)
48
+
array-differ x 521,483 ops/sec ±1.65% (86 runs sampled)
49
+
```
50
+
42
51
## Related projects
43
52
53
+
You might also be interested in these projects:
54
+
44
55
*[arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten)
45
56
*[array-filter](https://www.npmjs.com/package/array-filter): Array#filter for older browsers. | [homepage](https://github.com/juliangruber/array-filter)
46
57
*[array-intersection](https://www.npmjs.com/package/array-intersection): Return an array with the unique values present in _all_ given arrays using strict equality… [more](https://www.npmjs.com/package/array-intersection) | [homepage](https://github.com/jonschlinkert/array-intersection)
47
58
48
-
## Running tests
59
+
## Contributing
49
60
50
-
Install dev dependencies:
61
+
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/arr-diff/issues/new).
62
+
63
+
## Building docs
64
+
65
+
Generate readme and API documentation with [verb](https://github.com/verbose/verb):
51
66
52
67
```sh
53
-
$ npm i -d&& npm test
68
+
$ npm install verb&& npm run docs
54
69
```
55
70
56
-
## Contributing
71
+
Or, if [verb](https://github.com/verbose/verb) is installed globally:
57
72
58
-
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/arr-diff/issues/new).
0 commit comments