View Source Veli.Validators.Type (Veli v0.2.1)

Type validator. Takes a tuple that contains a atom with nullable boolean.

atoms

Atoms

  • :string
  • :integer
  • :float
  • :boolean

example

Example

rule = [type: {:integer, true}]
Veli.valid(2, rule) # valid
Veli.valid(nil, rule) # valid
Veli.valid(4.2, rule) # not valid

Link to this section Summary

Link to this section Functions

@spec valid?(boolean() | binary() | maybe_improper_list() | number() | map(), atom()) ::
  boolean()