smart_city v3.18.1 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.
Standardize file type definitions by deferring to the official media type of the file based on a supplied extension.
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 Types
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.
Standardize file type definitions by deferring to the official media type of the file based on a supplied extension.
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"}]}