diff --git a/snippets/intersectionBy.md b/snippets/intersectionBy.md index 3f28a78be..95ad8ffc7 100644 --- a/snippets/intersectionBy.md +++ b/snippets/intersectionBy.md @@ -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))); }; ``` diff --git a/test/intersectionBy/intersectionBy.js b/test/intersectionBy/intersectionBy.js index 0d598f30b..0a6684fce 100644 --- a/test/intersectionBy/intersectionBy.js +++ b/test/intersectionBy/intersectionBy.js @@ -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;