PassiveSupport.Item.tee

You're seeing just the function tee, go back to PassiveSupport.Item module for more information.

Calls fun.(item) and returns item unaltered.

This function mimics the tee program in shell systems, allowing a copy of the passed-in item to be sent to another function amid a pipeline of other functions that are transforming it or handing it off for another value.

Examples

1..10 |> Enum.to_list |> tee(&Logger.info(inspect(&1, label: "`1..10` as a list")))
# (… output from Logger …)
# => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

some_data |> tee(&IO.inspect(&1, label: "encoding as json")) |> Jason.encode!
# => JSON-encoded data