KitchenSink v0.0.1 KitchenSink.Map

This module is a mixin for the elixir map namespace

Summary

Functions

deep_merge overcomes a limitation of Map.merge in that it will merge trees. deep_merge will attempt to make the minimum possible change when it merges 2 trees

merge an array of maps! using merge/1

rename_key remaps a value from one key to another in a map

Functions

deep_merge(list)
deep_merge(left, right)

deep_merge overcomes a limitation of Map.merge in that it will merge trees. deep_merge will attempt to make the minimum possible change when it merges 2 trees.

merge(list)

merge an array of maps! using merge/1

Example:

iex> import KitchenSink.Map iex> merge [%{a: 1}, %{b: 2}, %{c: 3}, %{d: 4}] %{a: 1, b: 2, c: 3, d: 4}

rename_key()
rename_key(map, options)

rename_key remaps a value from one key to another in a map

Example:

iex> import KitchenSink.Map iex> rename_key %{a: 1, b: 2, c: 3, d: 4}, :a, :z %{z: 1, b: 2, c: 3, d: 4}

rename_key(map, key, key)