Ramda是否具有从列表中删除错误值的功能?
我知道我们可以做到var compact = R.filter(R.identity);
但是我错过了现成的功能吗?
dav*_*ers 50
有没有直接对应,但R.filter(R.identity)
与R.filter(Boolean)
二者的工作.
R.reject(R.isNil)
过滤掉null/undefined非常有用.
您可以使用Ramda Adjunct的紧凑版,其功能类似于Underscore / Lodash。
RA.compact([0, 1, false, 2, '', 3]); //=> [1, 2, 3]
Run Code Online (Sandbox Code Playgroud)