Ensures the value is an array.
The error message to use if the validation fails.
A validation function
Ensures the value is an array and that each item in the array matches the specified validator.
The validation function to apply to each element in the array.
The error message to use if the validation fails.
A validation function
Ensures a value is a date.
The error message to use if the validation fails.
A validation function
Ensures the proposed value is empty. Empty values include null
and undefined
.
Objects are considered empty if they have no own enumerable string keyed properties.
Array-like values such as arguments objects, arrays, buffers, strings, or jQuery-like
collections are considered empty if they have a length of 0. Similarly, maps and sets
are considered empty if they have a size of 0.
The error message to use if the validation fails.
A validation function
Ensures the proposed value passes all of the specified validators.
NOTE: You can use this validator to extend an existing set of validations with additional validation checks.
See the examples for details.
Zero or more Validator functions to apply. You can specify an array or just pass the validators as direct arguments.
The error message to use if the validation fails.
A validation function
Creates a validator where the value will always be valid. You can use this to indicate that any value is acceptable.
The error message to use if the validation fails.
A validation function
Ensures the proposed value is an instance of the specified type.
The type function to check against.
The error message to use if the validation fails.
A validation function
Matches the proposed value against a regular expression.
The Regular Expression to match against.
The error message to use if the validation fails.
A validation function
Negates the specified validator. In other words, if the validator rejects, this validation will resolve. If the validator resolves, this validation will reject with the specified error message.
The validator to negate.
The error message to use if the validation fails.
A validation function
Ensures a value is a number.
The error message to use if the validation fails.
A validation function
Ensures an object conforms to the specified schema, where each property is run against the associated Validator.
NOTE: The proposed object will only be checked against the property names specified in the schema. If the object has additional properties, it will still be considered conforming so long as the schema is satisfied. However, if the object has fewer properties than specified in the schema, it will be considered invalid.
A map of property names to Validator functions. Each validator will be run for the value of the associated property on the proposed object.
The error message to use if the validation fails.
A validation function
Ensures a value equals one of the given expected values.
A validation function
Ensures the value is in the specified range. If no minimum value is
specified, no lower limit will be applied. Same if no maximum value
is specified. The bounds are inclusive, so think of it as [min, max]
,
not (min, max)
.
The minimum value in the range, inclusive.
The maximum value in the range, inclusive.
The error message to use if the validation fails.
A validation function
Ensures the proposed value passes at least one of the specified validators.
NOTE: You can use this validator to extend existing validations. For example, you can enable multiple versions of a schema until support for older versions can be removed.
See the examples for details.
The Validator functions to apply. You can specify an array or just pass the validators as direct arguments.
The error message to use if the validation fails.
A validation function
Creates a validator that always considers the value to be invalid.
The error message to use.
A validation function
Ensures a value is a string.
The error message to use if the validation fails.
A validation function
Contains Validator factories useful for verifying that values conform to desired specifications.