AntlUtilsElixir.Enum (antl_utils_elixir v0.3.0)

Link to this section Summary

Functions

Invokes the given fun for each item in the enumerable.

Link to this section Functions

Link to this function

perform(enumerable, fun)

Specs

perform(any(), (any() -> any())) :: any()

Invokes the given fun for each item in the enumerable.

Returns the value of the function that match the pattern {:error, _} otherwise return :ok

Examples

iex> [1, 2, 3] |> AntlUtilsElixir.Enum.perform(fn x -> {:error, x} end)
{:error, 1}

iex> [1, 2, 3] |> AntlUtilsElixir.Enum.perform(fn _x -> :ok end)
:ok