Validator
Validate data input
Validation is a way to validate document. That being said, for example, if a column is declared to be an email, it should also have correct format.
DAB won't automatically validate a document. You must execute it manually using dab.validateDoc()
call.
DAB will try to validate document if:
Its schema collection (i.e:
attributes
) isn't emptyExplicitly defined in
validator
options
All validator.js method are supported:
Validator
Description
contains: "<seed>"
Check if value contains the seed
equals: "<comparison>"
Check if value matches the comparison
isAfter: true
or isAfter: "<dt> [, <format>]"
Check if value is a date that's after now
or after dt
in moment.js specified format
isAlpha: true
or isAlpha: "<locale>"
isAlphanumeric: true
or isAlphanumeric: "<locale>"
isAscii: true
Check if the string contains ASCII chars only
isBase64: true
check if a string is base64 encoded
isBefore: true
or isBefore: "<dt> [, <format>]"
Check if value is a date that's before now
or before dt
in moment.js specified format
isBoolean: true
check if a string is a boolean
isByteLength: true
or isByteLength: {...}
check if the string's length (in UTF-8 bytes) falls in a range
isCreditCard: true
check if the string is a credit card
isCurrency: true
or isCurrency: {...}
isDataURI: true
check if the string is a data uri format
isDecimal: true
or isDecimal: {...}
isDivisibleBy: <number>
check if the string is a number that's divisible by another
isEmail: true
or isEmail: {...}
isEmpty: true
check if the string has a length of zero
isFQDN: true
or isFQDN: {...}
isFloat: true
or isFloat: {...}
isFullWidth: true
check if the string contains any full-width chars
isHalfWidth: true
check if the string contains any half-width chars
isHash: "<algorithm>"
isHexColor: true
check if the string is a hexadecimal color
isHexadecimal: true
check if the string is a hexadecimal number
isIP: true
or isIP: "<version>"
check if the string is an IP. version
= 4 or 6
isISBN: true
or isISBN: "<version>"
check if the string is an ISBN. version
= 10 or 13
Last updated