假设我有两个数组:
const data = [1, 2, 3, 4]
const predicateArray = [true, false, false, true]
我希望返回值为:
[1, 4]
到目前为止,我想到了以下内容:
pipe(
zipWith((fst, scnd) => scnd ? fst : null)),
reject(isNil)
)(data, predicateArray)
有没有更干净/内置的方法来完成这个操作?
推荐使用Ramda中的解决方案。