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