Does Ramda have a function to remove false values from a list?
I know we can simply do var compact = R.filter(R.identity);
but am I missing the ready-made function?
There's no direct equivalent, but R.filter(R.identity)
and R.filter(Boolean)
both work.
R.reject(R.isNil)
is useful for filtering out null/undefined.
You can use Ramda Adjunct's compact which works like the Underscore / Lodash equivalents.
RA.compact([0, 1, false, 2, '', 3]); //=> [1, 2, 3]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With