Open misterfish opened 8 years ago
You say you end up using an extra compact
, although it strips all falsy values, not just void
s and null
s. And I actually more often find myself wanting all falsy values out, than just all nully values.
PS. that
works as a value of expressions in the when
clauses too.
Hi,
My proposal is a
map-ok
function, which is identical tomap
, except that returningundefined
ornull
will remove the element from the output list.The use case is that I often find myself wanting to remove an element while I'm mapping, and end up using an extra
compact
. It would be nice to be able to do it the first time around. (cf. Perl, for example, where you can return()
).