PassiveSupport.List.compact_map
You're seeing just the function
compact_map
, go back to PassiveSupport.List module for more information.
Link to this function
compact_map(list, fun, options \\ [])
Specs
Performs the provided function on every non-nil value while removing nil values.
If also_filter_result
is passed, then any nil values that would be returned
from the function are not injected into the list.
Examples
iex> compact_map([1,2,nil,4], &(&1 * 2))
[2,4,8]
iex> compact_map([nil, " ", {}, 0], &PassiveSupport.Item.presence/1, also_filter_result: true)
[0]
iex> compact_map([nil, false, 0], &(&1), also_filter_result: true)
[false, 0]