Leon Gaban Leon Gaban - 2 months ago 7
Javascript Question

Why is my Ramda dropRepeats function not working here?

As you can see in my Ramda REPL link here, I am expecting the

m
to be dropped from the final array. However it is still there?

enter image description here

Here is the doc on R.dropRepeats

const removeRepeats = tickers => {
console.log('removeRepeats',tickers);
let cleaned = R.dropRepeats(tickers);
console.log('cleaned',cleaned);
return R.dropRepeats(tickers);
};

let tickers = ['m', 'g', 'j', 'm'];

let final = removeRepeats(tickers);

console.log('final', final);

Answer

R.uniq may be the function you're after:

> R.uniq(['m', 'g', 'j', 'm'])
['m', 'g', 'j']