Dotmap (dotmap v0.1.0)

A module for handling conversions of maps into dot notation and vice versa.

Summary

Functions

Converts a map into an array of tuples.

Converts an array of tuples into a map.

Functions

Converts a map into an array of tuples.

Examples

iex> Dotmap.contract!(%{"a" => 1, "b" => 2})
[{"a", 1}, {"b", 2}]

iex> Dotmap.contract!(%{"a" => 1, "b" => 2, "c" => %{"d" => 3, "e" => 4}})
[{"a", 1}, {"b", 2}, {"c.d", 3}, {"c.e", 4}]

Converts an array of tuples into a map.

Examples

iex> Dotmap.expand!([{"a", 1}, {"b", 2}])
%{"a" => 1, "b" => 2}

iex> Dotmap.expand!([{"a", 1}, {"b", 2}, {"c.d", 3}, {"c.e", 4}])
%{"a" => 1, "b" => 2, "c" => %{"d" => 3, "e" => 4}}