String validation

Overview

validator.js

NPM version CI Coverage Downloads Backers on Open Collective Sponsors on Open Collective Gitter

A library of string validators and sanitizers.

Strings only

This library validates and sanitizes strings only.

If you're not sure if your input is a string, coerce it using input + ''. Passing anything other than a string will result in an error.

Installation and Usage

Server-side usage

Install the library with npm install validator

No ES6

var validator = require('validator');

validator.isEmail('[email protected]'); //=> true

ES6

import validator from 'validator';

Or, import only a subset of the library:

import isEmail from 'validator/lib/isEmail';

Tree-shakeable ES imports

import isEmail from 'validator/es/lib/isEmail';

Client-side usage

The library can be loaded either as a standalone script, or through an AMD-compatible loader

<script type="text/javascript" src="validator.min.js"></script>
<script type="text/javascript">
  validator.isEmail('[email protected]'); //=> true
</script>

The library can also be installed through bower

$ bower install validator-js

Contributors

Become a backer

Become a sponsor

Thank you to the people who have already contributed:

Validators

Here is a list of the validators currently available.

Validator Description
contains(str, seed [, options ]) check if the string contains the seed.

options is an object that defaults to { ignoreCase: false}.
ignoreCase specified whether the case of the substring be same or not.
equals(str, comparison) check if the string matches the comparison.
isAfter(str [, date]) check if the string is a date that's after the specified date (defaults to now).
isAlpha(str [, locale, options]) check if the string contains only letters (a-zA-Z).

Locale is one of ['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fa-IR', 'fr-CA', 'fr-FR', 'he', 'hu-HU', 'it-IT', 'ku-IQ', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'sl-SI', 'sk-SK', 'sr-RS', 'sr-RS@latin', 'sv-SE', 'tr-TR', 'uk-UA']) and defaults to en-US. Locale list is validator.isAlphaLocales. options is an optional object that can be supplied with the following key(s): ignore which can either be a String or RegExp of characters to be ignored e.g. " -" will ignore spaces and -'s.
isAlphanumeric(str [, locale, options]) check if the string contains only letters and numbers (a-zA-Z0-9).

Locale is one of ['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fa-IR', 'fr-CA', 'fr-FR', 'he', 'hu-HU', 'it-IT', 'ku-IQ', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'sl-SI', 'sk-SK', 'sr-RS', 'sr-RS@latin', 'sv-SE', 'tr-TR', 'uk-UA']) and defaults to en-US. Locale list is validator.isAlphanumericLocales. options is an optional object that can be supplied with the following key(s): ignore which can either be a String or RegExp of characters to be ignored e.g. " -" will ignore spaces and -'s.
isAscii(str) check if the string contains ASCII chars only.
isBase32(str) check if a string is base32 encoded.
isBase58(str) check if a string is base58 encoded.
isBase64(str [, options]) check if a string is base64 encoded. options is optional and defaults to {urlSafe: false}
when urlSafe is true it tests the given base64 encoded string is url safe
isBefore(str [, date]) check if the string is a date that's before the specified date.
isBIC(str) check if a string is a BIC (Bank Identification Code) or SWIFT code.
isBoolean(str) check if a string is a boolean.
isBtcAddress(str) check if the string is a valid BTC address.
isByteLength(str [, options]) check if the string's length (in UTF-8 bytes) falls in a range.

options is an object which defaults to {min:0, max: undefined}.
isCreditCard(str) check if the string is a credit card.
isCurrency(str [, options]) check if the string is a valid currency amount.

options is an object which defaults to {symbol: '$', require_symbol: false, allow_space_after_symbol: false, symbol_after_digits: false, allow_negatives: true, parens_for_negatives: false, negative_sign_before_digits: false, negative_sign_after_digits: false, allow_negative_sign_placeholder: false, thousands_separator: ',', decimal_separator: '.', allow_decimal: true, require_decimal: false, digits_after_decimal: [2], allow_space_after_digits: false}.
Note: The array digits_after_decimal is filled with the exact number of digits allowed not a range, for example a range 1 to 3 will be given as [1, 2, 3].
isDataURI(str) check if the string is a data uri format.
isDate(input [, options]) Check if the input is a valid date. e.g. [2002-07-15, new Date()].

options is an object which can contain the keys format, strictMode and/or delimiters

format is a string and defaults to YYYY/MM/DD.

strictMode is a boolean and defaults to false. If strictMode is set to true, the validator will reject inputs different from format.

delimiters is an array of allowed date delimiters and defaults to ['/', '-'].
isDecimal(str [, options]) check if the string represents a decimal number, such as 0.1, .3, 1.1, 1.00003, 4.0, etc.

options is an object which defaults to {force_decimal: false, decimal_digits: '1,', locale: 'en-US'}

locale determine the decimal separator and is one of ['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fa', 'fa-AF', 'fa-IR', 'fr-FR', 'fr-CA', 'hu-HU', 'id-ID', 'it-IT', 'ku-IQ', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pl-Pl', 'pt-BR', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS', 'sr-RS@latin', 'sv-SE', 'tr-TR', 'uk-UA', 'vi-VN'].
Note: decimal_digits is given as a range like '1,3', a specific value like '3' or min like '1,'.
isDivisibleBy(str, number) check if the string is a number that's divisible by another.
isEAN(str) check if the string is an EAN (European Article Number).
isEmail(str [, options]) check if the string is an email.

options is an object which defaults to { allow_display_name: false, require_display_name: false, allow_utf8_local_part: true, require_tld: true, allow_ip_domain: false, domain_specific_validation: false, blacklisted_chars: '' }. If allow_display_name is set to true, the validator will also match Display Name <email-address>. If require_display_name is set to true, the validator will reject strings without the format Display Name <email-address>. If allow_utf8_local_part is set to false, the validator will not allow any non-English UTF8 character in email address' local part. If require_tld is set to false, e-mail addresses without having TLD in their domain will also be matched. If ignore_max_length is set to true, the validator will not check for the standard max length of an email. If allow_ip_domain is set to true, the validator will allow IP addresses in the host part. If domain_specific_validation is true, some additional validation will be enabled, e.g. disallowing certain syntactically valid email addresses that are rejected by GMail. If blacklisted_chars recieves a string,then the validator will reject emails that include any of the characters in the string, in the name part.
isEmpty(str [, options]) check if the string has a length of zero.

options is an object which defaults to { ignore_whitespace:false }.
isEthereumAddress(str) check if the string is an Ethereum address using basic regex. Does not validate address checksums.
isFloat(str [, options]) check if the string is a float.

options is an object which can contain the keys min, max, gt, and/or lt to validate the float is within boundaries (e.g. { min: 7.22, max: 9.55 }) it also has locale as an option.

min and max are equivalent to 'greater or equal' and 'less or equal', respectively while gt and lt are their strict counterparts.

locale determine the decimal separator and is one of ['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fr-CA', 'fr-FR', 'hu-HU', 'it-IT', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS', 'sr-RS@latin', 'sv-SE', 'tr-TR', 'uk-UA']. Locale list is validator.isFloatLocales.
isFQDN(str [, options]) check if the string is a fully qualified domain name (e.g. domain.com).

options is an object which defaults to { require_tld: true, allow_underscores: false, allow_trailing_dot: false , allow_numeric_tld: false }.
isFullWidth(str) check if the string contains any full-width chars.
isHalfWidth(str) check if the string contains any half-width chars.
isHash(str, algorithm) check if the string is a hash of type algorithm.

Algorithm is one of ['md4', 'md5', 'sha1', 'sha256', 'sha384', 'sha512', 'ripemd128', 'ripemd160', 'tiger128', 'tiger160', 'tiger192', 'crc32', 'crc32b']
isHexadecimal(str) check if the string is a hexadecimal number.
isHexColor(str) check if the string is a hexadecimal color.
isHSL(str) check if the string is an HSL (hue, saturation, lightness, optional alpha) color based on CSS Colors Level 4 specification.

Comma-separated format supported. Space-separated format supported with the exception of a few edge cases (ex: hsl(200grad+.1%62%/1)).
isIBAN(str) check if a string is a IBAN (International Bank Account Number).
isIdentityCard(str [, locale]) check if the string is a valid identity card code.

locale is one of ['ES', 'IN', 'IT', 'NO', 'zh-TW', 'he-IL', 'ar-LY', 'ar-TN', 'zh-CN'] OR 'any'. If 'any' is used, function will check if any of the locals match.

Defaults to 'any'.
isIMEI(str [, options])) check if the string is a valid IMEI number. Imei should be of format ############### or ##-######-######-#.

options is an object which can contain the keys allow_hyphens. Defaults to first format . If allow_hyphens is set to true, the validator will validate the second format.
isIn(str, values) check if the string is in a array of allowed values.
isInt(str [, options]) check if the string is an integer.

options is an object which can contain the keys min and/or max to check the integer is within boundaries (e.g. { min: 10, max: 99 }). options can also contain the key allow_leading_zeroes, which when set to false will disallow integer values with leading zeroes (e.g. { allow_leading_zeroes: false }). Finally, options can contain the keys gt and/or lt which will enforce integers being greater than or less than, respectively, the value provided (e.g. {gt: 1, lt: 4} for a number between 1 and 4).
isIP(str [, version]) check if the string is an IP (version 4 or 6).
isIPRange(str) check if the string is an IP Range(version 4 only).
isISBN(str [, version]) check if the string is an ISBN (version 10 or 13).
isISIN(str) check if the string is an ISIN (stock/security identifier).
isISO8601(str) check if the string is a valid ISO 8601 date.
options is an object which defaults to { strict: false, strictSeparator: false }. If strict is true, date strings with invalid dates like 2009-02-29 will be invalid. If strictSeparator is true, date strings with date and time separated by anything other than a T will be invalid.
isISO31661Alpha2(str) check if the string is a valid ISO 3166-1 alpha-2 officially assigned country code.
isISO31661Alpha3(str) check if the string is a valid ISO 3166-1 alpha-3 officially assigned country code.
isISRC(str) check if the string is a ISRC.
isISSN(str [, options]) check if the string is an ISSN.

options is an object which defaults to { case_sensitive: false, require_hyphen: false }. If case_sensitive is true, ISSNs with a lowercase 'x' as the check digit are rejected.
isJSON(str [, options]) check if the string is valid JSON (note: uses JSON.parse).

options is an object which defaults to { allow_primitives: false }. If allow_primitives is true, the primitives 'true', 'false' and 'null' are accepted as valid JSON values.
isJWT(str) check if the string is valid JWT token.
isLatLong(str [, options]) check if the string is a valid latitude-longitude coordinate in the format lat,long or lat, long.

options is an object that defaults to { checkDMS: false }. Pass checkDMS as true to validate DMS(degrees, minutes, and seconds) latitude-longitude format.
isLength(str [, options]) check if the string's length falls in a range.

options is an object which defaults to {min:0, max: undefined}. Note: this function takes into account surrogate pairs.
isLicensePlate(str [, locale]) check if string matches the format of a country's license plate.

(locale is one of ['de-DE', 'de-LI', 'pt-PT', 'sq-AL', 'pt-BR''] or any).
isLocale(str) check if the string is a locale
isLowercase(str) check if the string is lowercase.
isMACAddress(str) check if the string is a MAC address.

options is an object which defaults to {no_separators: false}. If no_separators is true, the validator will allow MAC addresses without separators. Also, it allows the use of hyphens, spaces or dots e.g '01 02 03 04 05 ab', '01-02-03-04-05-ab' or '0102.0304.05ab'.
isMagnetURI(str) check if the string is a magnet uri format.
isMD5(str) check if the string is a MD5 hash.

Please note that you can also use the isHash(str, 'md5') function. Keep in mind that MD5 has some collision weaknesses compared to other algorithms (e.g., SHA).
isMimeType(str) check if the string matches to a valid MIME type format
isMobilePhone(str [, locale [, options]]) check if the string is a mobile phone number,

(locale is either an array of locales (e.g ['sk-SK', 'sr-RS']) OR one of ['am-Am', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', ar-JO', 'ar-KW', 'ar-SA', 'ar-SY', 'ar-TN', 'az-AZ', 'az-LY', 'az-LB', 'bs-BA', 'be-BY', 'bg-BG', 'bn-BD', 'ca-AD', 'cs-CZ', 'da-DK', 'de-DE', 'de-AT', 'de-CH', 'de-LU', 'el-GR', 'en-AU', 'en-CA', 'en-GB', 'en-GG', 'en-GH', 'en-HK', 'en-MO', 'en-IE', 'en-IN', 'en-KE', 'en-MT', 'en-MU', 'en-NG', 'en-NZ', 'en-PK', 'en-PH', 'en-RW', 'en-SG', 'en-SL', 'en-UG', 'en-US', 'en-TZ', 'en-ZA', 'en-ZM', 'en-ZW', 'es-AR', 'es-BO', 'es-CL', 'es-CO', 'es-CR', 'es-DO', 'es-HN', 'es-PE', 'es-EC', 'es-ES', 'es-MX', 'es-PA', 'es-PY', 'es-UY', 'et-EE', 'fa-IR', 'fi-FI', 'fj-FJ', 'fo-FO', 'fr-BE', 'fr-FR', 'fr-GF', 'fr-GP', 'fr-MQ', 'fr-RE', 'ga-IE', 'he-IL', 'hu-HU', 'id-ID', 'it-IT', 'it-SM', 'ja-JP', 'ka-GE', 'kk-KZ', 'kl-GL', 'ko-KR', 'lt-LT', 'ms-MY', 'nb-NO', 'ne-NP', 'nl-BE', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'pt-AO', 'ro-RO', 'ru-RU', 'sl-SI', 'sk-SK', 'sq-AL', 'sr-RS', 'sv-SE', 'th-TH', 'tr-TR', 'uk-UA', 'uz-UZ', 'vi-VN', 'zh-CN', 'zh-HK', 'zh-MO', 'zh-TW'] OR defaults to 'any'. If 'any' or a falsey value is used, function will check if any of the locales match).

options is an optional object that can be supplied with the following keys: strictMode, if this is set to true, the mobile phone number must be supplied with the country code and therefore must start with +. Locale list is validator.isMobilePhoneLocales.
isMongoId(str) check if the string is a valid hex-encoded representation of a MongoDB ObjectId.
isMultibyte(str) check if the string contains one or more multibyte chars.
isNumeric(str [, options]) check if the string contains only numbers.

options is an object which defaults to {no_symbols: false} it also has locale as an option. If no_symbols is true, the validator will reject numeric strings that feature a symbol (e.g. +, -, or .).

locale determine the decimal separator and is one of ['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fr-FR', 'fr-CA', 'hu-HU', 'it-IT', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS', 'sr-RS@latin', 'sv-SE', 'tr-TR', 'uk-UA'].
isOctal(str) check if the string is a valid octal number.
isPassportNumber(str, countryCode) check if the string is a valid passport number.

(countryCode is one of [ 'AM', 'AR', 'AT', 'AU', 'BE', 'BG', 'BY', 'BR', 'CA', 'CH', 'CN', 'CY', 'CZ', 'DE', 'DK', 'DZ', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HR', 'HU', 'IE' 'IN', 'IS', 'IT', 'JP', 'KR', 'LT', 'LU', 'LV', 'LY', 'MT', 'MY', 'NL', 'PO', 'PT', 'RO', 'RU', 'SE', 'SL', 'SK', 'TR', 'UA', 'US' ].
isPort(str) check if the string is a valid port number.
isPostalCode(str, locale) check if the string is a postal code,

(locale is one of [ 'AD', 'AT', 'AU', 'AZ', 'BE', 'BG', 'BR', 'BY', 'CA', 'CH', 'CN', 'CZ', 'DE', 'DK', 'DO', 'DZ', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HR', 'HT', 'HU', 'ID', 'IE' 'IL', 'IN', 'IR', 'IS', 'IT', 'JP', 'KE', 'LI', 'LT', 'LU', 'LV', 'MT', 'MX', 'MY', 'NL', 'NO', 'NP', 'NZ', 'PL', 'PR', 'PT', 'RO', 'RU', 'SA', 'SE', 'SG', 'SI', 'TH', 'TN', 'TW', 'UA', 'US', 'ZA', 'ZM' ] OR 'any'. If 'any' is used, function will check if any of the locals match. Locale list is validator.isPostalCodeLocales.).
isRFC3339(str) check if the string is a valid RFC 3339 date.
isRgbColor(str [, includePercentValues]) check if the string is a rgb or rgba color.

includePercentValues defaults to true. If you don't want to allow to set rgb or rgba values with percents, like rgb(5%,5%,5%), or rgba(90%,90%,90%,.3), then set it to false.
isSemVer(str) check if the string is a Semantic Versioning Specification (SemVer).
isSurrogatePair(str) check if the string contains any surrogate pairs chars.
isUppercase(str) check if the string is uppercase.
isSlug Check if the string is of type slug. Options allow a single hyphen between string. e.g. [cn-cn, cn-c-c]
isStrongPassword(str [, options]) Check if a password is strong or not. Allows for custom requirements or scoring rules. If returnScore is true, then the function returns an integer score for the password rather than a boolean.
Default options:
{ minLength: 8, minLowercase: 1, minUppercase: 1, minNumbers: 1, minSymbols: 1, returnScore: false, pointsPerUnique: 1, pointsPerRepeat: 0.5, pointsForContainingLower: 10, pointsForContainingUpper: 10, pointsForContainingNumber: 10, pointsForContainingSymbol: 10 }
isTaxID(str, locale) Check if the given value is a valid Tax Identification Number. Default locale is en-US.

More info about exact TIN support can be found in src/lib/isTaxID.js

Supported locales: [ 'bg-BG', 'cs-CZ', 'de-AT', 'de-DE', 'dk-DK', 'el-CY', 'el-GR', 'en-GB', 'en-IE', 'en-US', 'es-ES', 'et-EE', 'fi-FI', 'fr-BE', 'fr-FR', 'fr-LU', 'hr-HR', 'hu-HU', 'it-IT', 'lb-LU', 'lt-LT', 'lv-LV' 'mt-MT', 'nl-BE', 'nl-NL', 'pl-PL', 'pt-BR', 'pt-PT', 'ro-RO', 'sk-SK', 'sl-SI', 'sv-SE' ]
isURL(str [, options]) check if the string is an URL.

options is an object which defaults to { protocols: ['http','https','ftp'], require_tld: true, require_protocol: false, require_host: true, require_valid_protocol: true, allow_underscores: false, host_whitelist: false, host_blacklist: false, allow_trailing_dot: false, allow_protocol_relative_urls: false, disallow_auth: false }.

require_protocol - if set as true isURL will return false if protocol is not present in the URL.
require_valid_protocol - isURL will check if the URL's protocol is present in the protocols option.
protocols - valid protocols can be modified with this option.
require_host - if set as false isURL will not check if host is present in the URL.
require_port - if set as true isURL will check if port is present in the URL.
allow_protocol_relative_urls - if set as true protocol relative URLs will be allowed.
validate_length - if set as false isURL will skip string length validation (2083 characters is IE max URL length).
isUUID(str [, version]) check if the string is a UUID (version 3, 4 or 5).
isVariableWidth(str) check if the string contains a mixture of full and half-width chars.
isVAT(str, countryCode) checks that the string is a valid VAT number if validation is available for the given country code matching ISO 3166-1 alpha-2.

Available country codes: [ 'GB', 'IT' ].
isWhitelisted(str, chars) checks characters if they appear in the whitelist.
matches(str, pattern [, modifiers]) check if string matches the pattern.

Either matches('foo', /foo/i) or matches('foo', 'foo', 'i').

Sanitizers

Here is a list of the sanitizers currently available.

Sanitizer Description
blacklist(input, chars) remove characters that appear in the blacklist. The characters are used in a RegExp and so you will need to escape some chars, e.g. blacklist(input, '\\[\\]').
escape(input) replace <, >, &, ', " and / with HTML entities.
ltrim(input [, chars]) trim characters from the left-side of the input.
normalizeEmail(email [, options]) canonicalizes an email address. (This doesn't validate that the input is an email, if you want to validate the email use isEmail beforehand)

options is an object with the following keys and default values:
  • all_lowercase: true - Transforms the local part (before the @ symbol) of all email addresses to lowercase. Please note that this may violate RFC 5321, which gives providers the possibility to treat the local part of email addresses in a case sensitive way (although in practice most - yet not all - providers don't). The domain part of the email address is always lowercased, as it's case insensitive per RFC 1035.
  • gmail_lowercase: true - GMail addresses are known to be case-insensitive, so this switch allows lowercasing them even when all_lowercase is set to false. Please note that when all_lowercase is true, GMail addresses are lowercased regardless of the value of this setting.
  • gmail_remove_dots: true: Removes dots from the local part of the email address, as GMail ignores them (e.g. "john.doe" and "johndoe" are considered equal).
  • gmail_remove_subaddress: true: Normalizes addresses by removing "sub-addresses", which is the part following a "+" sign (e.g. "[email protected]" becomes "[email protected]").
  • gmail_convert_googlemaildotcom: true: Converts addresses with domain @googlemail.com to @gmail.com, as they're equivalent.
  • outlookdotcom_lowercase: true - Outlook.com addresses (including Windows Live and Hotmail) are known to be case-insensitive, so this switch allows lowercasing them even when all_lowercase is set to false. Please note that when all_lowercase is true, Outlook.com addresses are lowercased regardless of the value of this setting.
  • outlookdotcom_remove_subaddress: true: Normalizes addresses by removing "sub-addresses", which is the part following a "+" sign (e.g. "[email protected]" becomes "[email protected]").
  • yahoo_lowercase: true - Yahoo Mail addresses are known to be case-insensitive, so this switch allows lowercasing them even when all_lowercase is set to false. Please note that when all_lowercase is true, Yahoo Mail addresses are lowercased regardless of the value of this setting.
  • yahoo_remove_subaddress: true: Normalizes addresses by removing "sub-addresses", which is the part following a "-" sign (e.g. "[email protected]" becomes "[email protected]").
  • icloud_lowercase: true - iCloud addresses (including MobileMe) are known to be case-insensitive, so this switch allows lowercasing them even when all_lowercase is set to false. Please note that when all_lowercase is true, iCloud addresses are lowercased regardless of the value of this setting.
  • icloud_remove_subaddress: true: Normalizes addresses by removing "sub-addresses", which is the part following a "+" sign (e.g. "[email protected]" becomes "[email protected]").
rtrim(input [, chars]) trim characters from the right-side of the input.
stripLow(input [, keep_new_lines]) remove characters with a numerical value < 32 and 127, mostly control characters. If keep_new_lines is true, newline characters are preserved (\n and \r, hex 0xA and 0xD). Unicode-safe in JavaScript.
toBoolean(input [, strict]) convert the input string to a boolean. Everything except for '0', 'false' and '' returns true. In strict mode only '1' and 'true' return true.
toDate(input) convert the input string to a date, or null if the input is not a date.
toFloat(input) convert the input string to a float, or NaN if the input is not a float.
toInt(input [, radix]) convert the input string to an integer, or NaN if the input is not an integer.
trim(input [, chars]) trim characters (whitespace by default) from both sides of the input.
unescape(input) replaces HTML encoded entities with <, >, &, ', " and /.
whitelist(input, chars) remove characters that do not appear in the whitelist. The characters are used in a RegExp and so you will need to escape some chars, e.g. whitelist(input, '\\[\\]').

XSS Sanitization

XSS sanitization was removed from the library in 2d5d6999.

For an alternative, have a look at Yahoo's xss-filters library or at DOMPurify.

Contributing

In general, we follow the "fork-and-pull" Git workflow.

  1. Fork the repo on GitHub
  2. Clone the project to your own machine
  3. Work on your fork
    1. Make your changes and additions
      • Most of your changes should be focused on src/ and test/ folders and/or README.md.
      • Files such as validator.js, validator.min.js and files in lib/ folder are autogenerated when running tests (npm test) and need not to be changed manually.
    2. Change or add tests if needed
    3. Run tests and make sure they pass
    4. Add changes to README.md if needed
  4. Commit changes to your own branch
  5. Make sure you merge the latest from "upstream" and resolve conflicts if there is any
  6. Repeat step 3(3) above
  7. Push your work back up to your fork
  8. Submit a Pull request so that we can review your changes

Tests

Tests are using mocha, to run the tests use:

$ npm test

Maintainers

Reading

Remember, validating can be troublesome sometimes. See A list of articles about programming assumptions commonly made that aren't true.

License (MIT)

Copyright (c) 2018 Chris O'Hara <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Comments
  • [Question] How can we better support TypeScript?

    [Question] How can we better support TypeScript?

    Trying to use @types/validator and getting errors. I asked the question on SO here. Curious if anyone else is having the same issue?

    https://stackoverflow.com/questions/60457757/typescript-imports-for-valiatorjs-failing

    help wanted πŸΏ discussion enhancement 
    opened by fireflysemantics 29
  • Migrate to ES6

    Migrate to ES6

    This is a large PR with some opinionated changes, so I'm not sure if it would be accepted, but I'd try anyway :)

    • Deprecate non-string coercion (major version upgrade): it is difficult to implement this functionality when each function is used separately.
    • Rewrite validation functions as ES6 modules, so we can now require each function separately without having to include the whole library, this will be helpful to anyone using validator on the client side, and will make it possible in the future to use tree shaking (i.e. removing unused code) when Node supports ES6 modules.

    ~~Functions are available on the root folder for convenience~~ Functions are available in the lib/ dir:

    // ES5
    var isEmail = require('validator/lib/isEmail');
    
    // ES6
    import isEmail from 'validator/lib/isEmail';
    
    // ES6 with tree shaking
    import { isEmail } from 'validator';
    

    Of course you can still include the entire library as usual:

    var validator = require('validator');
    validator.isEmail('[email protected]'); // => true
    

    Now to the opinionated changes:

    • Move to ESLint: it is extensible, has better support for ES6 and has awesome integration extensions for popular code editors.

    • Use npm scripts to build, clean and test the package as they are more compatible with non-*nix platforms and easier to use.

      npm run clean # removes all builds
      npm run clean:browser
      npm run clean:node
      npm run build
      npm run build:browser
      npm run build:node
      npm run lint # runs ESLint
      npm run test
      
    opened by forabi 24
  • fix(isAlpha): fix Ψ­ character validation in fa-IR language code (#1400)

    fix(isAlpha): fix Ψ­ character validation in fa-IR language code (#1400)

    I added some Persian alphabet characters retrieved from wikipedia on this line Also add new validation regarding the language in the validator.js

    This PR specifically fix #1400

    Checklist

    • [x] PR contains only changes related; no stray files, etc.
    • [x] README updated (where applicable)
    • [x] Tests written (where applicable)
    opened by fakhrip 23
  • Add currency validator

    Add currency validator

    As per suggestion, based the isCurrency validator on isMobilePhone, but used currency codes instead of locales because it seemed more reasonable, for example, to have a EUR validator that covers some slight variations instead of using all locales in the eurozone separately. Reliable information on formatting conventions seems difficult to find, so I based the RegEx's on ASP.NET/C# formatted strings with various CultureInfo instances. Added mocha tests as well.

    opened by regularmike 21
  • Denial of Service in isEmail validator

    Denial of Service in isEmail validator

    Not sure how reliable this is, but it doesn't appear that the author ever bothered to responsibly report the issue: http://lab.cs.ttu.ee/dl93 ( PDF Warning )

    You'll want to check 2.4.2.1 of it where the author provides an example of a claimed Denial of Service vector against this module - not sure if it's applicable after the change to fix issue #109 (commit a643b4ffbfce18dae00ea6d94854e82af80cc555) but I figured it should be addressed after seeing the paper pop up on reddit.

    opened by damianb 21
  • Failing email strings

    Failing email strings

    I used to have the following valid emails in my test suite, validator.isEmail() will reject them:

    var validEmails = [
      '"Abc\\@def"@example.com',
      '"Fred Bloggs"@example.com',
      '"Joe\\Blow"@example.com',
      '"Abc@def"@example.com',
    ];
    

    I know they look weird, but they are valid email addresses.

    opened by thanpolas 18
  • Replaced ISO8601 with new code

    Replaced ISO8601 with new code

    Signed-off-by: Sahil Suman [email protected]

    • Replaced the iso8601 method with new code
    • Added new test cases

    Fixes - #2003 #1883 #1046

    Checklist

    • [x] PR contains only changes related; no stray files, etc.
    • [x] README updated (where applicable)
    • [x] Tests written (where applicable)
    opened by sahilsuman933 15
  • feat(isTaxID): Add EU-UK TIN validation

    feat(isTaxID): Add EU-UK TIN validation

    • Add support for the following locales: [ 'bg-BG', 'cs-CZ', 'de-AT', 'de-DE', 'dk-DK', 'el-CY', 'el-GR', 'en-GB', 'en-IE', 'es-ES', 'et-EE', 'fi-FI', 'fr-BE', 'fr-FR', 'fr-LU', 'hr-HR', 'hu-HU', 'it-IT', 'lb-LU', 'lt-LT', 'lv-LV' 'mt-MT', 'nl-BE', 'nl-NL', 'pl-PL', 'pt-PT', 'ro-RO', 'sk-SK', 'sl-SI', 'sv-SE' ]
    • Add tests for locales
    • Add helper validation functions
    • Update isTaxID() readme description
    • Will close #1423

    Checklist

    • [x] PR contains only changes related; no stray files, etc.
    • [x] README updated (where applicable)
    • [x] Tests written (where applicable)
    needs-more-review 
    opened by tplessas 15
  • isDate()

    isDate()

    I noticed there is no validator such as isDate() . It was removed in previous version. It would be handy to have a validator that checks date only unlike the datestring. For example, 2018/08/09 , 1988-07-18

    πŸ™‹β€β™‚οΈfeature-request pr-raised 
    opened by rubiin 15
  • add a japanese kana validator

    add a japanese kana validator

    On the input form of Japan, validation was added because there are cases where may be asked to enter only hiragana or katakana in the input field such as name or address.

    🍿 discussion stale closed-as-stale 
    opened by jotof 15
  • Support prefix

    Support prefix

    https://en.wikipedia.org/wiki/IPv6_address#Transition_from_IPv4

    Some issues arose in Waterline, which uses anchor. which uses validator.js. ::ffff:127.0.0.1 is a prefixed IPv4. I found this on StackOverflow.

    opened by RWOverdijk 15
  • Added isAbaRouting validator

    Added isAbaRouting validator

    Added isAbaRouting validator

    Check whether a string is ABA routing number for US bank account & cheque

    https://en.wikipedia.org/wiki/ABA_routing_transit_number

    Please review my PR, thanks!

    Checklist

    • [x] PR contains only changes related; no stray files, etc.
    • [x] README updated (where applicable)
    • [x] Tests written (where applicable)
    opened by songyuew 4
  • Added support for zh-HK in isIdentityCard

    Added support for zh-HK in isIdentityCard

    Added support for zh-HK in isIdentityCard

    Supports validation for HKID (Hong Kong Identity Card)

    RegEx and checksum used, compatible with new HKIDs starting with 2 letters.

    Checklist

    • [x] PR contains only changes related; no stray files, etc.
    • [x] README updated (where applicable)
    • [x] Tests written (where applicable)
    opened by songyuew 1
  • Idea: Using RegExp Linter

    Idea: Using RegExp Linter

    Just noting down a quick idea for the future here:

    Since a lot of this project revolves around working with RegExps, it could make sense to enforce certain RegExps rules, to ensure you have consistent RegExps, e.g. just looking at the "isMobilePhone" validator, there are quite a few different "RegExp" styles used in there for expressing some ranges, as there is no real "rule" or guideline in place currently.

    One solution could be to incorporate this ESLint plugin, since ESLint is already used in this project: https://ota-meshi.github.io/eslint-plugin-regexp/

    I haven't played around with it yet, but at a first look, it does look pretty nice and extensive. Their rules are also nicely presented: https://ota-meshi.github.io/eslint-plugin-regexp/rules/

    Again, just an idea for the future here :-)

    πŸ› bug 
    opened by pano9000 0
  • isMobilePhone - fixed validation for am-AM

    isMobilePhone - fixed validation for am-AM

    Added support of some codes of Ucom mobile network - 55, 50, 66

    Wiki: Armenian mobile network codes

    Checklist

    • [x] PR contains only changes related; no stray files, etc.
    • [x] README updated (where applicable)
    • [x] Tests written (where applicable)
    opened by AlexKrupko 1
  • Add isMobilePhone validation for Iceland

    Add isMobilePhone validation for Iceland

    Based on https://en.wikipedia.org/wiki/Telephone_numbers_in_Iceland and https://www.fjarskiptastofa.is/english/telecom-affairs/numbering/ validation is added. Mobilephone prefixes are 6[0-9],7[0-9] and 8[1-9]. 80 prefix is reserved for free call services. Each mobilephone number has 7 digits.

    Checklist

    • [X] PR contains only changes related; no stray files, etc.
    • [X] README updated (where applicable)
    • [X] Tests written (where applicable)
    opened by abks90 3
  • feat(isMobilePhone): added Virgin Mobile provider to (ar-KW).

    feat(isMobilePhone): added Virgin Mobile provider to (ar-KW).

    Added Virgin Mobile provider range (41XXXXXX) to ar-KW.

    References:

    Checklist

    • [x] PR contains only changes related; no stray files, etc.
    • [x] README updated (where applicable)
    • [x] Tests written (where applicable)
    opened by Yazan-KE 1
Releases(13.7.0)
  • 13.7.0(Nov 1, 2021)

    13.7.0

    New Features

    • #1706 isISO4217, currency code validator @jpaya17

    Fixes and Enhancements

    • #1647 isFQDN: add allow_wildcard option @fasenderos
    • #1654 isRFC3339: Disallow prepended and appended strings to RFC 3339 date-time @jmacmahon
    • #1658 maintenance: increase code coverage @tux-tn
    • #1669 IBAN export list of country codes that implement IBAN @dror-heller @fedeci
    • #1676 isBoolean: add loose option @brybrophy
    • #1697 maintenance: fix npm installation error @rubiin
    • #1708 isISO31661Alpha3: perf @jpaya17
    • #1711 isDate: allow users to strictly validate dates with . as delimiter @flymans
    • #1715 isCreditCard: fix for Union Pay cards @shreyassai123
    • #1718 isEmail: replace all dots in GMail length validation @DasDingGehtNicht
    • #1721 isURL: add allow_fragments and allow_query_components @cowboy-bebug
    • #1724 isISO31661Alpha2: perf @jpaya17
    • #1730 isMagnetURI @tux-tn
    • #1738 trim: remove regex to prevent ReDOS attack @tux-tn
    • #1747 maintenance: run scripts in parallel for build and clean @sachinraja
    • #1748 isURL: higher priority to whitelist @deepanshu2506
    • #1751 isURL: allow url with colon and no port @MatteoPierro
    • #1777 isUUID: fix for null version argument @theteladras
    • #1799 isFQDN: check more special chars @MatteoPierro
    • #1833 isURL: allow URL with an empty user @MiguelSavignano
    • #1835 unescape: fixed bug where intermediate string contains escaped @Marcholio
    • #1836 contains: can check that string contains seed multiple times @Marcholio
    • #1844 docs: add CDN instructions @luiscobits
    • #1848 isUUID: add support for validation of v1 and v2 @theteladras
    • #1941 isEmail: add host_blacklist option @fedeci

    New and Improved Locales

    • isAlpha, isAlphanumeric:

    • isPassportNumber:

    • isPostalCode:

    • isIdentityCard:

      • #1657 TH @tithanayut
      • #1745 PL @wiktorwojcik112 @fedeci @tux-tn
      • #1786 LK @nimanthadilz @tux-tn
      • #1838 FI @Marcholio
    • isMobilePhone:

    • isLicensePlate:

      • #1565 cs-CZ @filiptronicek
      • #1790 fi-FI @Marcholio
    • isVAT:


    New Contributors πŸŽ‰

    • @jmacmahon made their first contribution in https://github.com/validatorjs/validator.js/pull/1654
    • @drorheller made their first contribution in https://github.com/validatorjs/validator.js/pull/1669
    • @laulujan made their first contribution in https://github.com/validatorjs/validator.js/pull/1695
    • @filiptronicek made their first contribution in https://github.com/validatorjs/validator.js/pull/1565
    • @AnnaMariaJansen made their first contribution in https://github.com/validatorjs/validator.js/pull/1679
    • @luisrivas made their first contribution in https://github.com/validatorjs/validator.js/pull/1689
    • @tithanayut made their first contribution in https://github.com/validatorjs/validator.js/pull/1657
    • @jpaya17 made their first contribution in https://github.com/validatorjs/validator.js/pull/1724
    • @flymans made their first contribution in https://github.com/validatorjs/validator.js/pull/1711
    • @anirudhgiri made their first contribution in https://github.com/validatorjs/validator.js/pull/1714
    • @shreyassai123 made their first contribution in https://github.com/validatorjs/validator.js/pull/1715
    • @MiKr13 made their first contribution in https://github.com/validatorjs/validator.js/pull/1716
    • @DasDingGehtNicht made their first contribution in https://github.com/validatorjs/validator.js/pull/1718
    • @cowboy-bebug made their first contribution in https://github.com/validatorjs/validator.js/pull/1721
    • @sachinraja made their first contribution in https://github.com/validatorjs/validator.js/pull/1747
    • @wiktorwojcik112 made their first contribution in https://github.com/validatorjs/validator.js/pull/1745
    • @divikshrivastava made their first contribution in https://github.com/validatorjs/validator.js/pull/1746
    • @deepanshu2506 made their first contribution in https://github.com/validatorjs/validator.js/pull/1748
    • @fasenderos made their first contribution in https://github.com/validatorjs/validator.js/pull/1647
    • @yisibl made their first contribution in https://github.com/validatorjs/validator.js/pull/1682
    • @MatteoPierro made their first contribution in https://github.com/validatorjs/validator.js/pull/1751
    • @pasagedev made their first contribution in https://github.com/validatorjs/validator.js/pull/1765
    • @theteladras made their first contribution in https://github.com/validatorjs/validator.js/pull/1777
    • @hammad20120 made their first contribution in https://github.com/validatorjs/validator.js/pull/1778
    • @nimanthadilz made their first contribution in https://github.com/validatorjs/validator.js/pull/1786
    • @Marcholio made their first contribution in https://github.com/validatorjs/validator.js/pull/1790
    • @Ronqn made their first contribution in https://github.com/validatorjs/validator.js/pull/1809
    • @danielTiringer made their first contribution in https://github.com/validatorjs/validator.js/pull/1826
    • @HackProAIT made their first contribution in https://github.com/validatorjs/validator.js/pull/1769
    • @MiguelSavignano made their first contribution in https://github.com/validatorjs/validator.js/pull/1833
    • @luiscobits made their first contribution in https://github.com/validatorjs/validator.js/pull/1844
    • @Theta-Dev made their first contribution in https://github.com/validatorjs/validator.js/pull/1810
    • @zeno4ever made their first contribution in https://github.com/validatorjs/validator.js/pull/1825
    • @beckettnormington made their first contribution in https://github.com/validatorjs/validator.js/pull/1772
    • @mgnss made their first contribution in https://github.com/validatorjs/validator.js/pull/1846
    • @lakshayr003 made their first contribution in https://github.com/validatorjs/validator.js/pull/1770

    Full Changelog: https://github.com/validatorjs/validator.js/compare/13.6.1...13.7.0

    Source code(tar.gz)
    Source code(zip)
  • 13.6.1(Apr 18, 2021)

    13.6.0 - 21/04 Release

    ℹ️ See the whole diff in PR #1650

    • New features:

      • #1495 isLicensePlate @firlus
    • Fixes and Enhancements:

      • #1651 fix ReDOS vulnerabilities in isHSL and isEmail @tux-tn
      • #1644 isURL: Allow URLs to have only a username in the userinfo subcomponent @jbuchmann-coosto
      • #1633 isISIN: optimization @bmacnaughton
      • #1632 isIP: improved pattern for IPv4 and IPv6 @ognjenjevremovic
      • #1625 fix [A-z] regex range on some validators @bmacnaughton
      • #1620 fix docs @prahaladbelavadi
      • #1616 isMacAddress: improve regexes and options @fedeci
      • #1603 fix ReDOS vulnerabilities in isSlug and rtrim @fedeci
      • #1594 isIPRange: add support for IPv6 @neilime
      • #1577 isEAN: add support for EAN-14 @varsubham @tux-tn
      • #1566 isStrongPassword: add @ as a valid symbol @stingalleman
      • #1548 isBtcAddress: add base58 @ezkemboi
      • #1546 isFQDN: numeric domain names @tux-tn
    • New and Improved locales:

      • isIdentityCard, isPassportNumber:
        • #1595 IR @mhf-ir @fedeci
        • #1583 ar-LY @asghaier76 @tux-tn
        • #1574 MY @stranger26 @tux-tn
      • isMobilePhone:
      • isPostalCode:
      • isTaxID:
      • isVAT:
    Source code(tar.gz)
    Source code(zip)
  • 13.5.1(Nov 30, 2020)

    20/11 Release

    NOTE: 13.5.0 had a build issue and was recalled, see #1538 #1537

    • New features:

      • isVAT #1463 @CodingNagger
      • isTaxID #1446 @tplessas
      • isBase58 #1445 @ezkemboi
      • isStrongPassword #1348 @door-bell
    • Fixes and Enhancements:

      • #1486 isISO8601: add strictSeparator @brostone51
      • #1474 isFQDN: make more strict @CristhianMotoche
      • #1469 isFQDN: allow_underscore option @gibson042
      • #1449 isEmail: character blacklisting @rubiin
      • #1436 isURL: added require_port option @yshanli
      • #1435 isEmail: respect ignore_max_length option @evantahler
      • #1402 isDate: add strictMode and prevent mixed delimiters @tux-tn
      • #1286 isAlpha: support ignore option @mum-never-proud
    • New and Improved locales:

      • isAlpha, isAlphanumeric:
      • isMobilePhone:
        • #1521 ar-MA @artpumpkin
        • #1492 de-LU,it-SM, sq-AL and ga-IE @firlus
        • #1487 en-HN @jehielmartinez
        • #1473 ar-LB, es-PE, ka-GE @rubiin
        • #1470 es-DO @devrasec
        • #1460 es-BO @rubiin
        • #1444 es-AR @csrgt
        • #1407 pt-BR @viniciushvsilva
      • isPostalCode:
      • isPassportNumber:

    __ this release is dedicated to @dbnandaa πŸ§’

    Source code(tar.gz)
    Source code(zip)
  • v13.1.17(Sep 18, 2020)

    20/09 Release

    • New features:

      • None
    • Fixes and chores:

      • #1425 fix validation for userinfo part for isURL @heanzyzabala
      • #1419 fix isBase32 and isBase64 to validate empty strings properly @AberDerBart
      • #1408 tests for isTaxId @dspinellis
      • #1397 added validate_length option for isURL @tomgrossman
      • #1383 #1428 doc typos @0xflotus @timgates42
      • #1376 add missing tests and switch to Coverall @tux-tn
      • #1373 improve code coverage @ezkemboi
      • #1357 add Node v6 on build pipeline @profnandaa
    • New and Improved locales:

      • isMobilePhone:
        • #1439 az-AZ @saidfagan
        • #1420 uz-Uz @icyice0217
        • #1391 de-DE @heanzyzabala
        • #1388 en-PH @stinkymonkeyph
        • #1370 es-ES @rubiin
        • #1356 bs-BA @MladenZeljic
        • #1303 zh-CN @heathcliff-hu
      • isPostalCode:
      • isAlpha, isAlphanumeric:
        • #1411 fa-AF, fa-IR @stinkymonkeyph
        • #1371 vi-VN @rubiin
      • isBAN:
        • #1394 EG, SV @heanzyzabala
      • isIdentityCard:
    Source code(tar.gz)
    Source code(zip)
  • 13.1.0(Jun 10, 2020)

  • 12.2.0(Jan 25, 2020)

  • 10.11.0(Jan 15, 2019)

  • 10.10.0(Jan 15, 2019)

Owner
null
FieldVal - multipurpose validation library. Supports both sync and async validation.

FieldVal-JS The FieldVal-JS library allows you to easily validate data and provide readable and structured error reports. Documentation and Examples D

null 137 Sep 24, 2022
πŸŽ‰πŸŽ‰πŸŽ‰like vcsode, string/texts can be replaced in file(s).

tiny-replace-files Like vscode, simple utility to quickly replace text in one or more files. ?? Getting Started install # npm npm install --save tiny

ε…”ε­ε…ˆη”Ÿ 16 Nov 22, 2022
A library for validate a string using regular expressions.

Fogex Form Regex Quickly and easily check if the content is valid. Installation npm install fogex or yarn add fogex Usage import fogex from 'fogex';

null 5 May 5, 2022
jQuery Validation Plugin library sources

jQuery Validation Plugin - Form validation made easy The jQuery Validation Plugin provides drop-in validation for your existing forms, while making al

null 10.3k Jan 3, 2023
Lightweight JavaScript form validation library inspired by CodeIgniter.

validate.js validate.js is a lightweight JavaScript form validation library inspired by CodeIgniter. Features Validate form fields from over a dozen r

Rick Harrison 2.6k Dec 15, 2022
Cross Browser HTML5 Form Validation.

Validatr Cross Browser HTML5 Form Validation. Getting Started View the documentation to learn how to use Validatr. Changelog Version 0.5.1 - 2013-03-1

Jay Morrow 279 Nov 1, 2022
jQuery Validation Plugin library sources

jQuery Validation Plugin - Form validation made easy The jQuery Validation Plugin provides drop-in validation for your existing forms, while making al

null 10.3k Jan 3, 2023
jQuery form validation plugin

jQuery.validationEngine v3.1.0 Looking for official contributors This project has now been going on for more than 7 years, right now I only maintain t

Cedric Dugas 2.6k Dec 23, 2022
The most powerful data validation library for JS

joi The most powerful schema description language and data validator for JavaScript. Installation npm install joi Visit the joi.dev Developer Portal f

Sideway Inc. 19.6k Jan 4, 2023
Dead simple Object schema validation

Yup Yup is a JavaScript schema builder for value parsing and validation. Define a schema, transform a value to match, validate the shape of an existin

Jason Quense 19.2k Jan 2, 2023
Schema-Inspector is an JSON API sanitisation and validation module.

Schema-Inspector is a powerful tool to sanitize and validate JS objects. It's designed to work both client-side and server-side and to be scalable wit

null 494 Oct 3, 2022
:white_check_mark: Easy property validation for JavaScript, Node and Express.

property-validator βœ… Easy property validation for JavaScript, Node and Express Built on top of validator.js, property-validator makes validating reque

Netto Farah 160 Dec 14, 2022
Lightweight and powerfull library for declarative form validation

Formurai is a lightweight and powerfull library for declarative form validation Features Setup Usage Options Methods Rules Examples Roadmap Features ?

Illia 49 May 13, 2022
A simple credit cards validation library in JavaScript

creditcard.js A simple credit cards validation library in JavaScript. Project website: https://contaazul.github.io/creditcard.js Install creditcard.js

ContaAzul 323 Jan 7, 2023
v8n β˜‘οΈ ultimate JavaScript validation library

The ultimate JavaScript validation library you've ever needed. Dead simple fluent API. Customizable. Reusable. Installation - Documentation - API Intr

Bruno C. Couto 4.1k Dec 30, 2022
A lightweight NodeJS library for strict mime-type validation on streams

A lightweight NodeJS library for strict mime-type validation on streams. It gets a ReadableStream and decets the mime-type using its Magic number and validates it using the provided allowed and forbidden lists; If it's allowed it will pass it to the created WritableStreams and if it's not it will throw an error.

CEO of Death Star 9 Apr 3, 2022
Facile is an HTML form validator that is inspired by Laravel's validation style and is designed for simplicity of use.

Facile is an HTML form validator that is inspired by Laravel's validation style and is designed for simplicity of use.

upjs 314 Dec 26, 2022
πŸ“« Offline email validation - JS or TS

email-seems-valid An offline check to see if an email seems valid. Contains TS or JS packages for browser or Node.js emailSeemsValid('[email protected]')

earnifi 12 Dec 25, 2022