Useful (useful v0.1.0)
Documentation for Useful
functions library.
Link to this section Summary
Functions
atomize_map_keys/1
converts a map with different keys
to a map with just atom keys. Works recursively for nested maps.
Inspired by stackoverflow.com/questions/31990134
Link to this section Functions
Link to this function
atomize_map_keys(map)
atomize_map_keys/1
converts a map with different keys
to a map with just atom keys. Works recursively for nested maps.
Inspired by stackoverflow.com/questions/31990134
Examples
iex> Useful.atomize_map_keys(%{"name" => "alex", id: 1})
%{id: 1, name: "alex"}
iex> Useful.atomize_map_keys(%{"name" => "alex", data: %{ "age" => 17}})
%{name: "alex", data: %{age: 17}}