effusion v0.2.0 Effusion.Map View Source

Useful Map functions.

Link to this section Summary

Functions

Functions exactly like Map.get_and_update/3, but also takes a default value to use if the value at key is nil.

Rename the keys of map according to the rules given by names.

Link to this section Functions

Link to this function

get_and_update(map, key, fun, default \\ nil)

View Source

Functions exactly like Map.get_and_update/3, but also takes a default value to use if the value at key is nil.

The function argument fun will be run on the default argument.

Rename the keys of map according to the rules given by names.

Examples

iex> Effusion.Map.rename_keys(%{a: 1, b: 2}, %{a: :x, b: :y})
%{x: 1, y: 2}