is v1.0.0 Is.Validators.Inclusion View Source

Inclusion validator.

Can use list or map for faster lookup. When using map only key matters.

Examples

iex> Is.validate(10, inclusion: [1, 10])
[]

iex> Is.validate(10, inclusion: %{1 => true, 10 => true})
[]

iex> Is.validate(11, inclusion: [1, 10])
[{:error, [], "must be one of the value [1, 10]"}]

iex> Is.validate(11, inclusion: %{1 => true, 10 => true})
[{:error, [], "must be one of the value %{1 => true, 10 => true}"}]

Link to this section Summary

Link to this section Functions