swiss v2.2.1 Swiss.Map View Source
A few extra functions to deal with Maps.
Link to this section Summary
Functions
Wrapper around Map.from_struct/1
that tolerates nil
.
Converts an atom-keyed map into a string-keyed map.
Link to this section Functions
Wrapper around Map.from_struct/1
that tolerates nil
.
Examples
iex> Swiss.Map.from_struct(nil)
nil
iex> Swiss.Map.from_struct(%{__struct__: SomeStruct, life: 42})
%{life: 42}
Converts an atom-keyed map into a string-keyed map.
Examples
iex> Swiss.Map.to_string_keys(%{life: 42})
%{"life" => 42}
iex> Swiss.Map.to_string_keys(%{"life" => 42, death: 27})
%{"life" => 42, "death" => 27}