Merge pull request #733 from Siarhei-Zharnasek/master

Simplify intersectionBy
This commit is contained in:
Felix Wu
2018-09-04 22:52:55 +02:00
committed by GitHub
2 changed files with 2 additions and 2 deletions

View File

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

View File

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