Elixir Change Map Key Name

[Solved] Elixir Change Map Key Name | Elixir - Code Explorer | yomemimo.com
Question : elixir change map key name

Answered by : nguyen-quang-huy

iex> details = %{name: "john", address1: "heaven", mobile1: "999999999"}
# %{address1: "heaven", mobile1: "999999999", name: "john"}
iex> Map.new(details, fn {:address1, address} -> {:address, address} {:mobile1, mobile} -> {:phone, mobile} x -> x
end)
# %{address: "heaven", name: "john", phone: "999999999"}

Source : | Last Update : Mon, 06 Jun 22

Answers related to elixir change map key name

Code Explorer Popular Question For Elixir