为什么我的 Ramda dropRepeats 函数在这里不起作用?
Why is my Ramda dropRepeats function not working here?
正如您在我的 Ramda REPL link here 中看到的那样,我希望 m
从最终数组中删除。然而它还在吗?
上的文档
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);
R.uniq
可能是您想要的功能:
> R.uniq(['m', 'g', 'j', 'm'])
['m', 'g', 'j']
正如您在我的 Ramda REPL link here 中看到的那样,我希望 m
从最终数组中删除。然而它还在吗?
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);
R.uniq
可能是您想要的功能:
> R.uniq(['m', 'g', 'j', 'm'])
['m', 'g', 'j']