Map¶
drop(map, keys)
¶
Returns a map where keys are removed (dropped).
Examples:
iex> drop(%{"a" => 1}, ["a"])
%{}
iex> drop(%{"a" => 1, "b" => 2}, ["a"])
%{"b" => 2}
merge(m1, m2)
¶
Merges two maps where map2 is overlaid on map1 meaning if key is nil we keep map1 value.
Examples:
iex> merge(%{"a" => 1}, %{"a" => 2})
%{"a" => 2}
iex> merge(%{"a" => 1}, %{"a" => nil})
%{"a" => 1}
take(map, keys)
¶
Returns a map where only the given keys are kept.
Examples:
iex> take(%{"a" => 1}, [])
%{}
iex> take(%{"a" => 1, "b" => 2}, ["a"])
%{"a" => 1}