Tags and tests
This commit is contained in:
6
test/uniqueElementsBy/uniqueElementsBy.js
Normal file
6
test/uniqueElementsBy/uniqueElementsBy.js
Normal file
@ -0,0 +1,6 @@
|
||||
const uniqueElementsBy = (arr, fn) =>
|
||||
arr.reduce((acc, v) => {
|
||||
if (!acc.some(x => fn(v, x))) acc.push(v);
|
||||
return acc;
|
||||
}, []);
|
||||
module.exports = uniqueElementsBy;
|
||||
Reference in New Issue
Block a user