Funx.Validator.Contains (funx v0.8.4)
View SourceValidates that a collection contains a specific element using an Eq
comparator.
Contains enforces a membership constraint of the form:
"collection must contain X".
Membership is defined by an Eq instance, not by structural equality or
Elixir's in operator.
Options
:value(required) The element that must be present in the collection.:eq(optional) An equality comparator. Defaults toFunx.Eq.Protocol.:message(optional) A custom error message callback(value -> String.t()).
Semantics
- Succeeds if the collection is a list and contains the element under
Eq. - Fails if the collection does not contain the element or is not a list.
Nothingvalues pass unchanged.Justvalues are unwrapped before validation.