StrawHat v0.6.0 StrawHat.Utils.Map View Source
Functions for transforming maps, keys and values.
Link to this section Summary
Functions
Transforms a map
's String.t
keys to atom()
keys.
Transforms a map
's String.t
values to atom()
values.
Recursively traverse a map and invoke a function for each key/ value pair that transforms the map.
Recursively traverse a map and invoke a function for each key and a function for each value that transform the map.
Transforms a map
's atom()
keys to String.t
keys.
Link to this section Functions
Transforms a map
's String.t
keys to atom()
keys.
options
is a keyword list of options. The available option is::only_existing
which is set totrue
will only convert the binary key to an atom if the atom already exists. The default isfalse
.
Transforms a map
's String.t
values to atom()
values.
options
is a keyword list of options. The available option is::only_existing
which is set totrue
will only convert the binary value to an atom if the atom already exists. The default isfalse
.
Recursively traverse a map and invoke a function for each key/ value pair that transforms the map.
Examples
iex> map = %{a: "a", b: %{c: "c"}}
iex> StrawHat.Utils.Map.deep_map map, fn {k, v} ->
...> {k, String.upcase(v)}
...> end
%{a: "A", b: %{c: "C"}}
Recursively traverse a map and invoke a function for each key and a function for each value that transform the map.
key_function
is a function or function reference that is called for each key of the provided map and any keys of any submapsvalue_function
is a function or function reference that is called for each value of the provided map and any values of any submaps
Transforms a map
's atom()
keys to String.t
keys.