- exists - The field must exist, and not be
undefined. - required - The field must exist, and not be
undefined,nullor an empty string. - empty - The field must be some kind of "empty". Things that are considered "empty" are as follows:
""(empty string)[](empty array){}(empty object)- Other falsey values
- alpha -
a-z,A-Z - alphaNumeric -
a-z,A-Z,0-9 - alphaUnderscore -
a-z,A-Z,0-9,_ - alphaDash -
a-z,A-Z,0-9,_,-
Length-related validators may apply to both strings and arrays.
- exactLength:
length- The value must have a length of exactlylength. - minLength:
length- The value must have a length of at leastlength. - maxLength:
length- The value must have a length of at mostlength. - contains:
needle- The value must contain the specifiedneedle(applies to both strings and arrays). - accepted - Must be a value that indicates agreement - varies by language (defaulting to
en):- en, fr, nl -
"yes","on","1",1,"true",true - es -
"yes","on","1",1,"true",true,"si" - ru -
"yes","on","1",1,"true",true,"да"
- en, fr, nl -
Note that "numbers" refers to both Number-type values, and strings containing numeric values!
- numeric - Must be a finite numeric value of some sort.
- integer - Must be an integer value (either positive or negative).
- natural - Must be a natural number (ie. an integer value of 0 or higher).
- naturalNonZero - Must be a natural number, but higher than 0 (ie. an integer value of 1 or higher).
- between:
min:max- The value must numerically be between theminandmaxvalues (exclusive). - range:
min:max- The value must numerically be within theminandmaxvalues (inclusive). - lessThan:
maxValue- The value must numerically be less than the specifiedmaxValue(exclusive). - lessThanEqualTo:
maxValue- The value must numerically be less than or equal to the specifiedmaxValue(inclusive). - greaterThan:
minValue- The value must numerically be greater than the specifiedminValue(exclusive). - greaterThanEqualTo:
minValue- The value must numerically be greater than or equal to the specifiedminValue(inclusive).
- matchesField:
field- The value in this field must equal the value in the specified otherfield. - different:
field- The value in this field must not equal the value in the specified otherfield.
- NaN - Must be
NaN. - null - Must be
null - string - Must be a
String. - number - Must be a
Number. - array - Must be an
Array. - plainObject - Must be a plain
object(ie. object literal). - date - Must be a
Dateobject. - function - Must be a
Function. - regExp - Must be a
RegExpobject. - arguments - Must be an
argumentsobject.
- email - Must be a validly formatted e-mail address.
- luhn - Must be a validly formatted creditcard number (according to a Luhn regular expression).
- url - Must be a validly formatted URL.
- ipv4 - Must be a validly formatted IPv4 address.
- ipv6 - Must be a validly formatted IPv6 address.
- uuid - Must be a validly formatted UUID.
- base64 - Must be a validly formatted base64 string.