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.
4
4
5
-
Why another array `difference` lib? I wanted the [fastest, correct implementation](./benchmark) I could find.
5
+
## Install
6
6
7
-
## Install with [npm](npmjs.org)
7
+
Install with [npm](https://www.npmjs.com/)
8
8
9
-
```bash
10
-
npm i arr-diff --save
9
+
```sh
10
+
$ npm i arr-diff --save
11
11
```
12
-
### Install with [bower](https://github.com/bower/bower)
13
12
14
-
```bash
15
-
bower install arr-diff --save
13
+
Install with [bower](http://bower.io/)
14
+
15
+
```sh
16
+
$ bower install arr-diff --save
16
17
```
17
18
18
-
## Usage
19
+
## API
19
20
20
-
### [diff](index.js#L38)
21
+
### [diff](index.js#L33)
21
22
22
23
Return the difference between the first array and additional arrays.
23
24
24
-
*`a`**{Array}**
25
-
*`b`**{Array}**
26
-
*`returns`: {Array}
25
+
**Params**
26
+
27
+
*`a`**{Array}**
28
+
*`b`**{Array}**
29
+
*`returns`**{Array}**
30
+
31
+
**Example**
27
32
28
33
```js
29
-
var diff =require('{%= name %}');
34
+
var diff =require('arr-diff');
30
35
31
36
var a = ['a', 'b', 'c', 'd'];
32
37
var b = ['b', 'c'];
@@ -35,47 +40,36 @@ console.log(diff(a, b))
35
40
//=> ['a', 'd']
36
41
```
37
42
43
+
## Related projects
38
44
45
+
*[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)
46
+
*[array-filter](https://www.npmjs.com/package/array-filter): Array#filter for older browsers. | [homepage](https://github.com/juliangruber/array-filter)
47
+
*[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)
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