Closed phanan closed 3 years ago
select([0, false, 1])
should do that already as the default callback is the identity function, no?
Yeah, as so should array_filter
and the likes, but I'd argue a dedicated function is better, even if its internal implementation is exactly the same.
That’s a too limited purpose in my mind that it would warrant an additional function. Let’s not add it! 😄
WDYT about adding a
Functional\compact()
function that removes all falsy values from a collection à la lodash? It can be named something likecompress()
as well if there's any concern regarding the existingcompact()
in PHP. I can give it a try.