antikythera v0.2.0 Antikythera.MapUtil View Source

Utility functions to work with maps.

Link to this section Summary

Functions

Update the key in map with the given function, only when the key exists. Unlike Map.update!/3, it returns :error if the key does not exist

Link to this section Functions

Link to this function difference(m1, m2) View Source
difference(%{optional(k) => v}, %{optional(k) => v}) :: {%{optional(k) => v}, %{optional(k) => {v, v}}, %{optional(k) => v}} when k: any(), v: any()
Link to this function map_values(m, f) View Source
map_values(%{optional(k) => v1}, ({k, v1} -> v2)) :: %{optional(k) => v2} when k: any(), v1: any(), v2: any()
Link to this function update_existing(map, key, fun) View Source
update_existing(map(), any(), (any() -> any())) ::
  {:ok, map()} |
  :error

Update the key in map with the given function, only when the key exists. Unlike Map.update!/3, it returns :error if the key does not exist.