Map.update

You're seeing just the function update, go back to Map module for more information.
Link to this function

update(map, key, default, fun)

View Source

Specs

update(
  map(),
  key(),
  default :: value(),
  (existing_value :: value() -> new_value :: value())
) :: map()

Updates the key in map with the given function.

If key is present in map then the existing value is passed to fun and its result is used as the updated value of key. If key is not present in map, default is inserted as the value of key. The default value will not be passed through the update function.

Examples

iex> Map.update(%{a: 1}, :a, 13, fn existing_value -> existing_value * 2 end)
%{a: 2}
iex> Map.update(%{a: 1}, :b, 11, fn existing_value -> existing_value * 2 end)
%{a: 1, b: 11}