View Source Antikythera.NestedMap (antikythera v0.5.1)

Utility functions to work with nested maps.

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.

Functions

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

force_update(m, keys, fun)

View Source
@spec force_update(map(), [any()], (any() -> any())) :: map()
Link to this function

update_existing_in(m, keys, fun)

View Source
@spec 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.