validators/presence library
Presence Validators
This file contains validators for checking the presence of a value.
Functions
-
nullable(
IValidator validator) → IValidator - If the field is not present (null) it will be considered valid If you want to allow empty strings as valid, use optional instead
-
optional(
IValidator validator) → IValidator -
If the field is not present, it will be considered valid, if present, it executes the
validator
. It's different from nullable in that it also checks for empty strings