Runbox.Utils.Map (runbox v7.0.1)
A set of utility functions for Maps.
Link to this section Summary
Functions
Follows the path
in the (deep) map, defaulting to default
if some of the
objects on the path is missing.
Link to this section Functions
Link to this function
get_path(map, path, default \\ nil)
Follows the path
in the (deep) map, defaulting to default
if some of the
objects on the path is missing.
example
Example
iex> object = %{"some" => %{"deep" => %{"object" => "data"}}}
...> Runbox.Utils.Map.get_path(object, ["some", "deep", "object"])
"data"
iex> Runbox.Utils.Map.get_path(object, ["non-existent"], "default")
"default"