Simplify differenceBy

This commit is contained in:
Siarhei
2018-10-17 12:01:48 +04:00
parent 4c926b26cd
commit bff7a3b0bb
2 changed files with 2 additions and 2 deletions

View File

@ -6,7 +6,7 @@ Create a `Set` by applying `fn` to each element in `b`, then use `Array.prototyp
```js ```js
const differenceBy = (a, b, fn) => { const differenceBy = (a, b, fn) => {
const s = new Set(b.map(v => fn(v))); const s = new Set(b.map(fn));
return a.filter(x => !s.has(fn(x))); return a.filter(x => !s.has(fn(x)));
}; };
``` ```

View File

@ -1,5 +1,5 @@
const differenceBy = (a, b, fn) => { const differenceBy = (a, b, fn) => {
const s = new Set(b.map(v => fn(v))); const s = new Set(b.map(fn));
return a.filter(x => !s.has(fn(x))); return a.filter(x => !s.has(fn(x)));
}; };
module.exports = differenceBy; module.exports = differenceBy;