PassiveSupport.Item.tap
You're seeing just the function
tap
, go back to PassiveSupport.Item module for more information.
Link to this function
tap(item, fun)
Calls fun.(item)
, returning item
with any transformations done therein.
Basically, I got tired of not being able to pipe a value into arbitrary positions of other functions.
Examples
iex> ", " |> Item.tap(&Enum.join(1..10, &1))
"1, 2, 3, 4, 5, 6, 7, 8, 9, 10"
iex> false |> Item.tap(&(unless &1, do: "oh!"))
"oh!"
iex> [5, 4, 3, 2, 1] |> hd |> Item.tap(&(&1 * &1))
25
iex> "hello world!" |> Item.tap(&Regex.scan(~r/lo?/, &1))
[["l"], ["lo"], ["l"]]