View Source ElixirCLRut.Validations (ElixirCLRUT v1.0.0)
Stores different validation functions
Link to this section Summary
Functions
Receives a Token struct and validates checkdigit with lastdigit. If they are different it will add :wrong_checkdigit to the errors list.
Optional validation. Receives a Token struct and validates the normalized length is above or equal to the given length. Defaults to length 2.
Optional validation. Receives a Token struct and validates that all chars are not jut zeroes.
Receives a Token struct and counts the normalized array, if it's empty it will add :value_is_empty to the errors list.
Link to this section Functions
Receives a Token struct and validates checkdigit with lastdigit. If they are different it will add :wrong_checkdigit to the errors list.
Optional validation. Receives a Token struct and validates the normalized length is above or equal to the given length. Defaults to length 2.
example
Example
iex> (ElixirCLRut.validate("00-0") |> ElixirCLRut.Validations.length()).valid?
true
iex> (ElixirCLRut.validate("00-0") |> ElixirCLRut.Validations.length(3)).valid?
false
Optional validation. Receives a Token struct and validates that all chars are not jut zeroes.
example
Example
iex> (ElixirCLRut.validate("00000000-0") |> not_all_zeroes()).valid?
false
iex> (ElixirCLRut.validate("00000001-9") |> not_all_zeroes()).valid?
true
Receives a Token struct and counts the normalized array, if it's empty it will add :value_is_empty to the errors list.