OkThen.Result.from_as
You're seeing just the function
from_as
, go back to OkThen.Result module for more information.
Link to this function
from_as(value, tag)
Specs
Converts value
into a maybe_is(tag)
result: {atom(), any()} | :none
If value
is nil
, then the result will be :none
. See also from_as!/2
.
Otherwise, the result will be a two-element tuple, where the first element is the provided tag,
and the second element is value
.
Examples
iex> "hello" |> Result.from_as(:ok)
{:ok, "hello"}
iex> Result.from_as({1, 2}, :something)
{:something, {1, 2}}
iex> Result.from_as({}, :any_atom)
:any_atom
iex> Result.from_as(nil, :ok)
:none