Last active
August 29, 2015 14:26
-
-
Save ericentin/a45b94f1bdac84991543 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule KeysToAtoms do | |
def keys_to_atoms(%{} = map) do | |
Enum.map(body, &{String.to_atom(&1), keys_to_atoms(&2)}) | |
|> Enum.into(%{}) | |
end | |
def keys_to_atoms(list) when is_list(list) do | |
Enum.map(list, &keys_to_atoms/1) | |
end | |
def keys_to_atoms(any), do: any | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment