View Source Igniter.Code.Map (igniter v0.5.2)

Utilities for working with maps.

Summary

Functions

Puts a value into nested maps at the given path

Puts a value at a path into a map, calling updater on the zipper at the value if the key is already present

Puts a key into a map, calling updater on the zipper at the value if the key is already present

Functions

mappify(list, value)

Puts a value into nested maps at the given path

put_in_map(zipper, path, value, updater \\ nil)

@spec put_in_map(
  Sourceror.Zipper.t(),
  [term()],
  term(),
  (Sourceror.Zipper.t() -> {:ok, Sourceror.Zipper.t()} | :error) | nil
) :: {:ok, Sourceror.Zipper.t()} | :error

Puts a value at a path into a map, calling updater on the zipper at the value if the key is already present

set_map_key(zipper, key, value, updater)

@spec set_map_key(Sourceror.Zipper.t(), term(), term(), (Sourceror.Zipper.t() ->
                                                     {:ok, Sourceror.Zipper.t()}
                                                     | :error)) ::
  {:ok, Sourceror.Zipper.t()} | :error

Puts a key into a map, calling updater on the zipper at the value if the key is already present