Socket
Socket
Sign inDemoInstall

validator

Package Overview
Dependencies
0
Maintainers
2
Versions
210
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 13.7.0 to 13.9.0

es/lib/isISO6391.js

8

es/index.js

@@ -15,2 +15,3 @@ import toDate from './lib/toDate';

import isDate from './lib/isDate';
import isTime from './lib/isTime';
import isBoolean from './lib/isBoolean';

@@ -57,2 +58,3 @@ import isLocale from './lib/isLocale';

import isIn from './lib/isIn';
import isLuhnNumber from './lib/isLuhnNumber';
import isCreditCard from './lib/isCreditCard';

@@ -69,2 +71,3 @@ import isIdentityCard from './lib/isIdentityCard';

import isBtcAddress from './lib/isBtcAddress';
import isISO6391 from './lib/isISO6391';
import isISO8601 from './lib/isISO8601';

@@ -97,3 +100,3 @@ import isRFC3339 from './lib/isRFC3339';

import isVAT from './lib/isVAT';
var version = '13.7.0';
var version = '13.9.0';
var validator = {

@@ -158,2 +161,3 @@ version: version,

isIn: isIn,
isLuhnNumber: isLuhnNumber,
isCreditCard: isCreditCard,

@@ -172,2 +176,3 @@ isIdentityCard: isIdentityCard,

isBtcAddress: isBtcAddress,
isISO6391: isISO6391,
isISO8601: isISO8601,

@@ -200,2 +205,3 @@ isRFC3339: isRFC3339,

isDate: isDate,
isTime: isTime,
isLicensePlate: isLicensePlate,

@@ -202,0 +208,0 @@ isVAT: isVAT,

31

es/lib/alpha.js

@@ -14,2 +14,3 @@ export var alpha = {

'it-IT': /^[A-ZÀÉÈÌÎÓÒÙ]+$/i,
'ja-JP': /^[ぁ-んァ-ヶヲ-゚一-龠ー・。、]+$/i,
'nb-NO': /^[A-ZÆØÅ]+$/i,

@@ -31,2 +32,3 @@ 'nl-NL': /^[A-ZÁÉËÏÓÖÜÚ]+$/i,

'vi-VN': /^[A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,
'ko-KR': /^[ㄱ-ㅎㅏ-ㅣ가-힣]*$/,
'ku-IQ': /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,

@@ -36,3 +38,5 @@ ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,

fa: /^['آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی']+$/i,
'hi-IN': /^[\u0900-\u0961]+[\u0972-\u097F]*$/i
bn: /^['ঀঁংঃঅআইঈউঊঋঌএঐওঔকখগঘঙচছজঝঞটঠডঢণতথদধনপফবভমযরলশষসহ়ঽািীুূৃৄেৈোৌ্ৎৗড়ঢ়য়ৠৡৢৣৰৱ৲৳৴৵৶৷৸৹৺৻']+$/,
'hi-IN': /^[\u0900-\u0961]+[\u0972-\u097F]*$/i,
'si-LK': /^[\u0D80-\u0DFF]+$/
};

@@ -51,2 +55,3 @@ export var alphanumeric = {

'it-IT': /^[0-9A-ZÀÉÈÌÎÓÒÙ]+$/i,
'ja-JP': /^[0-90-9ぁ-んァ-ヶヲ-゚一-龠ー・。、]+$/i,
'hu-HU': /^[0-9A-ZÁÉÍÓÖŐÚÜŰ]+$/i,

@@ -67,2 +72,3 @@ 'nb-NO': /^[0-9A-ZÆØÅ]+$/i,

'uk-UA': /^[0-9А-ЩЬЮЯЄIЇҐі]+$/i,
'ko-KR': /^[0-9ㄱ-ㅎㅏ-ㅣ가-힣]*$/,
'ku-IQ': /^[٠١٢٣٤٥٦٧٨٩0-9ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,

@@ -73,3 +79,5 @@ 'vi-VN': /^[0-9A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,

fa: /^['0-9آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی۱۲۳۴۵۶۷۸۹۰']+$/i,
'hi-IN': /^[\u0900-\u0963]+[\u0966-\u097F]*$/i
bn: /^['ঀঁংঃঅআইঈউঊঋঌএঐওঔকখগঘঙচছজঝঞটঠডঢণতথদধনপফবভমযরলশষসহ়ঽািীুূৃৄেৈোৌ্ৎৗড়ঢ়য়ৠৡৢৣ০১২৩৪৫৬৭৮৯ৰৱ৲৳৴৵৶৷৸৹৺৻']+$/,
'hi-IN': /^[\u0900-\u0963]+[\u0966-\u097F]*$/i,
'si-LK': /^[0-9\u0D80-\u0DFF]+$/
};

@@ -105,2 +113,11 @@ export var decimal = {

decimal[_locale2] = decimal.ar;
}
export var bengaliLocales = ['BD', 'IN'];
for (var _locale3, _i3 = 0; _i3 < bengaliLocales.length; _i3++) {
_locale3 = "bn-".concat(bengaliLocales[_i3]);
alpha[_locale3] = alpha.bn;
alphanumeric[_locale3] = alphanumeric.bn;
decimal[_locale3] = decimal['en-US'];
} // Source: https://en.wikipedia.org/wiki/Decimal_mark

@@ -110,10 +127,10 @@

export var dotDecimal = ['ar-EG', 'ar-LB', 'ar-LY'];
export var commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-ZM', 'es-ES', 'fr-CA', 'fr-FR', 'id-ID', 'it-IT', 'ku-IQ', 'hi-IN', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA', 'vi-VN'];
export var commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-ZM', 'es-ES', 'fr-CA', 'fr-FR', 'id-ID', 'it-IT', 'ku-IQ', 'hi-IN', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'si-LK', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA', 'vi-VN'];
for (var _i3 = 0; _i3 < dotDecimal.length; _i3++) {
decimal[dotDecimal[_i3]] = decimal['en-US'];
for (var _i4 = 0; _i4 < dotDecimal.length; _i4++) {
decimal[dotDecimal[_i4]] = decimal['en-US'];
}
for (var _i4 = 0; _i4 < commaDecimal.length; _i4++) {
decimal[commaDecimal[_i4]] = ',';
for (var _i5 = 0; _i5 < commaDecimal.length; _i5++) {
decimal[commaDecimal[_i5]] = ',';
}

@@ -120,0 +137,0 @@

@@ -1,9 +0,9 @@

import assertString from './util/assertString';
import toDate from './toDate';
export default function isAfter(str) {
var date = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : String(new Date());
assertString(str);
var comparison = toDate(date);
var original = toDate(str);
export default function isAfter(date, options) {
// For backwards compatibility:
// isAfter(str [, date]), i.e. `options` could be used as argument for the legacy `date`
var comparisonDate = (options === null || options === void 0 ? void 0 : options.comparisonDate) || options || Date().toString();
var comparison = toDate(comparisonDate);
var original = toDate(date);
return !!(original && comparison && original > comparison);
}
import assertString from './util/assertString';
import merge from './util/merge';
var base32 = /^[A-Z2-7]+=*$/;
export default function isBase32(str) {
var crockfordBase32 = /^[A-HJKMNP-TV-Z0-9]+$/;
var defaultBase32Options = {
crockford: false
};
export default function isBase32(str, options) {
assertString(str);
options = merge(options, defaultBase32Options);
if (options.crockford) {
return crockfordBase32.test(str);
}
var len = str.length;

@@ -6,0 +17,0 @@

@@ -9,3 +9,5 @@ import assertString from './util/assertString';

if (!CountryCodes.has(str.slice(4, 6).toUpperCase())) {
var countryCode = str.slice(4, 6).toUpperCase();
if (!CountryCodes.has(countryCode) && countryCode !== 'XK') {
return false;

@@ -12,0 +14,0 @@ }

@@ -1,13 +0,7 @@

import assertString from './util/assertString'; // supports Bech32 addresses
import assertString from './util/assertString';
var bech32 = /^(bc1)[a-z0-9]{25,39}$/;
var base58 = /^(1|3)[A-HJ-NP-Za-km-z1-9]{25,39}$/;
export default function isBtcAddress(str) {
assertString(str); // check for bech32
if (str.startsWith('bc1')) {
return bech32.test(str);
}
return base58.test(str);
assertString(str);
return bech32.test(str) || base58.test(str);
}
import assertString from './util/assertString';
import isLuhnValid from './isLuhnNumber';
var cards = {
amex: /^3[47][0-9]{13}$/,
dinersclub: /^3(?:0[0-5]|[68][0-9])[0-9]{11}$/,
discover: /^6(?:011|5[0-9][0-9])[0-9]{12,15}$/,
jcb: /^(?:2131|1800|35\d{3})\d{11}$/,
mastercard: /^5[1-5][0-9]{2}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$/,
// /^[25][1-7][0-9]{14}$/;
unionpay: /^(6[27][0-9]{14}|^(81[0-9]{14,17}))$/,
visa: /^(?:4[0-9]{12})(?:[0-9]{3,6})?$/
};
/* eslint-disable max-len */
var creditCard = /^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14}|^(81[0-9]{14,17}))$/;
var allCards = /^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14}|^(81[0-9]{14,17}))$/;
/* eslint-enable max-len */
export default function isCreditCard(str) {
assertString(str);
var sanitized = str.replace(/[- ]+/g, '');
export default function isCreditCard(card) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
assertString(card);
var provider = options.provider;
var sanitized = card.replace(/[- ]+/g, '');
if (!creditCard.test(sanitized)) {
if (provider && provider.toLowerCase() in cards) {
// specific provider in the list
if (!cards[provider.toLowerCase()].test(sanitized)) {
return false;
}
} else if (provider && !(provider.toLowerCase() in cards)) {
/* specific provider not in the list */
throw new Error("".concat(provider, " is not a valid credit card provider."));
} else if (!allCards.test(sanitized)) {
// no specific provider
return false;
}
var sum = 0;
var digit;
var tmpNum;
var shouldDouble;
for (var i = sanitized.length - 1; i >= 0; i--) {
digit = sanitized.substring(i, i + 1);
tmpNum = parseInt(digit, 10);
if (shouldDouble) {
tmpNum *= 2;
if (tmpNum >= 10) {
sum += tmpNum % 10 + 1;
} else {
sum += tmpNum;
}
} else {
sum += tmpNum;
}
shouldDouble = !shouldDouble;
}
return !!(sum % 10 === 0 ? sanitized : false);
return isLuhnValid(card);
}
import assertString from './util/assertString';
var validMediaType = /^[a-z]+\/[a-z0-9\-\+]+$/i;
var validMediaType = /^[a-z]+\/[a-z0-9\-\+\._]+$/i;
var validAttribute = /^[a-z\-]+=[a-z0-9\-]+$/i;

@@ -16,7 +16,7 @@ var validData = /^[a-z0-9!\$&'\(\)\*\+,;=\-\._~:@\/\?%\s]*$/i;

if (schemeAndMediaType.substr(0, 5) !== 'data:') {
if (schemeAndMediaType.slice(0, 5) !== 'data:') {
return false;
}
var mediaType = schemeAndMediaType.substr(5);
var mediaType = schemeAndMediaType.slice(5);

@@ -23,0 +23,0 @@ if (mediaType !== '' && !validMediaType.test(mediaType)) {

@@ -13,3 +13,4 @@ import assertString from './util/assertString';

ignore_max_length: false,
host_blacklist: []
host_blacklist: [],
host_whitelist: []
};

@@ -81,3 +82,3 @@ /* eslint-disable max-len */

if (display_name.endsWith(' ')) {
display_name = display_name.substr(0, display_name.length - 1);
display_name = display_name.slice(0, -1);
}

@@ -105,2 +106,6 @@

if (options.host_whitelist.length > 0 && !options.host_whitelist.includes(lower_domain)) {
return false;
}
var user = parts.join('@');

@@ -145,3 +150,4 @@

if (!isFQDN(domain, {
require_tld: options.require_tld
require_tld: options.require_tld,
ignore_max_length: options.ignore_max_length
})) {

@@ -157,3 +163,3 @@ if (!options.allow_ip_domain) {

var noBracketdomain = domain.substr(1, domain.length - 2);
var noBracketdomain = domain.slice(1, -1);

@@ -160,0 +166,0 @@ if (noBracketdomain.length === 0 || !isIP(noBracketdomain)) {

@@ -9,3 +9,3 @@ import assertString from './util/assertString';

if (str === '' || str === '.' || str === '-' || str === '+') {
if (str === '' || str === '.' || str === ',' || str === '-' || str === '+') {
return false;

@@ -12,0 +12,0 @@ }

@@ -8,3 +8,4 @@ import assertString from './util/assertString';

allow_numeric_tld: false,
allow_wildcard: false
allow_wildcard: false,
ignore_max_length: false
};

@@ -35,3 +36,3 @@ export default function isFQDN(str, options) {

if (!/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {
if (!options.allow_numeric_tld && !/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {
return false;

@@ -52,3 +53,3 @@ } // disallow spaces

return parts.every(function (part) {
if (part.length > 63) {
if (part.length > 63 && !options.ignore_max_length) {
return false;

@@ -55,0 +56,0 @@ }

@@ -99,9 +99,9 @@ import assertString from './util/assertString';

if (!str.match(/^\d{10}$/)) return false;
str = "0000".concat(str).substr(str.length - 6);
if (parseInt(str.substr(3, 6), 10) === 0) return false;
var lastNumber = parseInt(str.substr(9, 1), 10);
str = "0000".concat(str).slice(str.length - 6);
if (parseInt(str.slice(3, 9), 10) === 0) return false;
var lastNumber = parseInt(str.slice(9, 10), 10);
var sum = 0;
for (var i = 0; i < 9; i++) {
sum += parseInt(str.substr(i, 1), 10) * (10 - i);
sum += parseInt(str.slice(i, i + 1), 10) * (10 - i);
}

@@ -303,2 +303,28 @@

},
'zh-HK': function zhHK(str) {
// sanitize user input
str = str.trim(); // HKID number starts with 1 or 2 letters, followed by 6 digits,
// then a checksum contained in square / round brackets or nothing
var regexHKID = /^[A-Z]{1,2}[0-9]{6}((\([0-9A]\))|(\[[0-9A]\])|([0-9A]))$/;
var regexIsDigit = /^[0-9]$/; // convert the user input to all uppercase and apply regex
str = str.toUpperCase();
if (!regexHKID.test(str)) return false;
str = str.replace(/\[|\]|\(|\)/g, '');
if (str.length === 8) str = "3".concat(str);
var checkSumVal = 0;
for (var i = 0; i <= 7; i++) {
var convertedChar = void 0;
if (!regexIsDigit.test(str[i])) convertedChar = (str[i].charCodeAt(0) - 55) % 11;else convertedChar = str[i];
checkSumVal += convertedChar * (9 - i);
}
checkSumVal %= 11;
var checkSumConverted;
if (checkSumVal === 0) checkSumConverted = '0';else if (checkSumVal === 1) checkSumConverted = 'A';else checkSumConverted = String(11 - checkSumVal);
if (checkSumConverted === str[str.length - 1]) return true;
return false;
},
'zh-TW': function zhTW(str) {

@@ -305,0 +331,0 @@ var ALPHABET_CODES = {

@@ -47,14 +47,7 @@ import assertString from './util/assertString';

if (version === '4') {
if (!IPv4AddressRegExp.test(str)) {
return false;
}
var parts = str.split('.').sort(function (a, b) {
return a - b;
});
return parts[3] <= 255;
return IPv4AddressRegExp.test(str);
}
if (version === '6') {
return !!IPv6AddressRegExp.test(str);
return IPv6AddressRegExp.test(str);
}

@@ -61,0 +54,0 @@

import assertString from './util/assertString';
var isbn10Maybe = /^(?:[0-9]{9}X|[0-9]{10})$/;
var isbn13Maybe = /^(?:[0-9]{13})$/;
var possibleIsbn10 = /^(?:[0-9]{9}X|[0-9]{10})$/;
var possibleIsbn13 = /^(?:[0-9]{13})$/;
var factor = [1, 3];
export default function isISBN(str) {
var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
assertString(str);
version = String(version);
export default function isISBN(isbn, options) {
assertString(isbn); // For backwards compatibility:
// isISBN(str [, version]), i.e. `options` could be used as argument for the legacy `version`
if (!version) {
return isISBN(str, 10) || isISBN(str, 13);
var version = String((options === null || options === void 0 ? void 0 : options.version) || options);
if (!(options !== null && options !== void 0 && options.version || options)) {
return isISBN(isbn, {
version: 10
}) || isISBN(isbn, {
version: 13
});
}
var sanitized = str.replace(/[\s-]+/g, '');
var sanitizedIsbn = isbn.replace(/[\s-]+/g, '');
var checksum = 0;
var i;
if (version === '10') {
if (!isbn10Maybe.test(sanitized)) {
if (!possibleIsbn10.test(sanitizedIsbn)) {
return false;
}
for (i = 0; i < 9; i++) {
checksum += (i + 1) * sanitized.charAt(i);
for (var i = 0; i < version - 1; i++) {
checksum += (i + 1) * sanitizedIsbn.charAt(i);
}
if (sanitized.charAt(9) === 'X') {
if (sanitizedIsbn.charAt(9) === 'X') {
checksum += 10 * 10;
} else {
checksum += 10 * sanitized.charAt(9);
checksum += 10 * sanitizedIsbn.charAt(9);
}
if (checksum % 11 === 0) {
return !!sanitized;
return true;
}
} else if (version === '13') {
if (!isbn13Maybe.test(sanitized)) {
if (!possibleIsbn13.test(sanitizedIsbn)) {
return false;
}
for (i = 0; i < 12; i++) {
checksum += factor[i % 2] * sanitized.charAt(i);
for (var _i = 0; _i < 12; _i++) {
checksum += factor[_i % 2] * sanitizedIsbn.charAt(_i);
}
if (sanitized.charAt(12) - (10 - checksum % 10) % 10 === 0) {
return !!sanitized;
if (sanitizedIsbn.charAt(12) - (10 - checksum % 10) % 10 === 0) {
return true;
}

@@ -48,0 +52,0 @@ }

@@ -20,5 +20,6 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

var presentationSequences = str.match(/(\uFE0F|\uFE0E)/g) || [];
var surrogatePairs = str.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g) || [];
var len = str.length - surrogatePairs.length;
var len = str.length - presentationSequences.length - surrogatePairs.length;
return len >= min && (typeof max === 'undefined' || len <= max);
}
import assertString from './util/assertString';
var validators = {
'cs-CZ': function csCZ(str) {
return /^(([ABCDEFHKIJKLMNPRSTUVXYZ]|[0-9])-?){5,8}$/.test(str);
return /^(([ABCDEFHIJKLMNPRSTUVXYZ]|[0-9])-?){5,8}$/.test(str);
},
'de-DE': function deDE(str) {
return /^((AW|UL|AK|GA|AÖ|LF|AZ|AM|AS|ZE|AN|AB|A|KG|KH|BA|EW|BZ|HY|KM|BT|HP|B|BC|BI|BO|FN|TT|ÜB|BN|AH|BS|FR|HB|ZZ|BB|BK|BÖ|OC|OK|CW|CE|C|CO|LH|CB|KW|LC|LN|DA|DI|DE|DH|SY|NÖ|DO|DD|DU|DN|D|EI|EA|EE|FI|EM|EL|EN|PF|ED|EF|ER|AU|ZP|E|ES|NT|EU|FL|FO|FT|FF|F|FS|FD|FÜ|GE|G|GI|GF|GS|ZR|GG|GP|GR|NY|ZI|GÖ|GZ|GT|HA|HH|HM|HU|WL|HZ|WR|RN|HK|HD|HN|HS|GK|HE|HF|RZ|HI|HG|HO|HX|IK|IL|IN|J|JL|KL|KA|KS|KF|KE|KI|KT|KO|KN|KR|KC|KU|K|LD|LL|LA|L|OP|LM|LI|LB|LU|LÖ|HL|LG|MD|GN|MZ|MA|ML|MR|MY|AT|DM|MC|NZ|RM|RG|MM|ME|MB|MI|FG|DL|HC|MW|RL|MK|MG|MÜ|WS|MH|M|MS|NU|NB|ND|NM|NK|NW|NR|NI|NF|DZ|EB|OZ|TG|TO|N|OA|GM|OB|CA|EH|FW|OF|OL|OE|OG|BH|LR|OS|AA|GD|OH|KY|NP|WK|PB|PA|PE|PI|PS|P|PM|PR|RA|RV|RE|R|H|SB|WN|RS|RD|RT|BM|NE|GV|RP|SU|GL|RO|GÜ|RH|EG|RW|PN|SK|MQ|RU|SZ|RI|SL|SM|SC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Z|SMÜ|SOB|SOG|SOK|SÖM|SON|SPB|SPN|SRB|SRO|STA|STB|STD|STE|STL|SUL|SÜW|SWA|SZB|TBB|TDO|TET|TIR|TÖL|TUT|UEM|UER|UFF|USI|VAI|VEC|VER|VIB|VIE|VIT|VOH|WAF|WAK|WAN|WAR|WAT|WBS|WDA|WEL|WEN|WER|WES|WHV|WIL|WIS|WIT|WIZ|WLG|WMS|WND|WOB|WOH|WOL|WOR|WOS|WRN|WSF|WST|WSW|WTL|WTM|WUG|WÜM|WUN|WUR|WZL|ZEL|ZIG)[- ]?(([A-Z][- ]?\d{1,4})|([A-Z]{2}[- ]?\d{1,3})))[- ]?(E|H)?$/.test(str);
},

@@ -12,5 +12,17 @@ 'de-LI': function deLI(str) {

},
'en-IN': function enIN(str) {
return /^[A-Z]{2}[ -]?[0-9]{1,2}(?:[ -]?[A-Z])(?:[ -]?[A-Z]*)?[ -]?[0-9]{4}$/.test(str);
},
'es-AR': function esAR(str) {
return /^(([A-Z]{2} ?[0-9]{3} ?[A-Z]{2})|([A-Z]{3} ?[0-9]{3}))$/.test(str);
},
'fi-FI': function fiFI(str) {
return /^(?=.{4,7})(([A-Z]{1,3}|[0-9]{1,3})[\s-]?([A-Z]{1,3}|[0-9]{1,5}))$/.test(str);
},
'hu-HU': function huHU(str) {
return /^((((?!AAA)(([A-NPRSTVZWXY]{1})([A-PR-Z]{1})([A-HJ-NPR-Z]))|(A[ABC]I)|A[ABC]O|A[A-W]Q|BPI|BPO|UCO|UDO|XAO)-(?!000)\d{3})|(M\d{6})|((CK|DT|CD|HC|H[ABEFIKLMNPRSTVX]|MA|OT|R[A-Z]) \d{2}-\d{2})|(CD \d{3}-\d{3})|(C-(C|X) \d{4})|(X-(A|B|C) \d{4})|(([EPVZ]-\d{5}))|(S A[A-Z]{2} \d{2})|(SP \d{2}-\d{2}))$/.test(str);
},
'pt-BR': function ptBR(str) {
return /^[A-Z]{3}[ -]?[0-9][A-Z][0-9]{2}|[A-Z]{3}[ -]?[0-9]{4}$/.test(str);
},
'pt-PT': function ptPT(str) {

@@ -22,4 +34,4 @@ return /^([A-Z]{2}|[0-9]{2})[ -·]?([A-Z]{2}|[0-9]{2})[ -·]?([A-Z]{2}|[0-9]{2})$/.test(str);

},
'pt-BR': function ptBR(str) {
return /^[A-Z]{3}[ -]?[0-9][A-Z][0-9]{2}|[A-Z]{3}[ -]?[0-9]{4}$/.test(str);
'sv-SE': function svSE(str) {
return /^[A-HJ-PR-UW-Z]{3} ?[\d]{2}[A-HJ-PR-UW-Z1-9]$|(^[A-ZÅÄÖ ]{2,7}$)/.test(str.trim());
}

@@ -26,0 +38,0 @@ };

import assertString from './util/assertString';
var macAddress = /^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){4}([0-9a-fA-F]{2})$/;
var macAddressNoSeparators = /^([0-9a-fA-F]){12}$/;
var macAddressWithDots = /^([0-9a-fA-F]{4}\.){2}([0-9a-fA-F]{4})$/;
var macAddress48 = /^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){4}([0-9a-fA-F]{2})$/;
var macAddress48NoSeparators = /^([0-9a-fA-F]){12}$/;
var macAddress48WithDots = /^([0-9a-fA-F]{4}\.){2}([0-9a-fA-F]{4})$/;
var macAddress64 = /^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){6}([0-9a-fA-F]{2})$/;
var macAddress64NoSeparators = /^([0-9a-fA-F]){16}$/;
var macAddress64WithDots = /^([0-9a-fA-F]{4}\.){3}([0-9a-fA-F]{4})$/;
export default function isMACAddress(str, options) {
assertString(str);
if (options !== null && options !== void 0 && options.eui) {
options.eui = String(options.eui);
}
/**

@@ -11,7 +18,28 @@ * @deprecated `no_colons` TODO: remove it in the next major

if (options && (options.no_colons || options.no_separators)) {
return macAddressNoSeparators.test(str);
if (options !== null && options !== void 0 && options.no_colons || options !== null && options !== void 0 && options.no_separators) {
if (options.eui === '48') {
return macAddress48NoSeparators.test(str);
}
if (options.eui === '64') {
return macAddress64NoSeparators.test(str);
}
return macAddress48NoSeparators.test(str) || macAddress64NoSeparators.test(str);
}
return macAddress.test(str) || macAddressWithDots.test(str);
if ((options === null || options === void 0 ? void 0 : options.eui) === '48') {
return macAddress48.test(str) || macAddress48WithDots.test(str);
}
if ((options === null || options === void 0 ? void 0 : options.eui) === '64') {
return macAddress64.test(str) || macAddress64WithDots.test(str);
}
return isMACAddress(str, {
eui: '48'
}) || isMACAddress(str, {
eui: '64'
});
}
import assertString from './util/assertString';
var magnetURI = /^magnet:\?xt(?:\.1)?=urn:(?:aich|bitprint|btih|ed2k|ed2khash|kzhash|md5|sha1|tree:tiger):[a-z0-9]{32}(?:[a-z0-9]{8})?($|&)/i;
var magnetURIComponent = /(?:^magnet:\?|[^?&]&)xt(?:\.1)?=urn:(?:(?:aich|bitprint|btih|ed2k|ed2khash|kzhash|md5|sha1|tree:tiger):[a-z0-9]{32}(?:[a-z0-9]{8})?|btmh:1220[a-z0-9]{64})(?:$|&)/i;
export default function isMagnetURI(url) {
assertString(url);
return magnetURI.test(url.trim());
if (url.indexOf('magnet:?') !== 0) {
return false;
}
return magnetURIComponent.test(url);
}

@@ -28,3 +28,3 @@ import assertString from './util/assertString';

var mimeTypeSimple = /^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+]{1,100}$/i; // eslint-disable-line max-len
var mimeTypeSimple = /^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+_]{1,100}$/i; // eslint-disable-line max-len
// Handle "charset" in "text/*"

@@ -31,0 +31,0 @@

@@ -13,3 +13,3 @@ import assertString from './util/assertString';

'ar-JO': /^(\+?962|0)?7[789]\d{7}$/,
'ar-KW': /^(\+?965)[569]\d{7}$/,
'ar-KW': /^(\+?965)([569]\d{7}|41\d{6})$/,
'ar-LY': /^((\+?218)|0)?(9[1-6]\d{7}|[1-8]\d{7,9})$/,

@@ -22,3 +22,3 @@ 'ar-MA': /^(?:(?:\+|00)212|0)[5-7]\d{8}$/,

'ar-TN': /^(\+?216)?[2459]\d{7}$/,
'az-AZ': /^(\+994|0)(5[015]|7[07]|99)\d{7}$/,
'az-AZ': /^(\+994|0)(10|5[015]|7[07]|99)\d{7}$/,
'bs-BA': /^((((\+|00)3876)|06))((([0-3]|[5-6])\d{6})|(4\d{7}))$/,

@@ -31,10 +31,14 @@ 'be-BY': /^(\+?375)?(24|25|29|33|44)\d{7}$/,

'da-DK': /^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/,
'de-DE': /^((\+49|0)[1|3])([0|5][0-45-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7,9}$/,
'de-DE': /^((\+49|0)1)(5[0-25-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7,9}$/,
'de-AT': /^(\+43|0)\d{1,4}\d{3,12}$/,
'de-CH': /^(\+41|0)([1-9])\d{1,9}$/,
'de-LU': /^(\+352)?((6\d1)\d{6})$/,
'dv-MV': /^(\+?960)?(7[2-9]|91|9[3-9])\d{7}$/,
'el-GR': /^(\+?30|0)?(69\d{8})$/,
'dv-MV': /^(\+?960)?(7[2-9]|9[1-9])\d{5}$/,
'el-GR': /^(\+?30|0)?6(8[5-9]|9(?![26])[0-9])\d{7}$/,
'el-CY': /^(\+?357?)?(9(9|6)\d{6})$/,
'en-AI': /^(\+?1|0)264(?:2(35|92)|4(?:6[1-2]|76|97)|5(?:3[6-9]|8[1-4])|7(?:2(4|9)|72))\d{4}$/,
'en-AU': /^(\+?61|0)4\d{8}$/,
'en-BM': /^(\+?1)?441(((3|7)\d{6}$)|(5[0-3][0-9]\d{4}$)|(59\d{5}))/,
'en-AG': /^(?:\+1|1)268(?:464|7(?:1[3-9]|[28]\d|3[0246]|64|7[0-689]))\d{4}$/,
'en-BM': /^(\+?1)?441(((3|7)\d{6}$)|(5[0-3][0-9]\d{4}$)|(59\d{5}$))/,
'en-BS': /^(\+?1[-\s]?|0)?\(?242\)?[-\s]?\d{3}[-\s]?\d{4}$/,
'en-GB': /^(\+?44|0)7\d{9}$/,

@@ -48,4 +52,8 @@ 'en-GG': /^(\+?44|0)1481\d{6}$/,

'en-IN': /^(\+?91|0)?[6789]\d{9}$/,
'en-JM': /^(\+?876)?\d{7}$/,
'en-KE': /^(\+?254|0)(7|1)\d{8}$/,
'en-SS': /^(\+?211|0)(9[1257])\d{7}$/,
'en-KI': /^((\+686|686)?)?( )?((6|7)(2|3|8)[0-9]{6})$/,
'en-KN': /^(?:\+1|1)869(?:46\d|48[89]|55[6-8]|66\d|76[02-7])\d{4}$/,
'en-LS': /^(\+?266)(22|28|57|58|59|27|52)\d{6}$/,
'en-MT': /^(\+?356|0)?(99|79|77|21|27|22|25)[0-9]{6}$/,

@@ -56,2 +64,3 @@ 'en-MU': /^(\+?230|0)?\d{8}$/,

'en-NZ': /^(\+?64|0)[28]\d{7,9}$/,
'en-PG': /^(\+?675|0)?(7\d|8[18])\d{6}$/,
'en-PK': /^((00|\+)?92|0)3[0-6]\d{8}$/,

@@ -76,3 +85,3 @@ 'en-PH': /^(09|\+639)\d{9}$/,

'es-DO': /^(\+?1)?8[024]9\d{7}$/,
'es-HN': /^(\+?504)?[9|8]\d{7}$/,
'es-HN': /^(\+?504)?[9|8|3|2]\d{7}$/,
'es-EC': /^(\+?593|0)([2-7]|9[2-9])\d{7}$/,

@@ -82,2 +91,3 @@ 'es-ES': /^(\+?34)?[6|7]\d{8}$/,

'es-MX': /^(\+?52)?(1|01)?\d{10,11}$/,
'es-NI': /^(\+?505)\d{7,8}$/,
'es-PA': /^(\+?507)\d{7,8}$/,

@@ -90,6 +100,8 @@ 'es-PY': /^(\+?595|0)9[9876]\d{7}$/,

'fa-IR': /^(\+?98[\-\s]?|0)9[0-39]\d[\-\s]?\d{3}[\-\s]?\d{4}$/,
'fi-FI': /^(\+?358|0)\s?(4(0|1|2|4|5|6)?|50)\s?(\d\s?){4,8}\d$/,
'fi-FI': /^(\+?358|0)\s?(4[0-6]|50)\s?(\d\s?){4,8}$/,
'fj-FJ': /^(\+?679)?\s?\d{3}\s?\d{4}$/,
'fo-FO': /^(\+?298)?\s?\d{2}\s?\d{2}\s?\d{2}$/,
'fr-BF': /^(\+226|0)[67]\d{7}$/,
'fr-BJ': /^(\+229)\d{8}$/,
'fr-CD': /^(\+?243|0)?(8|9)\d{8}$/,
'fr-CM': /^(\+?237)6[0-9]{8}$/,

@@ -105,12 +117,17 @@ 'fr-FR': /^(\+?33|0)[67]\d{8}$/,

'id-ID': /^(\+?62|0)8(1[123456789]|2[1238]|3[1238]|5[12356789]|7[78]|9[56789]|8[123456789])([\s?|\d]{5,11})$/,
'ir-IR': /^(\+98|0)?9\d{9}$/,
'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/,
'it-SM': /^((\+378)|(0549)|(\+390549)|(\+3780549))?6\d{5,9}$/,
'ja-JP': /^(\+81[ \-]?(\(0\))?|0)[6789]0[ \-]?\d{4}[ \-]?\d{4}$/,
'ka-GE': /^(\+?995)?(5|79)\d{7}$/,
'ka-GE': /^(\+?995)?(79\d{7}|5\d{8})$/,
'kk-KZ': /^(\+?7|8)?7\d{9}$/,
'kl-GL': /^(\+?299)?\s?\d{2}\s?\d{2}\s?\d{2}$/,
'ko-KR': /^((\+?82)[ \-]?)?0?1([0|1|6|7|8|9]{1})[ \-]?\d{3,4}[ \-]?\d{4}$/,
'ky-KG': /^(\+?7\s?\+?7|0)\s?\d{2}\s?\d{3}\s?\d{4}$/,
'lt-LT': /^(\+370|8)\d{8}$/,
'lv-LV': /^(\+?371)2\d{7}$/,
'ms-MY': /^(\+?6?01){1}(([0145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,
'mg-MG': /^((\+?261|0)(2|3)\d)?\d{7}$/,
'mn-MN': /^(\+|00|011)?976(77|81|88|91|94|95|96|99)\d{6}$/,
'my-MM': /^(\+?959|09|9)(2[5-7]|3[1-2]|4[0-5]|6[6-9]|7[5-9]|9[6-9])[0-9]{7}$/,
'ms-MY': /^(\+?60|0)1(([0145](-|\s)?\d{7,8})|([236-9](-|\s)?\d{7}))$/,
'mz-MZ': /^(\+?258)?8[234567]\d{7}$/,

@@ -121,8 +138,10 @@ 'nb-NO': /^(\+?47)?[49]\d{7}$/,

'nl-NL': /^(((\+|00)?31\(0\))|((\+|00)?31)|0)6{1}\d{8}$/,
'nl-AW': /^(\+)?297(56|59|64|73|74|99)\d{5}$/,
'nn-NO': /^(\+?47)?[49]\d{7}$/,
'pl-PL': /^(\+?48)? ?[5-8]\d ?\d{3} ?\d{2} ?\d{2}$/,
'pt-BR': /^((\+?55\ ?[1-9]{2}\ ?)|(\+?55\ ?\([1-9]{2}\)\ ?)|(0[1-9]{2}\ ?)|(\([1-9]{2}\)\ ?)|([1-9]{2}\ ?))((\d{4}\-?\d{4})|(9[2-9]{1}\d{3}\-?\d{4}))$/,
'pt-BR': /^((\+?55\ ?[1-9]{2}\ ?)|(\+?55\ ?\([1-9]{2}\)\ ?)|(0[1-9]{2}\ ?)|(\([1-9]{2}\)\ ?)|([1-9]{2}\ ?))((\d{4}\-?\d{4})|(9[1-9]{1}\d{3}\-?\d{4}))$/,
'pt-PT': /^(\+?351)?9[1236]\d{7}$/,
'pt-AO': /^(\+244)\d{9}$/,
'ro-RO': /^(\+?4?0)\s?7\d{2}(\/|\s|\.|\-)?\d{3}(\s|\.|\-)?\d{3}$/,
'ro-MD': /^(\+?373|0)((6(0|1|2|6|7|8|9))|(7(6|7|8|9)))\d{6}$/,
'ro-RO': /^(\+?40|0)\s?7\d{2}(\/|\s|\.|-)?\d{3}(\s|\.|-)?\d{3}$/,
'ru-RU': /^(\+?7|8)?9\d{9}$/,

@@ -144,3 +163,6 @@ 'si-LK': /^(?:0|94|\+94)?(7(0|1|2|4|5|6|7|8)( |-)?)\d{7}$/,

'zh-TW': /^(\+?886\-?|0)?9\d{8}$/,
'dz-BT': /^(\+?975|0)?(17|16|77|02)\d{6}$/
'dz-BT': /^(\+?975|0)?(17|16|77|02)\d{6}$/,
'ar-YE': /^(((\+|00)9677|0?7)[0137]\d{7}|((\+|00)967|0)[1-7]\d{6})$/,
'ar-EH': /^(\+?212|0)[\s\-]?(5288|5289)[\s\-]?\d{5}$/,
'fa-AF': /^(\+93|0)?(2{1}[0-8]{1}|[3-5]{1}[0-4]{1})(\d{7})$/
};

@@ -147,0 +169,0 @@ /* eslint-enable max-len */

@@ -18,2 +18,4 @@ import assertString from './util/assertString';

// AUSTRALIA
AZ: /^[A-Z]{2,3}\d{7,8}$/,
// AZERBAIJAN
BE: /^[A-Z]{2}\d{6}$/,

@@ -71,2 +73,4 @@ // BELGIUM

// ITALY
JM: /^[Aa]\d{7}$/,
// JAMAICA
JP: /^[A-Z]{2}\d{7}$/,

@@ -76,2 +80,6 @@ // JAPAN

// SOUTH KOREA, REPUBLIC OF KOREA, [S=PS Passports, M=PM Passports]
KZ: /^[a-zA-Z]\d{7}$/,
// KAZAKHSTAN
LI: /^[a-zA-Z]\d{5}$/,
// LIECHTENSTEIN
LT: /^[A-Z0-9]{8}$/,

@@ -91,4 +99,12 @@ // LITHUANIA

// MALAYSIA
MX: /^\d{10,11}$/,
// MEXICO
NL: /^[A-Z]{2}[A-Z0-9]{6}\d$/,
// NETHERLANDS
NZ: /^([Ll]([Aa]|[Dd]|[Ff]|[Hh])|[Ee]([Aa]|[Pp])|[Nn])\d{6}$/,
// NEW ZEALAND
PH: /^([A-Z](\d{6}|\d{7}[A-Z]))|([A-Z]{2}(\d{6}|\d{7}))$/,
// PHILIPPINES
PK: /^[A-Z]{2}\d{7}$/,
// PAKISTAN
PL: /^[A-Z]{2}\d{7}$/,

@@ -105,5 +121,7 @@ // POLAND

SL: /^(P)[A-Z]\d{7}$/,
// SLOVANIA
// SLOVENIA
SK: /^[0-9A-Z]\d{7}$/,
// SLOVAKIA
TH: /^[A-Z]{1,2}\d{6,7}$/,
// THAILAND
TR: /^[A-Z]\d{8}$/,

@@ -110,0 +128,0 @@ // TURKEY

@@ -12,6 +12,7 @@ import assertString from './util/assertString'; // common patterns

AZ: /^AZ\d{4}$/,
BA: /^([7-8]\d{4}$)/,
BE: fourDigit,
BG: fourDigit,
BR: /^\d{5}-\d{3}$/,
BY: /2[1-4]{1}\d{4}$/,
BY: /^2[1-4]\d{4}$/,
CA: /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,

@@ -38,3 +39,3 @@ CH: fourDigit,

IN: /^((?!10|29|35|54|55|65|66|86|87|88|89)[1-9][0-9]{5})$/,
IR: /\b(?!(\d)\1{3})[13-9]{4}[1346-9][013-9]{5}\b/,
IR: /^(?!(\d)\1{3})[13-9]{4}[1346-9][013-9]{5}$/,
IS: threeDigit,

@@ -50,2 +51,3 @@ IT: fiveDigit,

LK: fiveDigit,
MG: threeDigit,
MX: fiveDigit,

@@ -52,0 +54,0 @@ MT: /^[A-Za-z]{3}\s{0,1}\d{4}$/,

import assertString from './util/assertString';
var rgbColor = /^rgb\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){2}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\)$/;
var rgbaColor = /^rgba\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){3}(0?\.\d|1(\.0)?|0(\.0)?)\)$/;
var rgbColorPercent = /^rgb\((([0-9]%|[1-9][0-9]%|100%),){2}([0-9]%|[1-9][0-9]%|100%)\)/;
var rgbaColorPercent = /^rgba\((([0-9]%|[1-9][0-9]%|100%),){3}(0?\.\d|1(\.0)?|0(\.0)?)\)/;
var rgbColorPercent = /^rgb\((([0-9]%|[1-9][0-9]%|100%),){2}([0-9]%|[1-9][0-9]%|100%)\)$/;
var rgbaColorPercent = /^rgba\((([0-9]%|[1-9][0-9]%|100%),){3}(0?\.\d|1(\.0)?|0(\.0)?)\)$/;
export default function isRgbColor(str) {

@@ -7,0 +7,0 @@ var includePercentValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;

@@ -6,3 +6,3 @@ import merge from './util/merge';

var numberRegex = /^[0-9]$/;
var symbolRegex = /^[-#!$@%^&*()_+|~=`{}\[\]:";'<>?,.\/ ]$/;
var symbolRegex = /^[-#!$@£%^&*()_+|~=`{}\[\]:";'<>?,.\/ ]$/;
var defaultOptions = {

@@ -9,0 +9,0 @@ minLength: 8,

@@ -84,2 +84,33 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }

}
/**
* Check if an input is a valid Canadian SIN (Social Insurance Number)
*
* The Social Insurance Number (SIN) is a 9 digit number that
* you need to work in Canada or to have access to government programs and benefits.
*
* https://en.wikipedia.org/wiki/Social_Insurance_Number
* https://www.canada.ca/en/employment-social-development/services/sin.html
* https://www.codercrunch.com/challenge/819302488/sin-validator
*
* @param {string} input
* @return {boolean}
*/
function isCanadianSIN(input) {
var digitsArray = input.split('');
var even = digitsArray.filter(function (_, idx) {
return idx % 2;
}).map(function (i) {
return Number(i) * 2;
}).join('').split('');
var total = digitsArray.filter(function (_, idx) {
return !(idx % 2);
}).concat(even).map(function (i) {
return Number(i);
}).reduce(function (acc, cur) {
return acc + cur;
});
return total % 10 === 0;
}
/*

@@ -437,3 +468,3 @@ * cs-CZ validation function

function enUsCheck(tin) {
return enUsGetPrefixes().indexOf(tin.substr(0, 2)) !== -1;
return enUsGetPrefixes().indexOf(tin.slice(0, 2)) !== -1;
}

@@ -1406,2 +1437,3 @@ /*

'el-GR': /^([0-4]|[7-9])\d{8}$/,
'en-CA': /^\d{9}$/,
'en-GB': /^\d{10}$|^(?!GB|NK|TN|ZZ)(?![DFIQUV])[A-Z](?![DFIQUVO])[A-Z]\d{6}[ABCD ]$/i,

@@ -1435,3 +1467,4 @@ 'en-IE': /^\d{7}[A-W][A-IW]{0,1}$/i,

taxIdFormat['lt-LT'] = taxIdFormat['et-EE'];
taxIdFormat['nl-BE'] = taxIdFormat['fr-BE']; // Algorithmic tax id check functions for various locales
taxIdFormat['nl-BE'] = taxIdFormat['fr-BE'];
taxIdFormat['fr-CA'] = taxIdFormat['en-CA']; // Algorithmic tax id check functions for various locales

@@ -1446,2 +1479,3 @@ var taxIdCheck = {

'el-GR': elGrCheck,
'en-CA': isCanadianSIN,
'en-IE': enIeCheck,

@@ -1472,3 +1506,4 @@ 'en-US': enUsCheck,

taxIdCheck['lt-LT'] = taxIdCheck['et-EE'];
taxIdCheck['nl-BE'] = taxIdCheck['fr-BE']; // Regexes for locales where characters should be omitted before checking format
taxIdCheck['nl-BE'] = taxIdCheck['fr-BE'];
taxIdCheck['fr-CA'] = taxIdCheck['en-CA']; // Regexes for locales where characters should be omitted before checking format

@@ -1475,0 +1510,0 @@ var allsymbols = /[-\\\/!@#$%\^&\*\(\)\+\=\[\]]+/g;

@@ -102,3 +102,3 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }

return false;
} else if (url.substr(0, 2) === '//') {
} else if (url.slice(0, 2) === '//') {
if (!options.allow_protocol_relative_urls) {

@@ -108,3 +108,3 @@ return false;

split[0] = url.substr(2);
split[0] = url.slice(2);
}

@@ -184,2 +184,6 @@

if (host === '' && !options.require_host) {
return true;
}
if (!isIP(host) && !isFQDN(host, options) && (!ipv6 || !isIP(ipv6, 6))) {

@@ -186,0 +190,0 @@ return false;

import assertString from './util/assertString';
import * as algorithms from './util/algorithms';
var PT = function PT(str) {
var match = str.match(/^(PT)?(\d{9})$/);
if (!match) {
return false;
}
var tin = match[2];
var checksum = 11 - algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 8).map(function (a) {
return parseInt(a, 10);
}), 9) % 11;
if (checksum > 9) {
return parseInt(tin[8], 10) === 0;
}
return checksum === parseInt(tin[8], 10);
};
export var vatMatchers = {
GB: /^GB((\d{3} \d{4} ([0-8][0-9]|9[0-6]))|(\d{9} \d{3})|(((GD[0-4])|(HA[5-9]))[0-9]{2}))$/,
IT: /^(IT)?[0-9]{11}$/,
NL: /^(NL)?[0-9]{9}B[0-9]{2}$/
/**
* European Union VAT identification numbers
*/
AT: function AT(str) {
return /^(AT)?U\d{8}$/.test(str);
},
BE: function BE(str) {
return /^(BE)?\d{10}$/.test(str);
},
BG: function BG(str) {
return /^(BG)?\d{9,10}$/.test(str);
},
HR: function HR(str) {
return /^(HR)?\d{11}$/.test(str);
},
CY: function CY(str) {
return /^(CY)?\w{9}$/.test(str);
},
CZ: function CZ(str) {
return /^(CZ)?\d{8,10}$/.test(str);
},
DK: function DK(str) {
return /^(DK)?\d{8}$/.test(str);
},
EE: function EE(str) {
return /^(EE)?\d{9}$/.test(str);
},
FI: function FI(str) {
return /^(FI)?\d{8}$/.test(str);
},
FR: function FR(str) {
return /^(FR)?\w{2}\d{9}$/.test(str);
},
DE: function DE(str) {
return /^(DE)?\d{9}$/.test(str);
},
EL: function EL(str) {
return /^(EL)?\d{9}$/.test(str);
},
HU: function HU(str) {
return /^(HU)?\d{8}$/.test(str);
},
IE: function IE(str) {
return /^(IE)?\d{7}\w{1}(W)?$/.test(str);
},
IT: function IT(str) {
return /^(IT)?\d{11}$/.test(str);
},
LV: function LV(str) {
return /^(LV)?\d{11}$/.test(str);
},
LT: function LT(str) {
return /^(LT)?\d{9,12}$/.test(str);
},
LU: function LU(str) {
return /^(LU)?\d{8}$/.test(str);
},
MT: function MT(str) {
return /^(MT)?\d{8}$/.test(str);
},
NL: function NL(str) {
return /^(NL)?\d{9}B\d{2}$/.test(str);
},
PL: function PL(str) {
return /^(PL)?(\d{10}|(\d{3}-\d{3}-\d{2}-\d{2})|(\d{3}-\d{2}-\d{2}-\d{3}))$/.test(str);
},
PT: PT,
RO: function RO(str) {
return /^(RO)?\d{2,10}$/.test(str);
},
SK: function SK(str) {
return /^(SK)?\d{10}$/.test(str);
},
SI: function SI(str) {
return /^(SI)?\d{8}$/.test(str);
},
ES: function ES(str) {
return /^(ES)?\w\d{7}[A-Z]$/.test(str);
},
SE: function SE(str) {
return /^(SE)?\d{12}$/.test(str);
},
/**
* VAT numbers of non-EU countries
*/
AL: function AL(str) {
return /^(AL)?\w{9}[A-Z]$/.test(str);
},
MK: function MK(str) {
return /^(MK)?\d{13}$/.test(str);
},
AU: function AU(str) {
return /^(AU)?\d{11}$/.test(str);
},
BY: function BY(str) {
return /^(УНП )?\d{9}$/.test(str);
},
CA: function CA(str) {
return /^(CA)?\d{9}$/.test(str);
},
IS: function IS(str) {
return /^(IS)?\d{5,6}$/.test(str);
},
IN: function IN(str) {
return /^(IN)?\d{15}$/.test(str);
},
ID: function ID(str) {
return /^(ID)?(\d{15}|(\d{2}.\d{3}.\d{3}.\d{1}-\d{3}.\d{3}))$/.test(str);
},
IL: function IL(str) {
return /^(IL)?\d{9}$/.test(str);
},
KZ: function KZ(str) {
return /^(KZ)?\d{9}$/.test(str);
},
NZ: function NZ(str) {
return /^(NZ)?\d{9}$/.test(str);
},
NG: function NG(str) {
return /^(NG)?(\d{12}|(\d{8}-\d{4}))$/.test(str);
},
NO: function NO(str) {
return /^(NO)?\d{9}MVA$/.test(str);
},
PH: function PH(str) {
return /^(PH)?(\d{12}|\d{3} \d{3} \d{3} \d{3})$/.test(str);
},
RU: function RU(str) {
return /^(RU)?(\d{10}|\d{12})$/.test(str);
},
SM: function SM(str) {
return /^(SM)?\d{5}$/.test(str);
},
SA: function SA(str) {
return /^(SA)?\d{15}$/.test(str);
},
RS: function RS(str) {
return /^(RS)?\d{9}$/.test(str);
},
CH: function CH(str) {
return /^(CH)?(\d{6}|\d{9}|(\d{3}.\d{3})|(\d{3}.\d{3}.\d{3}))(TVA|MWST|IVA)$/.test(str);
},
TR: function TR(str) {
return /^(TR)?\d{10}$/.test(str);
},
UA: function UA(str) {
return /^(UA)?\d{12}$/.test(str);
},
GB: function GB(str) {
return /^GB((\d{3} \d{4} ([0-8][0-9]|9[0-6]))|(\d{9} \d{3})|(((GD[0-4])|(HA[5-9]))[0-9]{2}))$/.test(str);
},
UZ: function UZ(str) {
return /^(UZ)?\d{9}$/.test(str);
},
/**
* VAT numbers of Latin American countries
*/
AR: function AR(str) {
return /^(AR)?\d{11}$/.test(str);
},
BO: function BO(str) {
return /^(BO)?\d{7}$/.test(str);
},
BR: function BR(str) {
return /^(BR)?((\d{2}.\d{3}.\d{3}\/\d{4}-\d{2})|(\d{3}.\d{3}.\d{3}-\d{2}))$/.test(str);
},
CL: function CL(str) {
return /^(CL)?\d{8}-\d{1}$/.test(str);
},
CO: function CO(str) {
return /^(CO)?\d{10}$/.test(str);
},
CR: function CR(str) {
return /^(CR)?\d{9,12}$/.test(str);
},
EC: function EC(str) {
return /^(EC)?\d{13}$/.test(str);
},
SV: function SV(str) {
return /^(SV)?\d{4}-\d{6}-\d{3}-\d{1}$/.test(str);
},
GT: function GT(str) {
return /^(GT)?\d{7}-\d{1}$/.test(str);
},
HN: function HN(str) {
return /^(HN)?$/.test(str);
},
MX: function MX(str) {
return /^(MX)?\w{3,4}\d{6}\w{3}$/.test(str);
},
NI: function NI(str) {
return /^(NI)?\d{3}-\d{6}-\d{4}\w{1}$/.test(str);
},
PA: function PA(str) {
return /^(PA)?$/.test(str);
},
PY: function PY(str) {
return /^(PY)?\d{6,8}-\d{1}$/.test(str);
},
PE: function PE(str) {
return /^(PE)?\d{11}$/.test(str);
},
DO: function DO(str) {
return /^(DO)?(\d{11}|(\d{3}-\d{7}-\d{1})|[1,4,5]{1}\d{8}|([1,4,5]{1})-\d{2}-\d{5}-\d{1})$/.test(str);
},
UY: function UY(str) {
return /^(UY)?\d{12}$/.test(str);
},
VE: function VE(str) {
return /^(VE)?[J,G,V,E]{1}-(\d{9}|(\d{8}-\d{1}))$/.test(str);
}
};

@@ -12,3 +243,3 @@ export default function isVAT(str, countryCode) {

if (countryCode in vatMatchers) {
return vatMatchers[countryCode].test(str);
return vatMatchers[countryCode](str);
}

@@ -15,0 +246,0 @@

@@ -9,3 +9,3 @@ import assertString from './util/assertString';

return pattern.test(str);
return !!str.match(pattern);
}

@@ -38,2 +38,4 @@ "use strict";

var _isTime = _interopRequireDefault(require("./lib/isTime"));
var _isBoolean = _interopRequireDefault(require("./lib/isBoolean"));

@@ -121,2 +123,4 @@

var _isLuhnNumber = _interopRequireDefault(require("./lib/isLuhnNumber"));
var _isCreditCard = _interopRequireDefault(require("./lib/isCreditCard"));

@@ -144,4 +148,6 @@

var _isISO = _interopRequireDefault(require("./lib/isISO8601"));
var _isISO = _interopRequireDefault(require("./lib/isISO6391"));
var _isISO2 = _interopRequireDefault(require("./lib/isISO8601"));
var _isRFC = _interopRequireDefault(require("./lib/isRFC3339"));

@@ -153,3 +159,3 @@

var _isISO2 = _interopRequireDefault(require("./lib/isISO4217"));
var _isISO3 = _interopRequireDefault(require("./lib/isISO4217"));

@@ -206,3 +212,3 @@ var _isBase = _interopRequireDefault(require("./lib/isBase32"));

var version = '13.7.0';
var version = '13.9.0';
var validator = {

@@ -267,2 +273,3 @@ version: version,

isIn: _isIn.default,
isLuhnNumber: _isLuhnNumber.default,
isCreditCard: _isCreditCard.default,

@@ -281,7 +288,8 @@ isIdentityCard: _isIdentityCard.default,

isBtcAddress: _isBtcAddress.default,
isISO8601: _isISO.default,
isISO6391: _isISO.default,
isISO8601: _isISO2.default,
isRFC3339: _isRFC.default,
isISO31661Alpha2: _isISO31661Alpha.default,
isISO31661Alpha3: _isISO31661Alpha2.default,
isISO4217: _isISO2.default,
isISO4217: _isISO3.default,
isBase32: _isBase.default,

@@ -309,2 +317,3 @@ isBase58: _isBase2.default,

isDate: _isDate.default,
isTime: _isTime.default,
isLicensePlate: _isLicensePlate.default,

@@ -311,0 +320,0 @@ isVAT: _isVAT.default,

@@ -6,3 +6,3 @@ "use strict";

});
exports.commaDecimal = exports.dotDecimal = exports.farsiLocales = exports.arabicLocales = exports.englishLocales = exports.decimal = exports.alphanumeric = exports.alpha = void 0;
exports.commaDecimal = exports.dotDecimal = exports.bengaliLocales = exports.farsiLocales = exports.arabicLocales = exports.englishLocales = exports.decimal = exports.alphanumeric = exports.alpha = void 0;
var alpha = {

@@ -21,2 +21,3 @@ 'en-US': /^[A-Z]+$/i,

'it-IT': /^[A-ZÀÉÈÌÎÓÒÙ]+$/i,
'ja-JP': /^[ぁ-んァ-ヶヲ-゚一-龠ー・。、]+$/i,
'nb-NO': /^[A-ZÆØÅ]+$/i,

@@ -38,2 +39,3 @@ 'nl-NL': /^[A-ZÁÉËÏÓÖÜÚ]+$/i,

'vi-VN': /^[A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,
'ko-KR': /^[ㄱ-ㅎㅏ-ㅣ가-힣]*$/,
'ku-IQ': /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,

@@ -43,3 +45,5 @@ ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,

fa: /^['آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی']+$/i,
'hi-IN': /^[\u0900-\u0961]+[\u0972-\u097F]*$/i
bn: /^['ঀঁংঃঅআইঈউঊঋঌএঐওঔকখগঘঙচছজঝঞটঠডঢণতথদধনপফবভমযরলশষসহ়ঽািীুূৃৄেৈোৌ্ৎৗড়ঢ়য়ৠৡৢৣৰৱ৲৳৴৵৶৷৸৹৺৻']+$/,
'hi-IN': /^[\u0900-\u0961]+[\u0972-\u097F]*$/i,
'si-LK': /^[\u0D80-\u0DFF]+$/
};

@@ -59,2 +63,3 @@ exports.alpha = alpha;

'it-IT': /^[0-9A-ZÀÉÈÌÎÓÒÙ]+$/i,
'ja-JP': /^[0-90-9ぁ-んァ-ヶヲ-゚一-龠ー・。、]+$/i,
'hu-HU': /^[0-9A-ZÁÉÍÓÖŐÚÜŰ]+$/i,

@@ -75,2 +80,3 @@ 'nb-NO': /^[0-9A-ZÆØÅ]+$/i,

'uk-UA': /^[0-9А-ЩЬЮЯЄIЇҐі]+$/i,
'ko-KR': /^[0-9ㄱ-ㅎㅏ-ㅣ가-힣]*$/,
'ku-IQ': /^[٠١٢٣٤٥٦٧٨٩0-9ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,

@@ -81,3 +87,5 @@ 'vi-VN': /^[0-9A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,

fa: /^['0-9آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی۱۲۳۴۵۶۷۸۹۰']+$/i,
'hi-IN': /^[\u0900-\u0963]+[\u0966-\u097F]*$/i
bn: /^['ঀঁংঃঅআইঈউঊঋঌএঐওঔকখগঘঙচছজঝঞটঠডঢণতথদধনপফবভমযরলশষসহ়ঽািীুূৃৄেৈোৌ্ৎৗড়ঢ়য়ৠৡৢৣ০১২৩৪৫৬৭৮৯ৰৱ৲৳৴৵৶৷৸৹৺৻']+$/,
'hi-IN': /^[\u0900-\u0963]+[\u0966-\u097F]*$/i,
'si-LK': /^[0-9\u0D80-\u0DFF]+$/
};

@@ -118,2 +126,12 @@ exports.alphanumeric = alphanumeric;

decimal[_locale2] = decimal.ar;
}
var bengaliLocales = ['BD', 'IN'];
exports.bengaliLocales = bengaliLocales;
for (var _locale3, _i3 = 0; _i3 < bengaliLocales.length; _i3++) {
_locale3 = "bn-".concat(bengaliLocales[_i3]);
alpha[_locale3] = alpha.bn;
alphanumeric[_locale3] = alphanumeric.bn;
decimal[_locale3] = decimal['en-US'];
} // Source: https://en.wikipedia.org/wiki/Decimal_mark

@@ -124,11 +142,11 @@

exports.dotDecimal = dotDecimal;
var commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-ZM', 'es-ES', 'fr-CA', 'fr-FR', 'id-ID', 'it-IT', 'ku-IQ', 'hi-IN', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA', 'vi-VN'];
var commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-ZM', 'es-ES', 'fr-CA', 'fr-FR', 'id-ID', 'it-IT', 'ku-IQ', 'hi-IN', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'si-LK', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA', 'vi-VN'];
exports.commaDecimal = commaDecimal;
for (var _i3 = 0; _i3 < dotDecimal.length; _i3++) {
decimal[dotDecimal[_i3]] = decimal['en-US'];
for (var _i4 = 0; _i4 < dotDecimal.length; _i4++) {
decimal[dotDecimal[_i4]] = decimal['en-US'];
}
for (var _i4 = 0; _i4 < commaDecimal.length; _i4++) {
decimal[commaDecimal[_i4]] = ',';
for (var _i5 = 0; _i5 < commaDecimal.length; _i5++) {
decimal[commaDecimal[_i5]] = ',';
}

@@ -135,0 +153,0 @@

@@ -8,4 +8,2 @@ "use strict";

var _assertString = _interopRequireDefault(require("./util/assertString"));
var _toDate = _interopRequireDefault(require("./toDate"));

@@ -15,7 +13,8 @@

function isAfter(str) {
var date = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : String(new Date());
(0, _assertString.default)(str);
var comparison = (0, _toDate.default)(date);
var original = (0, _toDate.default)(str);
function isAfter(date, options) {
// For backwards compatibility:
// isAfter(str [, date]), i.e. `options` could be used as argument for the legacy `date`
var comparisonDate = (options === null || options === void 0 ? void 0 : options.comparisonDate) || options || Date().toString();
var comparison = (0, _toDate.default)(comparisonDate);
var original = (0, _toDate.default)(date);
return !!(original && comparison && original > comparison);

@@ -22,0 +21,0 @@ }

@@ -10,8 +10,20 @@ "use strict";

var _merge = _interopRequireDefault(require("./util/merge"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var base32 = /^[A-Z2-7]+=*$/;
var crockfordBase32 = /^[A-HJKMNP-TV-Z0-9]+$/;
var defaultBase32Options = {
crockford: false
};
function isBase32(str) {
function isBase32(str, options) {
(0, _assertString.default)(str);
options = (0, _merge.default)(options, defaultBase32Options);
if (options.crockford) {
return crockfordBase32.test(str);
}
var len = str.length;

@@ -18,0 +30,0 @@

@@ -21,3 +21,5 @@ "use strict";

if (!_isISO31661Alpha.CountryCodes.has(str.slice(4, 6).toUpperCase())) {
var countryCode = str.slice(4, 6).toUpperCase();
if (!_isISO31661Alpha.CountryCodes.has(countryCode) && countryCode !== 'XK') {
return false;

@@ -24,0 +26,0 @@ }

@@ -12,3 +12,2 @@ "use strict";

// supports Bech32 addresses
var bech32 = /^(bc1)[a-z0-9]{25,39}$/;

@@ -18,9 +17,4 @@ var base58 = /^(1|3)[A-HJ-NP-Za-km-z1-9]{25,39}$/;

function isBtcAddress(str) {
(0, _assertString.default)(str); // check for bech32
if (str.startsWith('bc1')) {
return bech32.test(str);
}
return base58.test(str);
(0, _assertString.default)(str);
return bech32.test(str) || base58.test(str);
}

@@ -27,0 +21,0 @@

@@ -10,41 +10,41 @@ "use strict";

var _isLuhnNumber = _interopRequireDefault(require("./isLuhnNumber"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var cards = {
amex: /^3[47][0-9]{13}$/,
dinersclub: /^3(?:0[0-5]|[68][0-9])[0-9]{11}$/,
discover: /^6(?:011|5[0-9][0-9])[0-9]{12,15}$/,
jcb: /^(?:2131|1800|35\d{3})\d{11}$/,
mastercard: /^5[1-5][0-9]{2}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$/,
// /^[25][1-7][0-9]{14}$/;
unionpay: /^(6[27][0-9]{14}|^(81[0-9]{14,17}))$/,
visa: /^(?:4[0-9]{12})(?:[0-9]{3,6})?$/
};
/* eslint-disable max-len */
var creditCard = /^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14}|^(81[0-9]{14,17}))$/;
var allCards = /^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14}|^(81[0-9]{14,17}))$/;
/* eslint-enable max-len */
function isCreditCard(str) {
(0, _assertString.default)(str);
var sanitized = str.replace(/[- ]+/g, '');
function isCreditCard(card) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
(0, _assertString.default)(card);
var provider = options.provider;
var sanitized = card.replace(/[- ]+/g, '');
if (!creditCard.test(sanitized)) {
if (provider && provider.toLowerCase() in cards) {
// specific provider in the list
if (!cards[provider.toLowerCase()].test(sanitized)) {
return false;
}
} else if (provider && !(provider.toLowerCase() in cards)) {
/* specific provider not in the list */
throw new Error("".concat(provider, " is not a valid credit card provider."));
} else if (!allCards.test(sanitized)) {
// no specific provider
return false;
}
var sum = 0;
var digit;
var tmpNum;
var shouldDouble;
for (var i = sanitized.length - 1; i >= 0; i--) {
digit = sanitized.substring(i, i + 1);
tmpNum = parseInt(digit, 10);
if (shouldDouble) {
tmpNum *= 2;
if (tmpNum >= 10) {
sum += tmpNum % 10 + 1;
} else {
sum += tmpNum;
}
} else {
sum += tmpNum;
}
shouldDouble = !shouldDouble;
}
return !!(sum % 10 === 0 ? sanitized : false);
return (0, _isLuhnNumber.default)(card);
}

@@ -51,0 +51,0 @@

@@ -12,3 +12,3 @@ "use strict";

var validMediaType = /^[a-z]+\/[a-z0-9\-\+]+$/i;
var validMediaType = /^[a-z]+\/[a-z0-9\-\+\._]+$/i;
var validAttribute = /^[a-z\-]+=[a-z0-9\-]+$/i;

@@ -28,7 +28,7 @@ var validData = /^[a-z0-9!\$&'\(\)\*\+,;=\-\._~:@\/\?%\s]*$/i;

if (schemeAndMediaType.substr(0, 5) !== 'data:') {
if (schemeAndMediaType.slice(0, 5) !== 'data:') {
return false;
}
var mediaType = schemeAndMediaType.substr(5);
var mediaType = schemeAndMediaType.slice(5);

@@ -35,0 +35,0 @@ if (mediaType !== '' && !validMediaType.test(mediaType)) {

@@ -27,3 +27,4 @@ "use strict";

ignore_max_length: false,
host_blacklist: []
host_blacklist: [],
host_whitelist: []
};

@@ -95,3 +96,3 @@ /* eslint-disable max-len */

if (display_name.endsWith(' ')) {
display_name = display_name.substr(0, display_name.length - 1);
display_name = display_name.slice(0, -1);
}

@@ -119,2 +120,6 @@

if (options.host_whitelist.length > 0 && !options.host_whitelist.includes(lower_domain)) {
return false;
}
var user = parts.join('@');

@@ -159,3 +164,4 @@

if (!(0, _isFQDN.default)(domain, {
require_tld: options.require_tld
require_tld: options.require_tld,
ignore_max_length: options.ignore_max_length
})) {

@@ -171,3 +177,3 @@ if (!options.allow_ip_domain) {

var noBracketdomain = domain.substr(1, domain.length - 2);
var noBracketdomain = domain.slice(1, -1);

@@ -174,0 +180,0 @@ if (noBracketdomain.length === 0 || !(0, _isIP.default)(noBracketdomain)) {

@@ -20,3 +20,3 @@ "use strict";

if (str === '' || str === '.' || str === '-' || str === '+') {
if (str === '' || str === '.' || str === ',' || str === '-' || str === '+') {
return false;

@@ -23,0 +23,0 @@ }

@@ -19,3 +19,4 @@ "use strict";

allow_numeric_tld: false,
allow_wildcard: false
allow_wildcard: false,
ignore_max_length: false
};

@@ -47,3 +48,3 @@

if (!/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {
if (!options.allow_numeric_tld && !/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {
return false;

@@ -64,3 +65,3 @@ } // disallow spaces

return parts.every(function (part) {
if (part.length > 63) {
if (part.length > 63 && !options.ignore_max_length) {
return false;

@@ -67,0 +68,0 @@ }

@@ -110,9 +110,9 @@ "use strict";

if (!str.match(/^\d{10}$/)) return false;
str = "0000".concat(str).substr(str.length - 6);
if (parseInt(str.substr(3, 6), 10) === 0) return false;
var lastNumber = parseInt(str.substr(9, 1), 10);
str = "0000".concat(str).slice(str.length - 6);
if (parseInt(str.slice(3, 9), 10) === 0) return false;
var lastNumber = parseInt(str.slice(9, 10), 10);
var sum = 0;
for (var i = 0; i < 9; i++) {
sum += parseInt(str.substr(i, 1), 10) * (10 - i);
sum += parseInt(str.slice(i, i + 1), 10) * (10 - i);
}

@@ -314,2 +314,28 @@

},
'zh-HK': function zhHK(str) {
// sanitize user input
str = str.trim(); // HKID number starts with 1 or 2 letters, followed by 6 digits,
// then a checksum contained in square / round brackets or nothing
var regexHKID = /^[A-Z]{1,2}[0-9]{6}((\([0-9A]\))|(\[[0-9A]\])|([0-9A]))$/;
var regexIsDigit = /^[0-9]$/; // convert the user input to all uppercase and apply regex
str = str.toUpperCase();
if (!regexHKID.test(str)) return false;
str = str.replace(/\[|\]|\(|\)/g, '');
if (str.length === 8) str = "3".concat(str);
var checkSumVal = 0;
for (var i = 0; i <= 7; i++) {
var convertedChar = void 0;
if (!regexIsDigit.test(str[i])) convertedChar = (str[i].charCodeAt(0) - 55) % 11;else convertedChar = str[i];
checkSumVal += convertedChar * (9 - i);
}
checkSumVal %= 11;
var checkSumConverted;
if (checkSumVal === 0) checkSumConverted = '0';else if (checkSumVal === 1) checkSumConverted = 'A';else checkSumConverted = String(11 - checkSumVal);
if (checkSumConverted === str[str.length - 1]) return true;
return false;
},
'zh-TW': function zhTW(str) {

@@ -316,0 +342,0 @@ var ALPHABET_CODES = {

@@ -57,14 +57,7 @@ "use strict";

if (version === '4') {
if (!IPv4AddressRegExp.test(str)) {
return false;
}
var parts = str.split('.').sort(function (a, b) {
return a - b;
});
return parts[3] <= 255;
return IPv4AddressRegExp.test(str);
}
if (version === '6') {
return !!IPv6AddressRegExp.test(str);
return IPv6AddressRegExp.test(str);
}

@@ -71,0 +64,0 @@

@@ -12,48 +12,52 @@ "use strict";

var isbn10Maybe = /^(?:[0-9]{9}X|[0-9]{10})$/;
var isbn13Maybe = /^(?:[0-9]{13})$/;
var possibleIsbn10 = /^(?:[0-9]{9}X|[0-9]{10})$/;
var possibleIsbn13 = /^(?:[0-9]{13})$/;
var factor = [1, 3];
function isISBN(str) {
var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
(0, _assertString.default)(str);
version = String(version);
function isISBN(isbn, options) {
(0, _assertString.default)(isbn); // For backwards compatibility:
// isISBN(str [, version]), i.e. `options` could be used as argument for the legacy `version`
if (!version) {
return isISBN(str, 10) || isISBN(str, 13);
var version = String((options === null || options === void 0 ? void 0 : options.version) || options);
if (!(options !== null && options !== void 0 && options.version || options)) {
return isISBN(isbn, {
version: 10
}) || isISBN(isbn, {
version: 13
});
}
var sanitized = str.replace(/[\s-]+/g, '');
var sanitizedIsbn = isbn.replace(/[\s-]+/g, '');
var checksum = 0;
var i;
if (version === '10') {
if (!isbn10Maybe.test(sanitized)) {
if (!possibleIsbn10.test(sanitizedIsbn)) {
return false;
}
for (i = 0; i < 9; i++) {
checksum += (i + 1) * sanitized.charAt(i);
for (var i = 0; i < version - 1; i++) {
checksum += (i + 1) * sanitizedIsbn.charAt(i);
}
if (sanitized.charAt(9) === 'X') {
if (sanitizedIsbn.charAt(9) === 'X') {
checksum += 10 * 10;
} else {
checksum += 10 * sanitized.charAt(9);
checksum += 10 * sanitizedIsbn.charAt(9);
}
if (checksum % 11 === 0) {
return !!sanitized;
return true;
}
} else if (version === '13') {
if (!isbn13Maybe.test(sanitized)) {
if (!possibleIsbn13.test(sanitizedIsbn)) {
return false;
}
for (i = 0; i < 12; i++) {
checksum += factor[i % 2] * sanitized.charAt(i);
for (var _i = 0; _i < 12; _i++) {
checksum += factor[_i % 2] * sanitizedIsbn.charAt(_i);
}
if (sanitized.charAt(12) - (10 - checksum % 10) % 10 === 0) {
return !!sanitized;
if (sanitizedIsbn.charAt(12) - (10 - checksum % 10) % 10 === 0) {
return true;
}

@@ -60,0 +64,0 @@ }

@@ -29,4 +29,5 @@ "use strict";

var presentationSequences = str.match(/(\uFE0F|\uFE0E)/g) || [];
var surrogatePairs = str.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g) || [];
var len = str.length - surrogatePairs.length;
var len = str.length - presentationSequences.length - surrogatePairs.length;
return len >= min && (typeof max === 'undefined' || len <= max);

@@ -33,0 +34,0 @@ }

@@ -14,6 +14,6 @@ "use strict";

'cs-CZ': function csCZ(str) {
return /^(([ABCDEFHKIJKLMNPRSTUVXYZ]|[0-9])-?){5,8}$/.test(str);
return /^(([ABCDEFHIJKLMNPRSTUVXYZ]|[0-9])-?){5,8}$/.test(str);
},
'de-DE': function deDE(str) {
return /^((AW|UL|AK|GA|AÖ|LF|AZ|AM|AS|ZE|AN|AB|A|KG|KH|BA|EW|BZ|HY|KM|BT|HP|B|BC|BI|BO|FN|TT|ÜB|BN|AH|BS|FR|HB|ZZ|BB|BK|BÖ|OC|OK|CW|CE|C|CO|LH|CB|KW|LC|LN|DA|DI|DE|DH|SY|NÖ|DO|DD|DU|DN|D|EI|EA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:[ -]?[A-Z]*)?[ -]?[0-9]{4}$/.test(str);
},
'es-AR': function esAR(str) {
return /^(([A-Z]{2} ?[0-9]{3} ?[A-Z]{2})|([A-Z]{3} ?[0-9]{3}))$/.test(str);
},
'fi-FI': function fiFI(str) {
return /^(?=.{4,7})(([A-Z]{1,3}|[0-9]{1,3})[\s-]?([A-Z]{1,3}|[0-9]{1,5}))$/.test(str);
},
'hu-HU': function huHU(str) {
return /^((((?!AAA)(([A-NPRSTVZWXY]{1})([A-PR-Z]{1})([A-HJ-NPR-Z]))|(A[ABC]I)|A[ABC]O|A[A-W]Q|BPI|BPO|UCO|UDO|XAO)-(?!000)\d{3})|(M\d{6})|((CK|DT|CD|HC|H[ABEFIKLMNPRSTVX]|MA|OT|R[A-Z]) \d{2}-\d{2})|(CD \d{3}-\d{3})|(C-(C|X) \d{4})|(X-(A|B|C) \d{4})|(([EPVZ]-\d{5}))|(S A[A-Z]{2} \d{2})|(SP \d{2}-\d{2}))$/.test(str);
},
'pt-BR': function ptBR(str) {
return /^[A-Z]{3}[ -]?[0-9][A-Z][0-9]{2}|[A-Z]{3}[ -]?[0-9]{4}$/.test(str);
},
'pt-PT': function ptPT(str) {

@@ -33,4 +45,4 @@ return /^([A-Z]{2}|[0-9]{2})[ -·]?([A-Z]{2}|[0-9]{2})[ -·]?([A-Z]{2}|[0-9]{2})$/.test(str);

},
'pt-BR': function ptBR(str) {
return /^[A-Z]{3}[ -]?[0-9][A-Z][0-9]{2}|[A-Z]{3}[ -]?[0-9]{4}$/.test(str);
'sv-SE': function svSE(str) {
return /^[A-HJ-PR-UW-Z]{3} ?[\d]{2}[A-HJ-PR-UW-Z1-9]$|(^[A-ZÅÄÖ ]{2,7}$)/.test(str.trim());
}

@@ -37,0 +49,0 @@ };

@@ -12,8 +12,15 @@ "use strict";

var macAddress = /^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){4}([0-9a-fA-F]{2})$/;
var macAddressNoSeparators = /^([0-9a-fA-F]){12}$/;
var macAddressWithDots = /^([0-9a-fA-F]{4}\.){2}([0-9a-fA-F]{4})$/;
var macAddress48 = /^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){4}([0-9a-fA-F]{2})$/;
var macAddress48NoSeparators = /^([0-9a-fA-F]){12}$/;
var macAddress48WithDots = /^([0-9a-fA-F]{4}\.){2}([0-9a-fA-F]{4})$/;
var macAddress64 = /^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){6}([0-9a-fA-F]{2})$/;
var macAddress64NoSeparators = /^([0-9a-fA-F]){16}$/;
var macAddress64WithDots = /^([0-9a-fA-F]{4}\.){3}([0-9a-fA-F]{4})$/;
function isMACAddress(str, options) {
(0, _assertString.default)(str);
if (options !== null && options !== void 0 && options.eui) {
options.eui = String(options.eui);
}
/**

@@ -23,7 +30,28 @@ * @deprecated `no_colons` TODO: remove it in the next major

if (options && (options.no_colons || options.no_separators)) {
return macAddressNoSeparators.test(str);
if (options !== null && options !== void 0 && options.no_colons || options !== null && options !== void 0 && options.no_separators) {
if (options.eui === '48') {
return macAddress48NoSeparators.test(str);
}
if (options.eui === '64') {
return macAddress64NoSeparators.test(str);
}
return macAddress48NoSeparators.test(str) || macAddress64NoSeparators.test(str);
}
return macAddress.test(str) || macAddressWithDots.test(str);
if ((options === null || options === void 0 ? void 0 : options.eui) === '48') {
return macAddress48.test(str) || macAddress48WithDots.test(str);
}
if ((options === null || options === void 0 ? void 0 : options.eui) === '64') {
return macAddress64.test(str) || macAddress64WithDots.test(str);
}
return isMACAddress(str, {
eui: '48'
}) || isMACAddress(str, {
eui: '64'
});
}

@@ -30,0 +58,0 @@

@@ -12,7 +12,12 @@ "use strict";

var magnetURI = /^magnet:\?xt(?:\.1)?=urn:(?:aich|bitprint|btih|ed2k|ed2khash|kzhash|md5|sha1|tree:tiger):[a-z0-9]{32}(?:[a-z0-9]{8})?($|&)/i;
var magnetURIComponent = /(?:^magnet:\?|[^?&]&)xt(?:\.1)?=urn:(?:(?:aich|bitprint|btih|ed2k|ed2khash|kzhash|md5|sha1|tree:tiger):[a-z0-9]{32}(?:[a-z0-9]{8})?|btmh:1220[a-z0-9]{64})(?:$|&)/i;
function isMagnetURI(url) {
(0, _assertString.default)(url);
return magnetURI.test(url.trim());
if (url.indexOf('magnet:?') !== 0) {
return false;
}
return magnetURIComponent.test(url);
}

@@ -19,0 +24,0 @@

@@ -37,3 +37,3 @@ "use strict";

// This rule does not comply to the RFC specs (what is the max length ?).
var mimeTypeSimple = /^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+]{1,100}$/i; // eslint-disable-line max-len
var mimeTypeSimple = /^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+_]{1,100}$/i; // eslint-disable-line max-len
// Handle "charset" in "text/*"

@@ -40,0 +40,0 @@

@@ -23,3 +23,3 @@ "use strict";

'ar-JO': /^(\+?962|0)?7[789]\d{7}$/,
'ar-KW': /^(\+?965)[569]\d{7}$/,
'ar-KW': /^(\+?965)([569]\d{7}|41\d{6})$/,
'ar-LY': /^((\+?218)|0)?(9[1-6]\d{7}|[1-8]\d{7,9})$/,

@@ -32,3 +32,3 @@ 'ar-MA': /^(?:(?:\+|00)212|0)[5-7]\d{8}$/,

'ar-TN': /^(\+?216)?[2459]\d{7}$/,
'az-AZ': /^(\+994|0)(5[015]|7[07]|99)\d{7}$/,
'az-AZ': /^(\+994|0)(10|5[015]|7[07]|99)\d{7}$/,
'bs-BA': /^((((\+|00)3876)|06))((([0-3]|[5-6])\d{6})|(4\d{7}))$/,

@@ -41,10 +41,14 @@ 'be-BY': /^(\+?375)?(24|25|29|33|44)\d{7}$/,

'da-DK': /^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/,
'de-DE': /^((\+49|0)[1|3])([0|5][0-45-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7,9}$/,
'de-DE': /^((\+49|0)1)(5[0-25-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7,9}$/,
'de-AT': /^(\+43|0)\d{1,4}\d{3,12}$/,
'de-CH': /^(\+41|0)([1-9])\d{1,9}$/,
'de-LU': /^(\+352)?((6\d1)\d{6})$/,
'dv-MV': /^(\+?960)?(7[2-9]|91|9[3-9])\d{7}$/,
'el-GR': /^(\+?30|0)?(69\d{8})$/,
'dv-MV': /^(\+?960)?(7[2-9]|9[1-9])\d{5}$/,
'el-GR': /^(\+?30|0)?6(8[5-9]|9(?![26])[0-9])\d{7}$/,
'el-CY': /^(\+?357?)?(9(9|6)\d{6})$/,
'en-AI': /^(\+?1|0)264(?:2(35|92)|4(?:6[1-2]|76|97)|5(?:3[6-9]|8[1-4])|7(?:2(4|9)|72))\d{4}$/,
'en-AU': /^(\+?61|0)4\d{8}$/,
'en-BM': /^(\+?1)?441(((3|7)\d{6}$)|(5[0-3][0-9]\d{4}$)|(59\d{5}))/,
'en-AG': /^(?:\+1|1)268(?:464|7(?:1[3-9]|[28]\d|3[0246]|64|7[0-689]))\d{4}$/,
'en-BM': /^(\+?1)?441(((3|7)\d{6}$)|(5[0-3][0-9]\d{4}$)|(59\d{5}$))/,
'en-BS': /^(\+?1[-\s]?|0)?\(?242\)?[-\s]?\d{3}[-\s]?\d{4}$/,
'en-GB': /^(\+?44|0)7\d{9}$/,

@@ -58,4 +62,8 @@ 'en-GG': /^(\+?44|0)1481\d{6}$/,

'en-IN': /^(\+?91|0)?[6789]\d{9}$/,
'en-JM': /^(\+?876)?\d{7}$/,
'en-KE': /^(\+?254|0)(7|1)\d{8}$/,
'en-SS': /^(\+?211|0)(9[1257])\d{7}$/,
'en-KI': /^((\+686|686)?)?( )?((6|7)(2|3|8)[0-9]{6})$/,
'en-KN': /^(?:\+1|1)869(?:46\d|48[89]|55[6-8]|66\d|76[02-7])\d{4}$/,
'en-LS': /^(\+?266)(22|28|57|58|59|27|52)\d{6}$/,
'en-MT': /^(\+?356|0)?(99|79|77|21|27|22|25)[0-9]{6}$/,

@@ -66,2 +74,3 @@ 'en-MU': /^(\+?230|0)?\d{8}$/,

'en-NZ': /^(\+?64|0)[28]\d{7,9}$/,
'en-PG': /^(\+?675|0)?(7\d|8[18])\d{6}$/,
'en-PK': /^((00|\+)?92|0)3[0-6]\d{8}$/,

@@ -86,3 +95,3 @@ 'en-PH': /^(09|\+639)\d{9}$/,

'es-DO': /^(\+?1)?8[024]9\d{7}$/,
'es-HN': /^(\+?504)?[9|8]\d{7}$/,
'es-HN': /^(\+?504)?[9|8|3|2]\d{7}$/,
'es-EC': /^(\+?593|0)([2-7]|9[2-9])\d{7}$/,

@@ -92,2 +101,3 @@ 'es-ES': /^(\+?34)?[6|7]\d{8}$/,

'es-MX': /^(\+?52)?(1|01)?\d{10,11}$/,
'es-NI': /^(\+?505)\d{7,8}$/,
'es-PA': /^(\+?507)\d{7,8}$/,

@@ -100,6 +110,8 @@ 'es-PY': /^(\+?595|0)9[9876]\d{7}$/,

'fa-IR': /^(\+?98[\-\s]?|0)9[0-39]\d[\-\s]?\d{3}[\-\s]?\d{4}$/,
'fi-FI': /^(\+?358|0)\s?(4(0|1|2|4|5|6)?|50)\s?(\d\s?){4,8}\d$/,
'fi-FI': /^(\+?358|0)\s?(4[0-6]|50)\s?(\d\s?){4,8}$/,
'fj-FJ': /^(\+?679)?\s?\d{3}\s?\d{4}$/,
'fo-FO': /^(\+?298)?\s?\d{2}\s?\d{2}\s?\d{2}$/,
'fr-BF': /^(\+226|0)[67]\d{7}$/,
'fr-BJ': /^(\+229)\d{8}$/,
'fr-CD': /^(\+?243|0)?(8|9)\d{8}$/,
'fr-CM': /^(\+?237)6[0-9]{8}$/,

@@ -115,12 +127,17 @@ 'fr-FR': /^(\+?33|0)[67]\d{8}$/,

'id-ID': /^(\+?62|0)8(1[123456789]|2[1238]|3[1238]|5[12356789]|7[78]|9[56789]|8[123456789])([\s?|\d]{5,11})$/,
'ir-IR': /^(\+98|0)?9\d{9}$/,
'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/,
'it-SM': /^((\+378)|(0549)|(\+390549)|(\+3780549))?6\d{5,9}$/,
'ja-JP': /^(\+81[ \-]?(\(0\))?|0)[6789]0[ \-]?\d{4}[ \-]?\d{4}$/,
'ka-GE': /^(\+?995)?(5|79)\d{7}$/,
'ka-GE': /^(\+?995)?(79\d{7}|5\d{8})$/,
'kk-KZ': /^(\+?7|8)?7\d{9}$/,
'kl-GL': /^(\+?299)?\s?\d{2}\s?\d{2}\s?\d{2}$/,
'ko-KR': /^((\+?82)[ \-]?)?0?1([0|1|6|7|8|9]{1})[ \-]?\d{3,4}[ \-]?\d{4}$/,
'ky-KG': /^(\+?7\s?\+?7|0)\s?\d{2}\s?\d{3}\s?\d{4}$/,
'lt-LT': /^(\+370|8)\d{8}$/,
'lv-LV': /^(\+?371)2\d{7}$/,
'ms-MY': /^(\+?6?01){1}(([0145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,
'mg-MG': /^((\+?261|0)(2|3)\d)?\d{7}$/,
'mn-MN': /^(\+|00|011)?976(77|81|88|91|94|95|96|99)\d{6}$/,
'my-MM': /^(\+?959|09|9)(2[5-7]|3[1-2]|4[0-5]|6[6-9]|7[5-9]|9[6-9])[0-9]{7}$/,
'ms-MY': /^(\+?60|0)1(([0145](-|\s)?\d{7,8})|([236-9](-|\s)?\d{7}))$/,
'mz-MZ': /^(\+?258)?8[234567]\d{7}$/,

@@ -131,8 +148,10 @@ 'nb-NO': /^(\+?47)?[49]\d{7}$/,

'nl-NL': /^(((\+|00)?31\(0\))|((\+|00)?31)|0)6{1}\d{8}$/,
'nl-AW': /^(\+)?297(56|59|64|73|74|99)\d{5}$/,
'nn-NO': /^(\+?47)?[49]\d{7}$/,
'pl-PL': /^(\+?48)? ?[5-8]\d ?\d{3} ?\d{2} ?\d{2}$/,
'pt-BR': /^((\+?55\ ?[1-9]{2}\ ?)|(\+?55\ ?\([1-9]{2}\)\ ?)|(0[1-9]{2}\ ?)|(\([1-9]{2}\)\ ?)|([1-9]{2}\ ?))((\d{4}\-?\d{4})|(9[2-9]{1}\d{3}\-?\d{4}))$/,
'pt-BR': /^((\+?55\ ?[1-9]{2}\ ?)|(\+?55\ ?\([1-9]{2}\)\ ?)|(0[1-9]{2}\ ?)|(\([1-9]{2}\)\ ?)|([1-9]{2}\ ?))((\d{4}\-?\d{4})|(9[1-9]{1}\d{3}\-?\d{4}))$/,
'pt-PT': /^(\+?351)?9[1236]\d{7}$/,
'pt-AO': /^(\+244)\d{9}$/,
'ro-RO': /^(\+?4?0)\s?7\d{2}(\/|\s|\.|\-)?\d{3}(\s|\.|\-)?\d{3}$/,
'ro-MD': /^(\+?373|0)((6(0|1|2|6|7|8|9))|(7(6|7|8|9)))\d{6}$/,
'ro-RO': /^(\+?40|0)\s?7\d{2}(\/|\s|\.|-)?\d{3}(\s|\.|-)?\d{3}$/,
'ru-RU': /^(\+?7|8)?9\d{9}$/,

@@ -154,3 +173,6 @@ 'si-LK': /^(?:0|94|\+94)?(7(0|1|2|4|5|6|7|8)( |-)?)\d{7}$/,

'zh-TW': /^(\+?886\-?|0)?9\d{8}$/,
'dz-BT': /^(\+?975|0)?(17|16|77|02)\d{6}$/
'dz-BT': /^(\+?975|0)?(17|16|77|02)\d{6}$/,
'ar-YE': /^(((\+|00)9677|0?7)[0137]\d{7}|((\+|00)967|0)[1-7]\d{6})$/,
'ar-EH': /^(\+?212|0)[\s\-]?(5288|5289)[\s\-]?\d{5}$/,
'fa-AF': /^(\+93|0)?(2{1}[0-8]{1}|[3-5]{1}[0-4]{1})(\d{7})$/
};

@@ -157,0 +179,0 @@ /* eslint-enable max-len */

@@ -27,2 +27,4 @@ "use strict";

// AUSTRALIA
AZ: /^[A-Z]{2,3}\d{7,8}$/,
// AZERBAIJAN
BE: /^[A-Z]{2}\d{6}$/,

@@ -80,2 +82,4 @@ // BELGIUM

// ITALY
JM: /^[Aa]\d{7}$/,
// JAMAICA
JP: /^[A-Z]{2}\d{7}$/,

@@ -85,2 +89,6 @@ // JAPAN

// SOUTH KOREA, REPUBLIC OF KOREA, [S=PS Passports, M=PM Passports]
KZ: /^[a-zA-Z]\d{7}$/,
// KAZAKHSTAN
LI: /^[a-zA-Z]\d{5}$/,
// LIECHTENSTEIN
LT: /^[A-Z0-9]{8}$/,

@@ -100,4 +108,12 @@ // LITHUANIA

// MALAYSIA
MX: /^\d{10,11}$/,
// MEXICO
NL: /^[A-Z]{2}[A-Z0-9]{6}\d$/,
// NETHERLANDS
NZ: /^([Ll]([Aa]|[Dd]|[Ff]|[Hh])|[Ee]([Aa]|[Pp])|[Nn])\d{6}$/,
// NEW ZEALAND
PH: /^([A-Z](\d{6}|\d{7}[A-Z]))|([A-Z]{2}(\d{6}|\d{7}))$/,
// PHILIPPINES
PK: /^[A-Z]{2}\d{7}$/,
// PAKISTAN
PL: /^[A-Z]{2}\d{7}$/,

@@ -114,5 +130,7 @@ // POLAND

SL: /^(P)[A-Z]\d{7}$/,
// SLOVANIA
// SLOVENIA
SK: /^[0-9A-Z]\d{7}$/,
// SLOVAKIA
TH: /^[A-Z]{1,2}\d{6,7}$/,
// THAILAND
TR: /^[A-Z]\d{8}$/,

@@ -119,0 +137,0 @@ // TURKEY

@@ -23,6 +23,7 @@ "use strict";

AZ: /^AZ\d{4}$/,
BA: /^([7-8]\d{4}$)/,
BE: fourDigit,
BG: fourDigit,
BR: /^\d{5}-\d{3}$/,
BY: /2[1-4]{1}\d{4}$/,
BY: /^2[1-4]\d{4}$/,
CA: /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,

@@ -49,3 +50,3 @@ CH: fourDigit,

IN: /^((?!10|29|35|54|55|65|66|86|87|88|89)[1-9][0-9]{5})$/,
IR: /\b(?!(\d)\1{3})[13-9]{4}[1346-9][013-9]{5}\b/,
IR: /^(?!(\d)\1{3})[13-9]{4}[1346-9][013-9]{5}$/,
IS: threeDigit,

@@ -61,2 +62,3 @@ IT: fiveDigit,

LK: fiveDigit,
MG: threeDigit,
MX: fiveDigit,

@@ -63,0 +65,0 @@ MT: /^[A-Za-z]{3}\s{0,1}\d{4}$/,

@@ -14,4 +14,4 @@ "use strict";

var rgbaColor = /^rgba\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){3}(0?\.\d|1(\.0)?|0(\.0)?)\)$/;
var rgbColorPercent = /^rgb\((([0-9]%|[1-9][0-9]%|100%),){2}([0-9]%|[1-9][0-9]%|100%)\)/;
var rgbaColorPercent = /^rgba\((([0-9]%|[1-9][0-9]%|100%),){3}(0?\.\d|1(\.0)?|0(\.0)?)\)/;
var rgbColorPercent = /^rgb\((([0-9]%|[1-9][0-9]%|100%),){2}([0-9]%|[1-9][0-9]%|100%)\)$/;
var rgbaColorPercent = /^rgba\((([0-9]%|[1-9][0-9]%|100%),){3}(0?\.\d|1(\.0)?|0(\.0)?)\)$/;

@@ -18,0 +18,0 @@ function isRgbColor(str) {

@@ -17,3 +17,3 @@ "use strict";

var numberRegex = /^[0-9]$/;
var symbolRegex = /^[-#!$@%^&*()_+|~=`{}\[\]:";'<>?,.\/ ]$/;
var symbolRegex = /^[-#!$@£%^&*()_+|~=`{}\[\]:";'<>?,.\/ ]$/;
var defaultOptions = {

@@ -20,0 +20,0 @@ minLength: 8,

@@ -101,2 +101,33 @@ "use strict";

}
/**
* Check if an input is a valid Canadian SIN (Social Insurance Number)
*
* The Social Insurance Number (SIN) is a 9 digit number that
* you need to work in Canada or to have access to government programs and benefits.
*
* https://en.wikipedia.org/wiki/Social_Insurance_Number
* https://www.canada.ca/en/employment-social-development/services/sin.html
* https://www.codercrunch.com/challenge/819302488/sin-validator
*
* @param {string} input
* @return {boolean}
*/
function isCanadianSIN(input) {
var digitsArray = input.split('');
var even = digitsArray.filter(function (_, idx) {
return idx % 2;
}).map(function (i) {
return Number(i) * 2;
}).join('').split('');
var total = digitsArray.filter(function (_, idx) {
return !(idx % 2);
}).concat(even).map(function (i) {
return Number(i);
}).reduce(function (acc, cur) {
return acc + cur;
});
return total % 10 === 0;
}
/*

@@ -454,3 +485,3 @@ * cs-CZ validation function

function enUsCheck(tin) {
return enUsGetPrefixes().indexOf(tin.substr(0, 2)) !== -1;
return enUsGetPrefixes().indexOf(tin.slice(0, 2)) !== -1;
}

@@ -1423,2 +1454,3 @@ /*

'el-GR': /^([0-4]|[7-9])\d{8}$/,
'en-CA': /^\d{9}$/,
'en-GB': /^\d{10}$|^(?!GB|NK|TN|ZZ)(?![DFIQUV])[A-Z](?![DFIQUVO])[A-Z]\d{6}[ABCD ]$/i,

@@ -1452,3 +1484,4 @@ 'en-IE': /^\d{7}[A-W][A-IW]{0,1}$/i,

taxIdFormat['lt-LT'] = taxIdFormat['et-EE'];
taxIdFormat['nl-BE'] = taxIdFormat['fr-BE']; // Algorithmic tax id check functions for various locales
taxIdFormat['nl-BE'] = taxIdFormat['fr-BE'];
taxIdFormat['fr-CA'] = taxIdFormat['en-CA']; // Algorithmic tax id check functions for various locales

@@ -1463,2 +1496,3 @@ var taxIdCheck = {

'el-GR': elGrCheck,
'en-CA': isCanadianSIN,
'en-IE': enIeCheck,

@@ -1489,3 +1523,4 @@ 'en-US': enUsCheck,

taxIdCheck['lt-LT'] = taxIdCheck['et-EE'];
taxIdCheck['nl-BE'] = taxIdCheck['fr-BE']; // Regexes for locales where characters should be omitted before checking format
taxIdCheck['nl-BE'] = taxIdCheck['fr-BE'];
taxIdCheck['fr-CA'] = taxIdCheck['en-CA']; // Regexes for locales where characters should be omitted before checking format

@@ -1492,0 +1527,0 @@ var allsymbols = /[-\\\/!@#$%\^&\*\(\)\+\=\[\]]+/g;

@@ -114,3 +114,3 @@ "use strict";

return false;
} else if (url.substr(0, 2) === '//') {
} else if (url.slice(0, 2) === '//') {
if (!options.allow_protocol_relative_urls) {

@@ -120,3 +120,3 @@ return false;

split[0] = url.substr(2);
split[0] = url.slice(2);
}

@@ -196,2 +196,6 @@

if (host === '' && !options.require_host) {
return true;
}
if (!(0, _isIP.default)(host) && !(0, _isFQDN.default)(host, options) && (!ipv6 || !(0, _isIP.default)(ipv6, 6))) {

@@ -198,0 +202,0 @@ return false;

"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
Object.defineProperty(exports, "__esModule", {

@@ -11,8 +13,243 @@ value: true

var algorithms = _interopRequireWildcard(require("./util/algorithms"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var PT = function PT(str) {
var match = str.match(/^(PT)?(\d{9})$/);
if (!match) {
return false;
}
var tin = match[2];
var checksum = 11 - algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 8).map(function (a) {
return parseInt(a, 10);
}), 9) % 11;
if (checksum > 9) {
return parseInt(tin[8], 10) === 0;
}
return checksum === parseInt(tin[8], 10);
};
var vatMatchers = {
GB: /^GB((\d{3} \d{4} ([0-8][0-9]|9[0-6]))|(\d{9} \d{3})|(((GD[0-4])|(HA[5-9]))[0-9]{2}))$/,
IT: /^(IT)?[0-9]{11}$/,
NL: /^(NL)?[0-9]{9}B[0-9]{2}$/
/**
* European Union VAT identification numbers
*/
AT: function AT(str) {
return /^(AT)?U\d{8}$/.test(str);
},
BE: function BE(str) {
return /^(BE)?\d{10}$/.test(str);
},
BG: function BG(str) {
return /^(BG)?\d{9,10}$/.test(str);
},
HR: function HR(str) {
return /^(HR)?\d{11}$/.test(str);
},
CY: function CY(str) {
return /^(CY)?\w{9}$/.test(str);
},
CZ: function CZ(str) {
return /^(CZ)?\d{8,10}$/.test(str);
},
DK: function DK(str) {
return /^(DK)?\d{8}$/.test(str);
},
EE: function EE(str) {
return /^(EE)?\d{9}$/.test(str);
},
FI: function FI(str) {
return /^(FI)?\d{8}$/.test(str);
},
FR: function FR(str) {
return /^(FR)?\w{2}\d{9}$/.test(str);
},
DE: function DE(str) {
return /^(DE)?\d{9}$/.test(str);
},
EL: function EL(str) {
return /^(EL)?\d{9}$/.test(str);
},
HU: function HU(str) {
return /^(HU)?\d{8}$/.test(str);
},
IE: function IE(str) {
return /^(IE)?\d{7}\w{1}(W)?$/.test(str);
},
IT: function IT(str) {
return /^(IT)?\d{11}$/.test(str);
},
LV: function LV(str) {
return /^(LV)?\d{11}$/.test(str);
},
LT: function LT(str) {
return /^(LT)?\d{9,12}$/.test(str);
},
LU: function LU(str) {
return /^(LU)?\d{8}$/.test(str);
},
MT: function MT(str) {
return /^(MT)?\d{8}$/.test(str);
},
NL: function NL(str) {
return /^(NL)?\d{9}B\d{2}$/.test(str);
},
PL: function PL(str) {
return /^(PL)?(\d{10}|(\d{3}-\d{3}-\d{2}-\d{2})|(\d{3}-\d{2}-\d{2}-\d{3}))$/.test(str);
},
PT: PT,
RO: function RO(str) {
return /^(RO)?\d{2,10}$/.test(str);
},
SK: function SK(str) {
return /^(SK)?\d{10}$/.test(str);
},
SI: function SI(str) {
return /^(SI)?\d{8}$/.test(str);
},
ES: function ES(str) {
return /^(ES)?\w\d{7}[A-Z]$/.test(str);
},
SE: function SE(str) {
return /^(SE)?\d{12}$/.test(str);
},
/**
* VAT numbers of non-EU countries
*/
AL: function AL(str) {
return /^(AL)?\w{9}[A-Z]$/.test(str);
},
MK: function MK(str) {
return /^(MK)?\d{13}$/.test(str);
},
AU: function AU(str) {
return /^(AU)?\d{11}$/.test(str);
},
BY: function BY(str) {
return /^(УНП )?\d{9}$/.test(str);
},
CA: function CA(str) {
return /^(CA)?\d{9}$/.test(str);
},
IS: function IS(str) {
return /^(IS)?\d{5,6}$/.test(str);
},
IN: function IN(str) {
return /^(IN)?\d{15}$/.test(str);
},
ID: function ID(str) {
return /^(ID)?(\d{15}|(\d{2}.\d{3}.\d{3}.\d{1}-\d{3}.\d{3}))$/.test(str);
},
IL: function IL(str) {
return /^(IL)?\d{9}$/.test(str);
},
KZ: function KZ(str) {
return /^(KZ)?\d{9}$/.test(str);
},
NZ: function NZ(str) {
return /^(NZ)?\d{9}$/.test(str);
},
NG: function NG(str) {
return /^(NG)?(\d{12}|(\d{8}-\d{4}))$/.test(str);
},
NO: function NO(str) {
return /^(NO)?\d{9}MVA$/.test(str);
},
PH: function PH(str) {
return /^(PH)?(\d{12}|\d{3} \d{3} \d{3} \d{3})$/.test(str);
},
RU: function RU(str) {
return /^(RU)?(\d{10}|\d{12})$/.test(str);
},
SM: function SM(str) {
return /^(SM)?\d{5}$/.test(str);
},
SA: function SA(str) {
return /^(SA)?\d{15}$/.test(str);
},
RS: function RS(str) {
return /^(RS)?\d{9}$/.test(str);
},
CH: function CH(str) {
return /^(CH)?(\d{6}|\d{9}|(\d{3}.\d{3})|(\d{3}.\d{3}.\d{3}))(TVA|MWST|IVA)$/.test(str);
},
TR: function TR(str) {
return /^(TR)?\d{10}$/.test(str);
},
UA: function UA(str) {
return /^(UA)?\d{12}$/.test(str);
},
GB: function GB(str) {
return /^GB((\d{3} \d{4} ([0-8][0-9]|9[0-6]))|(\d{9} \d{3})|(((GD[0-4])|(HA[5-9]))[0-9]{2}))$/.test(str);
},
UZ: function UZ(str) {
return /^(UZ)?\d{9}$/.test(str);
},
/**
* VAT numbers of Latin American countries
*/
AR: function AR(str) {
return /^(AR)?\d{11}$/.test(str);
},
BO: function BO(str) {
return /^(BO)?\d{7}$/.test(str);
},
BR: function BR(str) {
return /^(BR)?((\d{2}.\d{3}.\d{3}\/\d{4}-\d{2})|(\d{3}.\d{3}.\d{3}-\d{2}))$/.test(str);
},
CL: function CL(str) {
return /^(CL)?\d{8}-\d{1}$/.test(str);
},
CO: function CO(str) {
return /^(CO)?\d{10}$/.test(str);
},
CR: function CR(str) {
return /^(CR)?\d{9,12}$/.test(str);
},
EC: function EC(str) {
return /^(EC)?\d{13}$/.test(str);
},
SV: function SV(str) {
return /^(SV)?\d{4}-\d{6}-\d{3}-\d{1}$/.test(str);
},
GT: function GT(str) {
return /^(GT)?\d{7}-\d{1}$/.test(str);
},
HN: function HN(str) {
return /^(HN)?$/.test(str);
},
MX: function MX(str) {
return /^(MX)?\w{3,4}\d{6}\w{3}$/.test(str);
},
NI: function NI(str) {
return /^(NI)?\d{3}-\d{6}-\d{4}\w{1}$/.test(str);
},
PA: function PA(str) {
return /^(PA)?$/.test(str);
},
PY: function PY(str) {
return /^(PY)?\d{6,8}-\d{1}$/.test(str);
},
PE: function PE(str) {
return /^(PE)?\d{11}$/.test(str);
},
DO: function DO(str) {
return /^(DO)?(\d{11}|(\d{3}-\d{7}-\d{1})|[1,4,5]{1}\d{8}|([1,4,5]{1})-\d{2}-\d{5}-\d{1})$/.test(str);
},
UY: function UY(str) {
return /^(UY)?\d{12}$/.test(str);
},
VE: function VE(str) {
return /^(VE)?[J,G,V,E]{1}-(\d{9}|(\d{8}-\d{1}))$/.test(str);
}
};

@@ -26,3 +263,3 @@ exports.vatMatchers = vatMatchers;

if (countryCode in vatMatchers) {
return vatMatchers[countryCode].test(str);
return vatMatchers[countryCode](str);
}

@@ -29,0 +266,0 @@

@@ -19,3 +19,3 @@ "use strict";

return pattern.test(str);
return !!str.match(pattern);
}

@@ -22,0 +22,0 @@

{
"name": "validator",
"description": "String validation and sanitization",
"version": "13.7.0",
"version": "13.9.0",
"sideEffects": false,

@@ -69,3 +69,3 @@ "homepage": "https://github.com/validatorjs/validator.js",

"pretest": "npm run build && npm run lint",
"test": "nyc --reporter=cobertura --reporter=text-summary mocha --require @babel/register --reporter dot"
"test": "nyc --reporter=cobertura --reporter=text-summary mocha --require @babel/register --reporter dot --recursive"
},

@@ -72,0 +72,0 @@ "engines": {

# validator.js
[![NPM version][npm-image]][npm-url]

@@ -9,3 +8,4 @@ [![CI][ci-image]][ci-url]

[![Sponsors on Open Collective](https://opencollective.com/validatorjs/sponsors/badge.svg)](#sponsors)
[![Gitter](https://badges.gitter.im/validatorjs/community.svg)](https://gitter.im/validatorjs/community)
[![Gitter][gitter-image]][gitter-url]
[![Disclose a vulnerability][huntr-image]][huntr-url]

@@ -92,69 +92,71 @@ A library of string validators and sanitizers.

--------------------------------------- | --------------------------------------
**contains(str, seed [, options ])** | check if the string contains the seed.<br/><br/>`options` is an object that defaults to `{ ignoreCase: false, minOccurrences: 1 }`.<br />Options: <br/> `ignoreCase`: Ignore case when doing comparison, default false<br/>`minOccurences`: Minimum number of occurrences for the seed in the string. Defaults to 1.
**contains(str, seed [, options])** | check if the string contains the seed.<br/><br/>`options` is an object that defaults to `{ ignoreCase: false, minOccurrences: 1 }`.<br />Options: <br/> `ignoreCase`: Ignore case when doing comparison, default false.<br/>`minOccurences`: Minimum number of occurrences for the seed in the string. Defaults to 1.
**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).<br/><br/>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', 'fi-FI', 'fr-CA', 'fr-FR', 'he', 'hi-IN', '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).<br/><br/>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', 'fi-FI', 'fr-CA', 'fr-FR', 'he', 'hi-IN', '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.
**isAfter(str [, options])** | check if the string is a date that is after the specified date.<br/><br/>`options` is an object that defaults to `{ comparisonDate: Date().toString() }`.<br/>**Options:**<br/>`comparisonDate`: Date to compare to. Defaults to `Date().toString()` (now).
**isAlpha(str [, locale, options])** | check if the string contains only letters (a-zA-Z).<br/><br/>`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', 'bn', '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', 'fi-FI', 'fr-CA', 'fr-FR', 'he', 'hi-IN', 'hu-HU', 'it-IT', 'ko-KR', 'ja-JP', 'ku-IQ', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'si-LK', 'sl-SI', 'sk-SK', 'sr-RS', 'sr-RS@latin', 'sv-SE', 'th-TH', '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).<br/><br/>`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', 'bn', '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', 'fi-FI', 'fr-CA', 'fr-FR', 'he', 'hi-IN', 'hu-HU', 'it-IT', 'ko-KR', 'ja-JP','ku-IQ', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'si-LK', 'sl-SI', 'sk-SK', 'sr-RS', 'sr-RS@latin', 'sv-SE', 'th-TH', '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}`<br/> when `urlSafe` is true it tests the given base64 encoded string is [url safe](https://base64.guru/standards/base64url)
**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 [, options])** | check if a string is a boolean.<br/>`options` is an object which defaults to `{ loose: false }`. If loose is is set to false, the validator will strictly match ['true', 'false', '0', '1']. If loose is set to true, the validator will also match 'yes', 'no', and will match a valid boolean string of any case. (eg: ['true', 'True', 'TRUE']).
**isBase32(str [, options])** | check if the string is base32 encoded. `options` is optional and defaults to `{ crockford: false }`.<br/> When `crockford` is true it tests the given base32 encoded string using [Crockford's base32 alternative][Crockford Base32].
**isBase58(str)** | check if the string is base58 encoded.
**isBase64(str [, options])** | check if the string is base64 encoded. `options` is optional and defaults to `{ urlSafe: false }`<br/> when `urlSafe` is true it tests the given base64 encoded string is [url safe][Base64 URL Safe].
**isBefore(str [, date])** | check if the string is a date that is before the specified date.
**isBIC(str)** | check if the string is a BIC (Bank Identification Code) or SWIFT code.
**isBoolean(str [, options])** | check if the string is a boolean.<br/>`options` is an object which defaults to `{ loose: false }`. If `loose` is is set to false, the validator will strictly match ['true', 'false', '0', '1']. If `loose` is set to true, the validator will also match 'yes', 'no', and will match a valid boolean string of any case. (e.g.: ['true', 'True', 'TRUE']).
**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.<br/><br/>`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.<br/><br/>`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}`.<br/>**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](https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs).
**isDate(input [, options])** | Check if the input is a valid date. e.g. [`2002-07-15`, new Date()].<br/><br/> `options` is an object which can contain the keys `format`, `strictMode` and/or `delimiters`<br/><br/>`format` is a string and defaults to `YYYY/MM/DD`.<br/><br/>`strictMode` is a boolean and defaults to `false`. If `strictMode` is set to true, the validator will reject inputs different from `format`.<br/><br/> `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.<br/><br/>`options` is an object which defaults to `{force_decimal: false, decimal_digits: '1,', locale: 'en-US'}`<br/><br/>`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']`.<br/>**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.<br/><br/>`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: '', host_blacklist: [] }`. 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` receives a string, then the validator will reject emails that include any of the characters in the string, in the name part. If `host_blacklist` is set to an array of strings and the part of the email after the `@` symbol matches one of the strings defined in it, the validation fails.
**isEmpty(str [, options])** | check if the string has a length of zero.<br/><br/>`options` is an object which defaults to `{ ignore_whitespace:false }`.
**isEthereumAddress(str)** | check if the string is an [Ethereum](https://ethereum.org/) address using basic regex. Does not validate address checksums.
**isFloat(str [, options])** | check if the string is a float.<br/><br/>`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.<br/><br/>`min` and `max` are equivalent to 'greater or equal' and 'less or equal', respectively while `gt` and `lt` are their strict counterparts.<br/><br/>`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).<br/><br/>`options` is an object which defaults to `{ require_tld: true, allow_underscores: false, allow_trailing_dot: false, allow_numeric_tld: false, allow_wildcard: false }`. If `allow_wildcard` is set to true, the validator will allow domain starting with `*.` (e.g. `*.example.com` or `*.shop.example.com`).
**isByteLength(str [, options])** | check if the string's length (in UTF-8 bytes) falls in a range.<br/><br/>`options` is an object which defaults to `{ min: 0, max: undefined }`.
**isCreditCard(str [, options])** | check if the string is a credit card number.<br/><br/> `options` is an optional object that can be supplied with the following key(s): `provider` is an optional key whose value should be a string, and defines the company issuing the credit card. Valid values include `['amex', 'dinersclub', 'discover', 'jcb', 'mastercard', 'unionpay', 'visa']` or blank will check for any provider.
**isCurrency(str [, options])** | check if the string is a valid currency amount.<br/><br/>`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 }`.<br/>**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][Data URI Format].
**isDate(str [, options])** | check if the string is a valid date. e.g. [`2002-07-15`, new Date()].<br/><br/> `options` is an object which can contain the keys `format`, `strictMode` and/or `delimiters`.<br/><br/>`format` is a string and defaults to `YYYY/MM/DD`.<br/><br/>`strictMode` is a boolean and defaults to `false`. If `strictMode` is set to true, the validator will reject strings different from `format`.<br/><br/> `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.<br/><br/>`options` is an object which defaults to `{force_decimal: false, decimal_digits: '1,', locale: 'en-US'}`.<br/><br/>`locale` determines 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']`.<br/>**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 is divisible by another.
**isEAN(str)** | check if the string is an [EAN (European Article Number)][European Article Number].
**isEmail(str [, options])** | check if the string is an email.<br/><br/>`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: '', host_blacklist: [] }`. 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, email addresses without a 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` receives a string, then the validator will reject emails that include any of the characters in the string, in the name part. If `host_blacklist` is set to an array of strings and the part of the email after the `@` symbol matches one of the strings defined in it, the validation fails. If `host_whitelist` is set to an array of strings and the part of the email after the `@` symbol matches none of the strings defined in it, the validation fails.
**isEmpty(str [, options])** | check if the string has a length of zero.<br/><br/>`options` is an object which defaults to `{ ignore_whitespace: false }`.
**isEthereumAddress(str)** | check if the string is an [Ethereum][Ethereum] address. Does not validate address checksums.
**isFloat(str [, options])** | check if the string is a float.<br/><br/>`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.<br/><br/>`min` and `max` are equivalent to 'greater or equal' and 'less or equal', respectively while `gt` and `lt` are their strict counterparts.<br/><br/>`locale` determines 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).<br/><br/>`options` is an object which defaults to `{ require_tld: true, allow_underscores: false, allow_trailing_dot: false, allow_numeric_tld: false, allow_wildcard: false, ignore_max_length: false }`. If `allow_wildcard` is set to true, the validator will allow domain starting with `*.` (e.g. `*.example.com` or `*.shop.example.com`).
**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.<br/><br/>Algorithm is one of `['md4', 'md5', 'sha1', 'sha256', 'sha384', 'sha512', 'ripemd128', 'ripemd160', 'tiger128', 'tiger160', 'tiger192', 'crc32', 'crc32b']`
**isHash(str, algorithm)** | check if the string is a hash of type algorithm.<br/><br/>Algorithm is one of `['crc32', 'crc32b', 'md4', 'md5', 'ripemd128', 'ripemd160', 'sha1', 'sha256', 'sha384', 'sha512', 'tiger128', 'tiger160', 'tiger192']`.
**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](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).<br/><br/>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.<br/><br/>`locale` is one of `['LK', 'PL', 'ES', 'FI', 'IN', 'IT', 'IR', 'MZ', 'NO', 'TH', '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.<br/><br/>Defaults to 'any'.
**isIMEI(str [, options]))** | check if the string is a valid IMEI number. Imei should be of format `###############` or `##-######-######-#`.<br/><br/>`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.
**isHSL(str)** | check if the string is an HSL (hue, saturation, lightness, optional alpha) color based on [CSS Colors Level 4 specification][CSS Colors Level 4 Specification].<br/><br/>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 the string is an IBAN (International Bank Account Number).
**isIdentityCard(str [, locale])** | check if the string is a valid identity card code.<br/><br/>`locale` is one of `['LK', 'PL', 'ES', 'FI', 'IN', 'IT', 'IR', 'MZ', 'NO', 'TH', 'zh-TW', 'he-IL', 'ar-LY', 'ar-TN', 'zh-CN', 'zh-HK']` OR `'any'`. If 'any' is used, function will check if any of the locales match.<br/><br/>Defaults to 'any'.
**isIMEI(str [, options]))** | check if the string is a valid [IMEI number][IMEI]. IMEI should be of format `###############` or `##-######-######-#`.<br/><br/>`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 an array of allowed values.
**isInt(str [, options])** | check if the string is an integer.<br/><br/>`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 [, version])** | check if the string is an IP Range (version 4 or 6).
**isISBN(str [, version])** | check if the string is an ISBN (version 10 or 13).
**isISBN(str [, options])** | check if the string is an [ISBN][ISBN].<br/><br/>`options` is an object that has no default.<br/>**Options:**<br/>`version`: ISBN version to compare to. Accepted values are '10' and '13'. If none provided, both will be tested.
**isISIN(str)** | check if the string is an [ISIN][ISIN] (stock/security identifier).
**isISO8601(str)** | check if the string is a valid [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date. <br/>`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](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) officially assigned country code.
**isISO31661Alpha3(str)** | check if the string is a valid [ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) officially assigned country code.
**isISO4217(str)** | check if the string is a valid [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) officially assigned currency code.
**isISRC(str)** | check if the string is a [ISRC](https://en.wikipedia.org/wiki/International_Standard_Recording_Code).
**isISSN(str [, options])** | check if the string is an [ISSN](https://en.wikipedia.org/wiki/International_Standard_Serial_Number).<br/><br/>`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.
**isISO6391(str)** | check if the string is a valid [ISO 639-1][ISO 639-1] language code.
**isISO8601(str [, options])** | check if the string is a valid [ISO 8601][ISO 8601] date. <br/>`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][ISO 3166-1 alpha-2] officially assigned country code.
**isISO31661Alpha3(str)** | check if the string is a valid [ISO 3166-1 alpha-3][ISO 3166-1 alpha-3] officially assigned country code.
**isISO4217(str)** | check if the string is a valid [ISO 4217][ISO 4217] officially assigned currency code.
**isISRC(str)** | check if the string is an [ISRC][ISRC].
**isISSN(str [, options])** | check if the string is an [ISSN][ISSN].<br/><br/>`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).<br/><br/>`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`.<br/><br/>`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.<br/><br/>`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.<br/><br/>(locale is one of `['cs-CZ', 'de-DE', 'de-LI', 'fi-FI', pt-PT', 'sq-AL', 'pt-BR']` or `any`)
**isLocale(str)** | check if the string is a locale
**isLength(str [, options])** | check if the string's length falls in a range.<br/><br/>`options` is an object which defaults to `{ min: 0, max: undefined }`. Note: this function takes into account surrogate pairs.
**isLicensePlate(str, locale)** | check if the string matches the format of a country's license plate.<br/><br/>`locale` is one of `['cs-CZ', 'de-DE', 'de-LI', 'en-IN', 'es-AR', 'hu-HU', 'pt-BR', 'pt-PT', 'sq-AL', 'sv-SE']` 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.<br/><br/>`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](https://en.wikipedia.org/wiki/Magnet_URI_scheme).
**isLuhnNumber(str)** | check if the string passes the [Luhn algorithm check](https://en.wikipedia.org/wiki/Luhn_algorithm).
**isMACAddress(str [, options])** | check if the string is a MAC address.<br/><br/>`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'. The options also allow a `eui` property to specify if it needs to be validated against EUI-48 or EUI-64. The accepted values of `eui` are: 48, 64.
**isMagnetURI(str)** | check if the string is a [Magnet URI format][Magnet URI Format].
**isMD5(str)** | check if the string is a MD5 hash.<br/><br/>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](https://en.wikipedia.org/wiki/Media_type) format
**isMobilePhone(str [, locale [, options]])** | check if the string is a mobile phone number,<br/><br/>(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-PS', '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', 'dv-MV', 'el-GR', 'en-AU', 'en-BM', 'en-BW', 'en-CA', 'en-GB', 'en-GG', 'en-GH', 'en-GY', 'en-HK', 'en-MO', 'en-IE', 'en-IN', 'en-KE', 'en-KI', '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-CU', 'es-DO', 'es-HN', 'es-PE', 'es-EC', 'es-ES', 'es-MX', 'es-PA', 'es-PY', 'es-SV', 'es-UY', 'es-VE', 'et-EE', 'fa-IR', 'fi-FI', 'fj-FJ', 'fo-FO', 'fr-BE', 'fr-BF', 'fr-FR', 'fr-GF', 'fr-GP', 'fr-MQ', 'fr-PF', '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', ''mz-MZ', nb-NO', 'ne-NP', 'nl-BE', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'pt-AO', 'ro-RO', 'ru-RU', 'si-LK' 'sl-SI', 'sk-SK', 'sq-AL', 'sr-RS', 'sv-SE', 'tg-TJ', 'th-TH', 'tk-TM', 'tr-TR', 'uk-UA', 'uz-UZ', 'vi-VN', 'zh-CN', 'zh-HK', 'zh-MO', 'zh-TW', 'dz-BT']` OR defaults to 'any'. If 'any' or a falsey value is used, function will check if any of the locales match).<br/><br/>`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`.
**isMimeType(str)** | check if the string matches to a valid [MIME type][MIME Type] format.
**isMobilePhone(str [, locale [, options]])** | check if the string is a mobile phone number,<br/><br/>`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-EH', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-PS', 'ar-SA', 'ar-SY', 'ar-TN', 'ar-YE', 'az-AZ', 'az-LB', 'az-LY', 'be-BY', 'bg-BG', 'bn-BD', 'bs-BA', 'ca-AD', 'cs-CZ', 'da-DK', 'de-AT', 'de-CH', 'de-DE', 'de-LU', 'dv-MV', 'dz-BT', 'el-CY', 'el-GR', 'en-AG', 'en-AI', 'en-AU', 'en-BM', 'en-BS', 'en-BW', 'en-CA', 'en-GB', 'en-GG', 'en-GH', 'en-GY', 'en-HK', 'en-IE', 'en-IN', 'en-JM', 'en-KE', 'en-KI', 'en-KN', 'en-LS', 'en-MO', 'en-MT', 'en-MU', 'en-NG', 'en-NZ', 'en-PG', 'en-PH', 'en-PK', 'en-RW', 'en-SG', 'en-SL', 'en-SS', 'en-TZ', 'en-UG', 'en-US', 'en-ZA', 'en-ZM', 'en-ZW', 'es-AR', 'es-BO', 'es-CL', 'es-CO', 'es-CR', 'es-CU', 'es-DO', 'es-EC', 'es-ES', 'es-HN', 'es-MX', 'es-NI', 'es-PA', 'es-PE', 'es-PY', 'es-SV', 'es-UY', 'es-VE', 'et-EE', 'fa-AF', 'fa-IR', 'fi-FI', 'fj-FJ', 'fo-FO', 'fr-BE', 'fr-BF', 'fr-BJ', 'fr-CD', 'fr-FR', 'fr-GF', 'fr-GP', 'fr-MQ', 'fr-PF', 'fr-RE', 'ga-IE', 'he-IL', 'hu-HU', 'id-ID', 'ir-IR', 'it-IT', 'it-SM', 'ja-JP', 'ka-GE', 'kk-KZ', 'kl-GL', 'ko-KR', 'ky-KG', 'lt-LT', 'mg-MG', 'mn-MN', 'ms-MY', 'my-MM', 'mz-MZ', 'nb-NO', 'ne-NP', 'nl-AW', 'nl-BE', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-AO', 'pt-BR', 'pt-PT', 'ro-Md', 'ro-RO', 'ru-RU', 'si-LK', 'sk-SK', 'sl-SI', 'sq-AL', 'sr-RS', 'sv-SE', 'tg-TJ', 'th-TH', 'tk-TM', '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).<br/><br/>`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][mongoid].
**isMultibyte(str)** | check if the string contains one or more multibyte chars.
**isNumeric(str [, options])** | check if the string contains only numbers.<br/><br/>`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 `.`).<br/><br/>`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']`.
**isNumeric(str [, options])** | check if the string contains only numbers.<br/><br/>`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 `.`).<br/><br/>`locale` determines 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.<br/><br/>(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', 'IR', 'ID', 'IS', 'IT', 'JP', 'KR', 'LT', 'LU', 'LV', 'LY', 'MT', 'MY', 'MZ', 'NL', 'PL', 'PT', 'RO', 'RU', 'SE', 'SL', 'SK', 'TR', 'UA', 'US' ]`.
**isPassportNumber(str, countryCode)** | check if the string is a valid passport number.<br/><br/>`countryCode` is one of `['AM', 'AR', 'AT', 'AU', 'AZ', 'BE', 'BG', 'BY', 'BR', 'CA', 'CH', 'CN', 'CY', 'CZ', 'DE', 'DK', 'DZ', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HR', 'HU', 'IE', 'IN', 'IR', 'ID', 'IS', 'IT', 'JM', 'JP', 'KR', 'KZ', 'LI', 'LT', 'LU', 'LV', 'LY', 'MT', 'MX', 'MY', 'MZ', 'NL', 'NZ', 'PH', 'PK', 'PL', 'PT', 'RO', 'RU', 'SE', 'SL', 'SK', 'TH', '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,<br/><br/>(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', 'KR', 'LI', 'LK', '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](https://tools.ietf.org/html/rfc3339) date.
**isPostalCode(str, locale)** | check if the string is a postal code.<br/><br/>`locale` is one of `['AD', 'AT', 'AU', 'AZ', 'BA', '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', 'KR', 'LI', 'LK', 'LT', 'LU', 'LV', 'MG', 'MT', 'MX', 'MY', 'NL', 'NO', 'NP', 'NZ', 'PL', 'PR', 'PT', 'RO', 'RU', 'SA', 'SE', 'SG', 'SI', 'SK', 'TH', 'TN', 'TW', 'UA', 'US', 'ZA', 'ZM']` OR `'any'`. If 'any' is used, function will check if any of the locales match. Locale list is `validator.isPostalCodeLocales`.
**isRFC3339(str)** | check if the string is a valid [RFC 3339][RFC 3339] date.
**isRgbColor(str [, includePercentValues])** | check if the string is a rgb or rgba color.<br/><br/>`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.

@@ -164,11 +166,12 @@ **isSemVer(str)** | check if the string is a Semantic Versioning Specification (SemVer).

**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.<br/>Default options: <br/>`{ 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`.<br/><br/>More info about exact TIN support can be found in `src/lib/isTaxID.js`<br/><br/>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.<br/><br/>`options` is an object which defaults to `{ protocols: ['http','https','ftp'], require_tld: true, require_protocol: false, require_host: true, require_port: false, require_valid_protocol: true, allow_underscores: false, host_whitelist: false, host_blacklist: false, allow_trailing_dot: false, allow_protocol_relative_urls: false, allow_fragments: true, allow_query_components: true, disallow_auth: false, validate_length: true }`.<br/><br/>require_protocol - if set as true isURL will return false if protocol is not present in the URL.<br/>require_valid_protocol - isURL will check if the URL's protocol is present in the protocols option.<br/>protocols - valid protocols can be modified with this option.<br/>require_host - if set as false isURL will not check if host is present in the URL.<br/>require_port - if set as true isURL will check if port is present in the URL.<br/>allow_protocol_relative_urls - if set as true protocol relative URLs will be allowed.<br/>allow_fragments - if set as false isURL will return false if fragments are present.<br/>allow_query_components - if set as false isURL will return false if query components are present.<br/>validate_length - if set as false isURL will skip string length validation (2083 characters is IE max URL length).
**isSlug(str)** | check if the string is of type slug.
**isStrongPassword(str [, options])** | check if the string can be considered a strong password 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.<br/>Default options: <br/>`{ 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 }`
**isTime(str [, options])** | check if the string is a valid time e.g. [`23:01:59`, new Date().toLocaleTimeString()].<br/><br/> `options` is an object which can contain the keys `hourFormat` or `mode`.<br/><br/>`hourFormat` is a key and defaults to `'hour24'`.<br/><br/>`mode` is a key and defaults to `'default'`. <br/><br/>`hourFomat` can contain the values `'hour12'` or `'hour24'`, `'hour24'` will validate hours in 24 format and `'hour12'` will validate hours in 12 format. <br/><br/>`mode` can contain the values `'default'` or `'withSeconds'`, `'default'` will validate `HH:MM` format, `'withSeconds'` will validate the `HH:MM:SS` format.
**isTaxID(str, locale)** | check if the string is a valid Tax Identification Number. Default locale is `en-US`.<br/><br/>More info about exact TIN support can be found in `src/lib/isTaxID.js`.<br/><br/>Supported locales: `[ 'bg-BG', 'cs-CZ', 'de-AT', 'de-DE', 'dk-DK', 'el-CY', 'el-GR', 'en-CA', 'en-GB', 'en-IE', 'en-US', 'es-ES', 'et-EE', 'fi-FI', 'fr-BE', 'fr-CA', '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 a URL.<br/><br/>`options` is an object which defaults to `{ protocols: ['http','https','ftp'], require_tld: true, require_protocol: false, require_host: true, require_port: false, require_valid_protocol: true, allow_underscores: false, host_whitelist: false, host_blacklist: false, allow_trailing_dot: false, allow_protocol_relative_urls: false, allow_fragments: true, allow_query_components: true, disallow_auth: false, validate_length: true }`.<br/><br/>`require_protocol` - if set to true isURL will return false if protocol is not present in the URL.<br/>`require_valid_protocol` - isURL will check if the URL's protocol is present in the protocols option.<br/>`protocols` - valid protocols can be modified with this option.<br/>`require_host` - if set to false isURL will not check if host is present in the URL.<br/>`require_port` - if set to true isURL will check if port is present in the URL.<br/>`allow_protocol_relative_urls` - if set to true protocol relative URLs will be allowed.<br/>`allow_fragments` - if set to false isURL will return false if fragments are present.<br/>`allow_query_components` - if set to false isURL will return false if query components are present.<br/>`validate_length` - if set to 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 1, 2, 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](https://en.wikipedia.org/wiki/VAT_identification_number) if validation is available for the given country code matching [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). <br/><br/>Available country codes: `[ 'GB', 'IT','NL' ]`.
**isWhitelisted(str, chars)** | checks characters if they appear in the whitelist.
**matches(str, pattern [, modifiers])** | check if string matches the pattern.<br/><br/>Either `matches('foo', /foo/i)` or `matches('foo', 'foo', 'i')`.
**isVAT(str, countryCode)** | check if the string is a [valid VAT number][VAT Number] if validation is available for the given country code matching [ISO 3166-1 alpha-2][ISO 3166-1 alpha-2]. <br/><br/>`countryCode` is one of `['AL', 'AR', 'AT', 'AU', 'BE', 'BG', 'BO', 'BR', 'BY', 'CA', 'CH', 'CL', 'CO', 'CR', 'CY', 'CZ', 'DE', 'DK', 'DO', 'EC', 'EE', 'EL', 'ES', 'FI', 'FR', 'GB', 'GT', 'HN', 'HR', 'HU', 'ID', 'IE', 'IL', 'IN', 'IS', 'IT', 'KZ', 'LT', 'LU', 'LV', 'MK', 'MT', 'MX', 'NG', 'NI', 'NL', 'NO', 'NZ', 'PA', 'PE', 'PH', 'PL', 'PT', 'PY', 'RO', 'RS', 'RU', 'SA', 'SE', 'SI', 'SK', 'SM', 'SV', 'TR', 'UA', 'UY', 'UZ', 'VE']`.
**isWhitelisted(str, chars)** | check if the string consists only of characters that appear in the whitelist `chars`.
**matches(str, pattern [, modifiers])** | check if the string matches the pattern.<br/><br/>Either `matches('foo', /foo/i)` or `matches('foo', 'foo', 'i')`.

@@ -184,3 +187,3 @@ ## Sanitizers

**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)<br/><br/>`options` is an object with the following keys and default values:<br/><ul><li>*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.</li><li>*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.</li><li>*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).</li><li>*gmail_remove_subaddress: true*: Normalizes addresses by removing "sub-addresses", which is the part following a "+" sign (e.g. "foo+bar@gmail.com" becomes "foo@gmail.com").</li><li>*gmail_convert_googlemaildotcom: true*: Converts addresses with domain @googlemail.com to @gmail.com, as they're equivalent.</li><li>*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.</li><li>*outlookdotcom_remove_subaddress: true*: Normalizes addresses by removing "sub-addresses", which is the part following a "+" sign (e.g. "foo+bar@outlook.com" becomes "foo@outlook.com").</li><li>*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.</li><li>*yahoo_remove_subaddress: true*: Normalizes addresses by removing "sub-addresses", which is the part following a "-" sign (e.g. "foo-bar@yahoo.com" becomes "foo@yahoo.com").</li><li>*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.</li><li>*icloud_remove_subaddress: true*: Normalizes addresses by removing "sub-addresses", which is the part following a "+" sign (e.g. "foo+bar@icloud.com" becomes "foo@icloud.com").</li></ul>
**normalizeEmail(email [, options])** | canonicalize an email address. (This doesn't validate that the input is an email, if you want to validate the email use isEmail beforehand).<br/><br/>`options` is an object with the following keys and default values:<br/><ul><li>*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 is case insensitive per RFC 1035.</li><li>*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.</li><li>*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).</li><li>*gmail_remove_subaddress: true*: Normalizes addresses by removing "sub-addresses", which is the part following a "+" sign (e.g. "foo+bar@gmail.com" becomes "foo@gmail.com").</li><li>*gmail_convert_googlemaildotcom: true*: Converts addresses with domain @googlemail.com to @gmail.com, as they're equivalent.</li><li>*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.</li><li>*outlookdotcom_remove_subaddress: true*: Normalizes addresses by removing "sub-addresses", which is the part following a "+" sign (e.g. "foo+bar@outlook.com" becomes "foo@outlook.com").</li><li>*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.</li><li>*yahoo_remove_subaddress: true*: Normalizes addresses by removing "sub-addresses", which is the part following a "-" sign (e.g. "foo-bar@yahoo.com" becomes "foo@yahoo.com").</li><li>*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.</li><li>*icloud_remove_subaddress: true*: Normalizes addresses by removing "sub-addresses", which is the part following a "+" sign (e.g. "foo+bar@icloud.com" becomes "foo@icloud.com").</li></ul>
**rtrim(input [, chars])** | trim characters from the right-side of the input.

@@ -193,3 +196,3 @@ **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.

**trim(input [, chars])** | trim characters (whitespace by default) from both sides of the input.
**unescape(input)** | replaces HTML encoded entities with `<`, `>`, `&`, `'`, `"` and `/`.
**unescape(input)** | replace 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, '\\[\\]')`.

@@ -234,2 +237,4 @@

- [profnandaa](https://github.com/profnandaa) - **Anthony Nandaa**
- [ezkemboi](https://github.com/ezkemboi) - **Ezrqn Kemboi**
- [tux-tn](https://github.com/tux-tn) - **Sarhan Aissi**

@@ -276,6 +281,32 @@ ## Reading

[gitter-url]: https://gitter.im/validatorjs/community
[gitter-image]: https://badges.gitter.im/validatorjs/community.svg
[huntr-url]: https://huntr.dev/bounties/disclose/?target=https://github.com/validatorjs/validator.js
[huntr-image]: https://cdn.huntr.dev/huntr_security_badge_mono.svg
[amd]: http://requirejs.org/docs/whyamd.html
[bower]: http://bower.io/
[Crockford Base32]: http://www.crockford.com/base32.html
[Base64 URL Safe]: https://base64.guru/standards/base64url
[Data URI Format]: https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs
[European Article Number]: https://en.wikipedia.org/wiki/International_Article_Number
[Ethereum]: https://ethereum.org/
[CSS Colors Level 4 Specification]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
[IMEI]: https://en.wikipedia.org/wiki/International_Mobile_Equipment_Identity
[ISBN]: https://en.wikipedia.org/wiki/ISBN
[ISIN]: https://en.wikipedia.org/wiki/International_Securities_Identification_Number
[ISO 639-1]: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
[ISO 8601]: https://en.wikipedia.org/wiki/ISO_8601
[ISO 3166-1 alpha-2]: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
[ISO 3166-1 alpha-3]: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
[ISO 4217]: https://en.wikipedia.org/wiki/ISO_4217
[ISRC]: https://en.wikipedia.org/wiki/International_Standard_Recording_Code
[ISSN]: https://en.wikipedia.org/wiki/International_Standard_Serial_Number
[Luhn Check]: https://en.wikipedia.org/wiki/Luhn_algorithm
[Magnet URI Format]: https://en.wikipedia.org/wiki/Magnet_URI_scheme
[MIME Type]: https://en.wikipedia.org/wiki/Media_type
[mongoid]: http://docs.mongodb.org/manual/reference/object-id/
[ISIN]: https://en.wikipedia.org/wiki/International_Securities_Identification_Number
[RFC 3339]: https://tools.ietf.org/html/rfc3339
[VAT Number]: https://en.wikipedia.org/wiki/VAT_identification_number

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc