Magik.Validator.validate_length

You're seeing just the function validate_length, go back to Magik.Validator module for more information.
Link to this function

validate_length(value, checks)

View Source

Specs

validate_length(support_length_types(), keyword()) :: :ok | error()

Check if length of value match given conditions. Length condions are the same with validate_number/2

iex(15)> Magik.Validator.validate_length([1], min: 2)
{:error, "length must be greater than or equal to 2"}
iex(16)> Magik.Validator.validate_length("hello", equal_to: 5)
:ok

Supported types

  • list
  • map
  • tuple
  • keyword
  • string