array-differ
Advanced tools
Comparing version
@@ -10,3 +10,3 @@ /** | ||
``` | ||
import arrayDiffer = require('array-differ'); | ||
import arrayDiffer from 'array-differ'; | ||
@@ -17,7 +17,5 @@ arrayDiffer([2, 3, 4], [3, 50]); | ||
*/ | ||
declare function arrayDiffer<ValueType>( | ||
export default function arrayDiffer<ValueType>( | ||
array: readonly ValueType[], | ||
...values: (readonly ValueType[])[] | ||
...values: Array<readonly ValueType[]> | ||
): ValueType[]; | ||
export = arrayDiffer; |
10
index.js
@@ -1,8 +0,4 @@ | ||
'use strict'; | ||
const arrayDiffer = (array, ...values) => { | ||
const rest = new Set([].concat(...values)); | ||
export default function arrayDiffer(array, ...values) { | ||
const rest = new Set([...values].flat()); | ||
return array.filter(element => !rest.has(element)); | ||
}; | ||
module.exports = arrayDiffer; | ||
} |
{ | ||
"name": "array-differ", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"description": "Create an array with values that are present in the first input array but not additional ones", | ||
"license": "MIT", | ||
"repository": "sindresorhus/array-differ", | ||
"funding": "https://github.com/sponsors/sindresorhus", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
"url": "https://sindresorhus.com" | ||
}, | ||
"type": "module", | ||
"exports": "./index.js", | ||
"engines": { | ||
"node": ">=8" | ||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" | ||
}, | ||
@@ -31,6 +34,6 @@ "scripts": { | ||
"devDependencies": { | ||
"ava": "^1.4.1", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
"ava": "^3.15.0", | ||
"tsd": "^0.17.0", | ||
"xo": "^0.44.0" | ||
} | ||
} |
@@ -1,6 +0,5 @@ | ||
# array-differ [](https://travis-ci.org/sindresorhus/array-differ) | ||
# array-differ | ||
> Create an array with values that are present in the first input array but not additional ones | ||
## Install | ||
@@ -12,7 +11,6 @@ | ||
## Usage | ||
```js | ||
const arrayDiffer = require('array-differ'); | ||
import arrayDiffer from 'array-differ'; | ||
@@ -39,5 +37,12 @@ arrayDiffer([2, 3, 4], [3, 50]); | ||
--- | ||
## License | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) | ||
<div align="center"> | ||
<b> | ||
<a href="https://tidelift.com/subscription/pkg/npm-array-differ?utm_source=npm-array-differ&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> | ||
</b> | ||
<br> | ||
<sub> | ||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. | ||
</sub> | ||
</div> |
Sorry, the diff of this file is not supported yet
3388
10.79%47
11.9%Yes
NaN20
-13.04%