Travis build: 1012

This commit is contained in:
30secondsofcode
2018-01-04 09:30:28 +00:00
parent cd450961a1
commit 2dd334cff5
2 changed files with 5 additions and 5 deletions

View File

@ -639,17 +639,17 @@ difference([1, 2, 3], [1, 2, 4]); // [3]
Filters out all values from an array for which the comparator function does not return `true`.
Use `Array.filter()` and `Array.find()` to find the appropriate values.
Use `Array.filter()` and `Array.findIndex()` to find the appropriate values.
```js
const differenceWith = (arr, val, comp) => arr.filter(a => !val.find(b => comp(a, b)));
const differenceWith = (arr, val, comp) => arr.filter(a => val.findIndex(b => comp(a, b)) === -1);
```
<details>
<summary>Examples</summary>
```js
differenceWith([1, 1.2, 1.5, 3], [1.9, 3], (a, b) => Math.round(a) == Math.round(b)); // [1, 1.2]
differenceWith([1, 1.2, 1.5, 3, 0], [1.9, 3, 0], (a, b) => Math.round(a) === Math.round(b)); // [1, 1.2]
```
</details>