View Source Vx.Match (Vx v0.4.0)
The Match helper checks whether a value matches a pattern. As this relies on
macros, you need to require Vx.Match
before using it.
Summary
Functions
Creates a new type that matches a pattern.
Functions
Creates a new type that matches a pattern.
Examples
iex> require Vx.Match
...> schema = Vx.Match.t(%{a: _, b: _})
...> Vx.validate!(schema, %{a: 1, b: 2})
:ok
iex> require Vx.Match
...> schema = Vx.Match.t(%{a: _, b: _})
...> Vx.validate!(schema, %{a: 1, c: 2})
** (Vx.Error) must match %{a: _, b: _}