Surgex v3.2.7 Surgex.Parser.StringParser 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

Link to this type errors() View Source
errors() :: :too_short | :too_long

Link to this section Functions

Link to this function call(input, opts \\ []) View Source
call(nil, any()) :: {:ok, nil}
call(String.t(), list()) :: {:ok, String.t()} | {:error, errors()}
Link to this function trim(input) View Source
trim(%{opts: list(), value: String.t(), error: nil}) :: %{
  opts: list(),
  value: String.t(),
  error: nil
}
Link to this function validate_max(input) View Source
validate_max(%{opts: list(), value: String.t(), error: nil}) :: %{
  opts: list(),
  value: String.t(),
  error: nil | :too_long
}
Link to this function validate_min(input) View Source
validate_min(%{opts: list(), value: String.t(), error: nil}) :: %{
  opts: list(),
  value: String.t(),
  error: nil | :too_short
}