MessageStore.MapExtra.fetch_in
You're seeing just the function
fetch_in
, go back to MessageStore.MapExtra module for more information.
Specs
Fetches the value for a specific path
in the given map
.
If map
contains the given path
then its value is returned in the shape of {:ok, value}
.
If map
doesn't contain path
, :error is returned.
Examples
iex> a = %{a: 1, b: %{c: 2}}
iex> MapExtra.fetch_in(a, [:a])
{:ok, 1}
iex> a = %{a: 1, b: %{c: 2}}
iex> MapExtra.fetch_in(a, [:b, :c])
{:ok, 2}
iex> a = %{a: 1, b: %{c: 2}}
iex> MapExtra.fetch_in(a, [:b, :d])
:error