smart_city v2.8.0 SmartCity.Helpers View Source
Functions used across SmartCity modules.
Link to this section Summary
Functions
Merges two maps into one, including sub maps. Matching keys from the right map will override their corresponding key in the left map.
Convert a map with string keys to one with atom keys. Will convert keys nested in a sub-map or a map that is part of a list. Ignores atom keys.
Link to this section Functions
Merges two maps into one, including sub maps. Matching keys from the right map will override their corresponding key in the left map.
Convert a map with string keys to one with atom keys. Will convert keys nested in a sub-map or a map that is part of a list. Ignores atom keys.
Examples
iex> SmartCity.Helpers.to_atom_keys(%{"abc" => 123})
%{abc: 123}
iex> SmartCity.Helpers.to_atom_keys(%{"a" => %{"b" => "c"}})
%{a: %{b: "c"}}
iex> SmartCity.Helpers.to_atom_keys(%{"a" => [%{"b" => "c"}]})
%{a: [%{b: "c"}]}