Extra v0.2.0 Stream.Extra
Extensions to the built-in Stream module.
Link to this section Summary
Functions
Filters out the nil and {_, nil} values from an Enumerable
Executes fun after enum has finished
Streams tuples in the form of {:ok, any} or {:error, any}. Rejects :error tuples while unwrapping
:ok tuples
Unwraps a stream of {:ok, any} tuples. Raises an ArgumentError if it encounters a
{:error, ...} tuple
Link to this section Functions
Filters out the nil and {_, nil} values from an Enumerable.
iex> Stream.Extra.filter_nil_values([1, 2, nil]) |> Enum.to_list [1, 2]
iex> Stream.Extra.filter_nil_values(%{a: “test”, b: nil}) |> Enum.into(%{}) %{a: “test”}
Executes fun after enum has finished.
Streams tuples in the form of {:ok, any} or {:error, any}. Rejects :error tuples while unwrapping
:ok tuples.
iex> Stream.Extra.unwrap_oks([{:ok, 1}, {:error, “Test”}]) |> Enum.into([]) [1]
Unwraps a stream of {:ok, any} tuples. Raises an ArgumentError if it encounters a
{:error, ...} tuple.