Surgex.Parser.StringParser (Surgex v4.8.1-git-80a7) View Source

Available options:

  • trim is trimming whitespaces from the string, takes priority over min and max options
  • min is a minimal length of the string, returns :too_short error symbol
  • max is a maximal length of the string, returns :too_long error symbol

Link to this section Summary

Link to this section Types

Specs

errors() :: :too_short | :too_long | :invalid_string

Specs

option() :: {:trim, boolean()} | {:min, integer()} | {:max, integer()}

Link to this section Functions

Specs

call(term(), [option()]) :: {:ok, String.t() | nil} | {:error, errors()}

Specs

trim(%{opts: list(), value: String.t(), error: nil}) :: %{
  opts: list(),
  value: String.t(),
  error: nil
}

Specs

validate_max(%{opts: list(), value: String.t(), error: nil}) :: %{
  opts: list(),
  value: String.t(),
  error: nil | :too_long
}

Specs

validate_min(%{opts: list(), value: String.t(), error: nil}) :: %{
  opts: list(),
  value: String.t(),
  error: nil | :too_short
}