pit v0.1.0 Pit
The pit
macro lets you pipe value transformations by pattern matching
on data as it is passed down the pipe.
The syntax is expression |> pit(value <- pattern)
.
iex> # The following will ensure there are no errors on
iex> # the response and double the count value from data.
...> import Pit
...> response = {:ok, %{data: %{"count" => 10}, errors: []}}
...> response
...> |> pit(data <- {:ok, %{errors: [], data: data}})
...> |> pit(count * 2 <- %{"count" => count})
20