mayo v0.2.0 Mayo.Map
Summary
Functions
Checks the number of the keys in the map
Checks the maximum number of the keys in the map
Checks the minimum number of the keys in the map
Rename a key to another name
Checks the presence of keys
Forbids the presence of keys
Functions
Checks the number of the keys in the map.
iex> Mayo.Map.length(%{foo: "bar"}, 1)
%{foo: "bar"}
iex> Mayo.Map.length(%{}, 1)
{:error, %Mayo.Error{type: "map.length"}}
Checks the maximum number of the keys in the map.
iex> Mayo.Map.max(%{foo: "bar"}, 1)
%{foo: "bar"}
iex> Mayo.Map.max(%{foo: "bar", baz: "boo"}, 1)
{:error, %Mayo.Error{type: "map.max"}}
Checks the minimum number of the keys in the map.
iex> Mayo.Map.min(%{foo: "bar"}, 1)
%{foo: "bar"}
iex> Mayo.Map.min(%{}, 1)
{:error, %Mayo.Error{type: "map.min"}}
Rename a key to another name.
iex> Mayo.Map.rename(%{foo: "bar"}, :foo, :baz)
%{baz: "bar"}
iex> Mayo.Map.rename(%{foo: "bar"}, :bar, :baz)
%{foo: "bar"}
Checks the presence of keys.
iex> Mayo.Map.with(%{foo: "bar", baz: "boo"}, [:foo, :baz])
%{foo: "bar", baz: "boo"}
iex> Mayo.Map.with(%{foo: "bar"}, [:foo, :baz])
{:error, %Mayo.Error{type: "map.with", paths: [:baz]}}