Skip to content

Validators ​

Validare ships 51 built-in validators across 7 categories. All validators pass on empty string — combine with notEmpty to require a value.

Core (23) ​

ValidatorDescription
notEmptyNot empty (supports trim)
blankEmpty (opposite of notEmpty, supports trim)
emailValid email address
creditCardCredit card number (Luhn check)
dateDate in a specified format
digitsDigits only
integerInteger (positive or negative)
numericNumeric value
regexpMatches a regular expression
uriValid URL
identicalEqual to another field
differentDifferent from another field
betweenBetween min and max
greaterThanGreater than (or equal to) a value
lessThanLess than (or equal to) a value
stringLengthString length (min/max)
stringCaseUppercase or lowercase
choiceNumber of checked checkboxes
fileFile type and size
callbackCustom synchronous function
promiseCustom async function
remoteRemote validation via HTTP
ipIP address (IPv4 and IPv6)

Format & Encoding (6) ​

ValidatorDescription
base64Base64-encoded string
hexHexadecimal number
macMAC address
bicBIC/SWIFT code
uuidUUID (v3, v4, v5)
colorCSS color (#hex, rgb, hsl, named)

Financial Instruments (6) ​

ValidatorDescription
ibanIBAN (77 countries)
vatVAT number (requires country)
cusipCUSIP (North American securities)
isinISIN (International Securities Identification Number)
sedolSEDOL (London Stock Exchange)
gridGRId (Global Release Identifier)

Publication Codes (4) ​

ValidatorDescription
eanEAN barcode (EAN-8 and EAN-13)
isbnISBN-10 and ISBN-13
ismnISMN (International Standard Music Number)
issnISSN (International Standard Serial Number)

Device & Vehicle (5) ​

ValidatorDescription
imeiIMEI (mobile device identifier)
imoIMO vessel number
meidMEID (CDMA device identifier)
stepMultiple of a step value
vinVIN (Vehicle Identification Number, USA)

Tax & Business (4) ​

ValidatorDescription
einEIN (US Employer Identification Number)
rtnRTN (US Routing Transit Number)
sirenSIREN (French company identifier)
siretSIRET (French establishment identifier)

Identity & Geographic (3) ​

ValidatorDescription
idNational ID number (42 countries, requires country)
phonePhone number (requires country)
zipCodePostal/ZIP code (requires country)

Released under the MIT License.