View Source ElixirCLRut.Token (ElixirCLRUT v1.0.0)

Token is a struct that is passed between validations. It enables an standarized way of passing down the information.

Link to this section Summary

Functions

Modifies the given Token struct and set the error identifier and valid? to be false.

Initializes a Token struct with valid? true as the default value. This token is passed down between validation functions.

Link to this section Functions

Link to this function

error(token, error)

View Source (since 1.0.0)
@spec error(
  struct(),
  atom()
) :: struct()

Modifies the given Token struct and set the error identifier and valid? to be false.

Link to this function

from(input)

View Source (since 1.0.0)
@spec from(struct()) :: struct()

Initializes a Token struct with valid? true as the default value. This token is passed down between validation functions.

example

Example

iex> from(ElixirCLRut.from("1-9"))
%ElixirCLRut.Token{errors: [], from: %ElixirCLRut.Struct{checkdigit: "9", dashed?: true, from: "1-9", lastdigit: "9", normalized: [1], normalized_with_checkdigit: [1, 9]}, valid?: true}