antikythera v0.4.0 Antikythera.NestedMap View Source

Utility functions to work with nested maps.

Link to this section Summary

Functions

Updates a key in a nested map. Recursively traversing the map according to the given keys to the last member. If the last member exists, update it with the given function. Unlike Kernel.update_in/3, returns :error if any of the keys cannot be found.

Link to this section Functions

Specs

deep_merge(map(), map()) :: map()
Link to this function

force_update(m, keys, fun)

View Source

Specs

force_update(map(), [any()], (any() -> any())) :: map()
Link to this function

update_existing_in(m, keys, fun)

View Source

Specs

update_existing_in(map(), [any()], (any() -> any())) :: {:ok, map()} | :error

Updates a key in a nested map. Recursively traversing the map according to the given keys to the last member. If the last member exists, update it with the given function. Unlike Kernel.update_in/3, returns :error if any of the keys cannot be found.