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.9.0 to 13.11.0

es/lib/isISO6346.js

7

es/index.js

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

import isBtcAddress from './lib/isBtcAddress';
import { isISO6346, isFreightContainerID } from './lib/isISO6346';
import isISO6391 from './lib/isISO6391';

@@ -81,2 +82,3 @@ import isISO8601 from './lib/isISO8601';

import isMagnetURI from './lib/isMagnetURI';
import isMailtoURI from './lib/isMailtoURI';
import isMimeType from './lib/isMimeType';

@@ -99,3 +101,3 @@ import isLatLong from './lib/isLatLong';

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

@@ -174,2 +176,4 @@ version: version,

isBtcAddress: isBtcAddress,
isISO6346: isISO6346,
isFreightContainerID: isFreightContainerID,
isISO6391: isISO6391,

@@ -186,2 +190,3 @@ isISO8601: isISO8601,

isMagnetURI: isMagnetURI,
isMailtoURI: isMailtoURI,
isMimeType: isMimeType,

@@ -188,0 +193,0 @@ isLatLong: isLatLong,

4

es/lib/alpha.js

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

'ru-RU': /^[А-ЯЁ]+$/i,
'kk-KZ': /^[А-ЯЁ\u04D8\u04B0\u0406\u04A2\u0492\u04AE\u049A\u04E8\u04BA]+$/i,
'sl-SI': /^[A-ZČĆĐŠŽ]+$/i,

@@ -61,2 +62,3 @@ 'sk-SK': /^[A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,

'ru-RU': /^[0-9А-ЯЁ]+$/i,
'kk-KZ': /^[0-9А-ЯЁ\u04D8\u04B0\u0406\u04A2\u0492\u04AE\u049A\u04E8\u04BA]+$/i,
'sl-SI': /^[0-9A-ZČĆĐŠŽ]+$/i,

@@ -122,3 +124,3 @@ 'sk-SK': /^[0-9A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,

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', 'si-LK', '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', 'kk-KZ', 'si-LK', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA', 'vi-VN'];

@@ -125,0 +127,0 @@ for (var _i4 = 0; _i4 < dotDecimal.length; _i4++) {

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

};
/* eslint-disable max-len */
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 */
var allCards = function () {
var tmpCardsArray = [];
for (var cardProvider in cards) {
// istanbul ignore else
if (cards.hasOwnProperty(cardProvider)) {
tmpCardsArray.push(cards[cardProvider]);
}
}
return tmpCardsArray;
}();
export default function isCreditCard(card) {

@@ -33,3 +42,5 @@ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

throw new Error("".concat(provider, " is not a valid credit card provider."));
} else if (!allCards.test(sanitized)) {
} else if (!allCards.some(function (cardProvider) {
return cardProvider.test(sanitized);
})) {
// no specific provider

@@ -36,0 +47,0 @@ return false;

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

return new Date("".concat(dateObj.m, "/").concat(dateObj.d, "/").concat(dateObj.y)).getDate() === +dateObj.d;
var fullYear = dateObj.y;
if (dateObj.y.length === 2) {
var parsedYear = parseInt(dateObj.y, 10);
if (isNaN(parsedYear)) {
return false;
}
var currentYearLastTwoDigits = new Date().getFullYear() % 100;
if (parsedYear < currentYearLastTwoDigits) {
fullYear = "20".concat(dateObj.y);
} else {
fullYear = "19".concat(dateObj.y);
}
}
return new Date("".concat(fullYear, "-").concat(dateObj.m, "-").concat(dateObj.d)).getDate() === +dateObj.d;
}

@@ -81,0 +99,0 @@

import assertString from './util/assertString';
import merge from './util/merge';
import isByteLength from './isByteLength';
import isFQDN from './isFQDN';
import isIP from './isIP';
import merge from './util/merge';
var default_email_options = {
allow_display_name: false,
allow_underscores: false,
require_display_name: false,

@@ -24,3 +25,3 @@ allow_utf8_local_part: true,

var quotedEmailUser = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i;
var emailUserUtf8Part = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i;
var emailUserUtf8Part = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A1-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i;
var quotedEmailUserUtf8 = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i;

@@ -149,3 +150,4 @@ var defaultMaxEmailLength = 254;

require_tld: options.require_tld,
ignore_max_length: options.ignore_max_length
ignore_max_length: options.ignore_max_length,
allow_underscores: options.allow_underscores
})) {

@@ -152,0 +154,0 @@ if (!options.allow_ip_domain) {

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

LV: /^(LV[0-9]{2})[A-Z]{4}[A-Z0-9]{13}$/,
MA: /^(MA[0-9]{26})$/,
MC: /^(MC[0-9]{2})\d{10}[A-Z0-9]{11}\d{2}$/,

@@ -90,2 +91,21 @@ MD: /^(MD[0-9]{2})[A-Z0-9]{20}$/,

/**
* Check if the country codes passed are valid using the
* ibanRegexThroughCountryCode as a reference
*
* @param {array} countryCodeArray
* @return {boolean}
*/
function hasOnlyValidCountryCodes(countryCodeArray) {
var countryCodeArrayFilteredWithObjectIbanCode = countryCodeArray.filter(function (countryCode) {
return !(countryCode in ibanRegexThroughCountryCode);
});
if (countryCodeArrayFilteredWithObjectIbanCode.length > 0) {
return false;
}
return true;
}
/**
* Check whether string has correct universal IBAN format

@@ -99,10 +119,34 @@ * The IBAN consists of up to 34 alphanumeric characters, as follows:

* @param {string} str - string under validation
* @param {object} options - object to pass the countries to be either whitelisted or blacklisted
* @return {boolean}
*/
function hasValidIbanFormat(str) {
function hasValidIbanFormat(str, options) {
// Strip white spaces and hyphens
var strippedStr = str.replace(/[\s\-]+/gi, '').toUpperCase();
var isoCountryCode = strippedStr.slice(0, 2).toUpperCase();
return isoCountryCode in ibanRegexThroughCountryCode && ibanRegexThroughCountryCode[isoCountryCode].test(strippedStr);
var isoCountryCodeInIbanRegexCodeObject = (isoCountryCode in ibanRegexThroughCountryCode);
if (options.whitelist) {
if (!hasOnlyValidCountryCodes(options.whitelist)) {
return false;
}
var isoCountryCodeInWhiteList = options.whitelist.includes(isoCountryCode);
if (!isoCountryCodeInWhiteList) {
return false;
}
}
if (options.blacklist) {
var isoCountryCodeInBlackList = options.blacklist.includes(isoCountryCode);
if (isoCountryCodeInBlackList) {
return false;
}
}
return isoCountryCodeInIbanRegexCodeObject && ibanRegexThroughCountryCode[isoCountryCode].test(strippedStr);
}

@@ -138,5 +182,6 @@ /**

export default function isIBAN(str) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
assertString(str);
return hasValidIbanFormat(str) && hasValidIbanChecksum(str);
return hasValidIbanFormat(str, options) && hasValidIbanChecksum(str);
}
export var locales = Object.keys(ibanRegexThroughCountryCode);

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

if (len > 3 || len < 2) {
if (len !== 3) {
return false;

@@ -11,0 +11,0 @@ }

import assertString from './util/assertString';
var localeReg = /^[A-Za-z]{2,4}([_-]([A-Za-z]{4}|[\d]{3}))?([_-]([A-Za-z]{2}|[\d]{3}))?$/;
/*
= 3ALPHA ; selected ISO 639 codes
*2("-" 3ALPHA) ; permanently reserved
*/
var extlang = '([A-Za-z]{3}(-[A-Za-z]{3}){0,2})';
/*
= 2*3ALPHA ; shortest ISO 639 code
["-" extlang] ; sometimes followed by
; extended language subtags
/ 4ALPHA ; or reserved for future use
/ 5*8ALPHA ; or registered language subtag
*/
var language = "(([a-zA-Z]{2,3}(-".concat(extlang, ")?)|([a-zA-Z]{5,8}))");
/*
= 4ALPHA ; ISO 15924 code
*/
var script = '([A-Za-z]{4})';
/*
= 2ALPHA ; ISO 3166-1 code
/ 3DIGIT ; UN M.49 code
*/
var region = '([A-Za-z]{2}|\\d{3})';
/*
= 5*8alphanum ; registered variants
/ (DIGIT 3alphanum)
*/
var variant = '([A-Za-z0-9]{5,8}|(\\d[A-Z-a-z0-9]{3}))';
/*
= DIGIT ; 0 - 9
/ %x41-57 ; A - W
/ %x59-5A ; Y - Z
/ %x61-77 ; a - w
/ %x79-7A ; y - z
*/
var singleton = '(\\d|[A-W]|[Y-Z]|[a-w]|[y-z])';
/*
= singleton 1*("-" (2*8alphanum))
; Single alphanumerics
; "x" reserved for private use
*/
var extension = "(".concat(singleton, "(-[A-Za-z0-9]{2,8})+)");
/*
= "x" 1*("-" (1*8alphanum))
*/
var privateuse = '(x(-[A-Za-z0-9]{1,8})+)'; // irregular tags do not match the 'langtag' production and would not
// otherwise be considered 'well-formed'. These tags are all valid, but
// most are deprecated in favor of more modern subtags or subtag combination
var irregular = '((en-GB-oed)|(i-ami)|(i-bnn)|(i-default)|(i-enochian)|' + '(i-hak)|(i-klingon)|(i-lux)|(i-mingo)|(i-navajo)|(i-pwn)|(i-tao)|' + '(i-tay)|(i-tsu)|(sgn-BE-FR)|(sgn-BE-NL)|(sgn-CH-DE))'; // regular tags match the 'langtag' production, but their subtags are not
// extended language or variant subtags: their meaning is defined by
// their registration and all of these are deprecated in favor of a more
// modern subtag or sequence of subtags
var regular = '((art-lojban)|(cel-gaulish)|(no-bok)|(no-nyn)|(zh-guoyu)|' + '(zh-hakka)|(zh-min)|(zh-min-nan)|(zh-xiang))';
/*
= irregular ; non-redundant tags registered
/ regular ; during the RFC 3066 era
*/
var grandfathered = "(".concat(irregular, "|").concat(regular, ")");
/*
RFC 5646 defines delimitation of subtags via a hyphen:
"Subtag" refers to a specific section of a tag, delimited by a
hyphen, such as the subtags 'zh', 'Hant', and 'CN' in the tag "zh-
Hant-CN". Examples of subtags in this document are enclosed in
single quotes ('Hant')
However, we need to add "_" to maintain the existing behaviour.
*/
var delimiter = '(-|_)';
/*
= language
["-" script]
["-" region]
*("-" variant)
*("-" extension)
["-" privateuse]
*/
var langtag = "".concat(language, "(").concat(delimiter).concat(script, ")?(").concat(delimiter).concat(region, ")?(").concat(delimiter).concat(variant, ")*(").concat(delimiter).concat(extension, ")*(").concat(delimiter).concat(privateuse, ")?");
/*
Regex implementation based on BCP RFC 5646
Tags for Identifying Languages
https://www.rfc-editor.org/rfc/rfc5646.html
*/
var languageTagRegex = new RegExp("(^".concat(privateuse, "$)|(^").concat(grandfathered, "$)|(^").concat(langtag, "$)"));
export default function isLocale(str) {
assertString(str);
if (str === 'en_US_POSIX' || str === 'ca_ES_VALENCIA') {
return true;
}
return localeReg.test(str);
return languageTagRegex.test(str);
}

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

'ar-SA': /^(!?(\+?966)|0)?5\d{8}$/,
'ar-SD': /^((\+?249)|0)?(9[012369]|1[012])\d{7}$/,
'ar-SY': /^(!?(\+?963)|0)?9\d{8}$/,

@@ -52,2 +53,3 @@ 'ar-TN': /^(\+?216)?[2459]\d{7}$/,

'en-KE': /^(\+?254|0)(7|1)\d{8}$/,
'fr-CF': /^(\+?236| ?)(70|75|77|72|21|22)\d{6}$/,
'en-SS': /^(\+?211|0)(9[1257])\d{7}$/,

@@ -80,3 +82,3 @@ 'en-KI': /^((\+686|686)?)?( )?((6|7)(2|3|8)[0-9]{6})$/,

'es-CR': /^(\+506)?[2-8]\d{7}$/,
'es-CU': /^(\+53|0053)?5\d{7}/,
'es-CU': /^(\+53|0053)?5\d{7}$/,
'es-DO': /^(\+?1)?8[024]9\d{7}$/,

@@ -109,2 +111,3 @@ 'es-HN': /^(\+?504)?[9|8|3|2]\d{7}$/,

'fr-RE': /^(\+?262|0|00262)[67]\d{8}$/,
'fr-WF': /^(\+681)?\d{6}$/,
'he-IL': /^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/,

@@ -135,3 +138,3 @@ 'hu-HU': /^(\+?36|06)(20|30|31|50|70)\d{7}$/,

'nn-NO': /^(\+?47)?[49]\d{7}$/,
'pl-PL': /^(\+?48)? ?[5-8]\d ?\d{3} ?\d{2} ?\d{2}$/,
'pl-PL': /^(\+?48)? ?([5-8]\d|45) ?\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[1-9]{1}\d{3}\-?\d{4}))$/,

@@ -146,2 +149,3 @@ 'pt-PT': /^(\+?351)?9[1236]\d{7}$/,

'sk-SK': /^(\+?421)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,
'so-SO': /^(\+?252|0)((6[0-9])\d{7}|(7[1-9])\d{7})$/,
'sq-AL': /^(\+355|0)6[789]\d{6}$/,

@@ -148,0 +152,0 @@ 'sr-RS': /^(\+3816|06)[- \d]{5,9}$/,

import assertString from './util/assertString';
import * as algorithms from './util/algorithms';
var CH = function CH(str) {
// @see {@link https://www.ech.ch/de/ech/ech-0097/5.2.0}
var hasValidCheckNumber = function hasValidCheckNumber(digits) {
var lastDigit = digits.pop(); // used as check number
var weights = [5, 4, 3, 2, 7, 6, 5, 4];
var calculatedCheckNumber = (11 - digits.reduce(function (acc, el, idx) {
return acc + el * weights[idx];
}, 0) % 11) % 11;
return lastDigit === calculatedCheckNumber;
}; // @see {@link https://www.estv.admin.ch/estv/de/home/mehrwertsteuer/uid/mwst-uid-nummer.html}
return /^(CHE[- ]?)?(\d{9}|(\d{3}\.\d{3}\.\d{3})|(\d{3} \d{3} \d{3})) ?(TVA|MWST|IVA)?$/.test(str) && hasValidCheckNumber(str.match(/\d/g).map(function (el) {
return +el;
}));
};
var PT = function PT(str) {

@@ -164,5 +182,3 @@ var match = str.match(/^(PT)?(\d{9})$/);

},
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);
},
CH: CH,
TR: function TR(str) {

@@ -169,0 +185,0 @@ return /^(TR)?\d{10}$/.test(str);

@@ -146,6 +146,8 @@ "use strict";

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

@@ -157,3 +159,3 @@

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

@@ -170,2 +172,4 @@ var _isBase = _interopRequireDefault(require("./lib/isBase32"));

var _isMailtoURI = _interopRequireDefault(require("./lib/isMailtoURI"));
var _isMimeType = _interopRequireDefault(require("./lib/isMimeType"));

@@ -211,3 +215,3 @@

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

@@ -286,8 +290,10 @@ version: version,

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

@@ -298,2 +304,3 @@ isBase58: _isBase2.default,

isMagnetURI: _isMagnetURI.default,
isMailtoURI: _isMailtoURI.default,
isMimeType: _isMimeType.default,

@@ -300,0 +307,0 @@ isLatLong: _isLatLong.default,

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

'ru-RU': /^[А-ЯЁ]+$/i,
'kk-KZ': /^[А-ЯЁ\u04D8\u04B0\u0406\u04A2\u0492\u04AE\u049A\u04E8\u04BA]+$/i,
'sl-SI': /^[A-ZČĆĐŠŽ]+$/i,

@@ -68,2 +69,3 @@ 'sk-SK': /^[A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,

'ru-RU': /^[0-9А-ЯЁ]+$/i,
'kk-KZ': /^[0-9А-ЯЁ\u04D8\u04B0\u0406\u04A2\u0492\u04AE\u049A\u04E8\u04BA]+$/i,
'sl-SI': /^[0-9A-ZČĆĐŠŽ]+$/i,

@@ -136,3 +138,3 @@ 'sk-SK': /^[0-9A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,

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', 'si-LK', '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', 'kk-KZ', 'si-LK', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA', 'vi-VN'];
exports.commaDecimal = commaDecimal;

@@ -139,0 +141,0 @@

@@ -24,7 +24,16 @@ "use strict";

};
/* eslint-disable max-len */
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 */
var allCards = function () {
var tmpCardsArray = [];
for (var cardProvider in cards) {
// istanbul ignore else
if (cards.hasOwnProperty(cardProvider)) {
tmpCardsArray.push(cards[cardProvider]);
}
}
return tmpCardsArray;
}();
function isCreditCard(card) {

@@ -44,3 +53,5 @@ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

throw new Error("".concat(provider, " is not a valid credit card provider."));
} else if (!allCards.test(sanitized)) {
} else if (!allCards.some(function (cardProvider) {
return cardProvider.test(sanitized);
})) {
// no specific provider

@@ -47,0 +58,0 @@ return false;

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

return new Date("".concat(dateObj.m, "/").concat(dateObj.d, "/").concat(dateObj.y)).getDate() === +dateObj.d;
var fullYear = dateObj.y;
if (dateObj.y.length === 2) {
var parsedYear = parseInt(dateObj.y, 10);
if (isNaN(parsedYear)) {
return false;
}
var currentYearLastTwoDigits = new Date().getFullYear() % 100;
if (parsedYear < currentYearLastTwoDigits) {
fullYear = "20".concat(dateObj.y);
} else {
fullYear = "19".concat(dateObj.y);
}
}
return new Date("".concat(fullYear, "-").concat(dateObj.m, "-").concat(dateObj.d)).getDate() === +dateObj.d;
}

@@ -91,0 +109,0 @@

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

var _merge = _interopRequireDefault(require("./util/merge"));
var _isByteLength = _interopRequireDefault(require("./isByteLength"));

@@ -19,2 +17,4 @@

var _merge = _interopRequireDefault(require("./util/merge"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -24,2 +24,3 @@

allow_display_name: false,
allow_underscores: false,
require_display_name: false,

@@ -41,3 +42,3 @@ allow_utf8_local_part: true,

var quotedEmailUser = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i;
var emailUserUtf8Part = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i;
var emailUserUtf8Part = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A1-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i;
var quotedEmailUserUtf8 = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i;

@@ -166,3 +167,4 @@ var defaultMaxEmailLength = 254;

require_tld: options.require_tld,
ignore_max_length: options.ignore_max_length
ignore_max_length: options.ignore_max_length,
allow_underscores: options.allow_underscores
})) {

@@ -169,0 +171,0 @@ if (!options.allow_ip_domain) {

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

LV: /^(LV[0-9]{2})[A-Z]{4}[A-Z0-9]{13}$/,
MA: /^(MA[0-9]{26})$/,
MC: /^(MC[0-9]{2})\d{10}[A-Z0-9]{11}\d{2}$/,

@@ -100,2 +101,21 @@ MD: /^(MD[0-9]{2})[A-Z0-9]{20}$/,

/**
* Check if the country codes passed are valid using the
* ibanRegexThroughCountryCode as a reference
*
* @param {array} countryCodeArray
* @return {boolean}
*/
function hasOnlyValidCountryCodes(countryCodeArray) {
var countryCodeArrayFilteredWithObjectIbanCode = countryCodeArray.filter(function (countryCode) {
return !(countryCode in ibanRegexThroughCountryCode);
});
if (countryCodeArrayFilteredWithObjectIbanCode.length > 0) {
return false;
}
return true;
}
/**
* Check whether string has correct universal IBAN format

@@ -109,10 +129,34 @@ * The IBAN consists of up to 34 alphanumeric characters, as follows:

* @param {string} str - string under validation
* @param {object} options - object to pass the countries to be either whitelisted or blacklisted
* @return {boolean}
*/
function hasValidIbanFormat(str) {
function hasValidIbanFormat(str, options) {
// Strip white spaces and hyphens
var strippedStr = str.replace(/[\s\-]+/gi, '').toUpperCase();
var isoCountryCode = strippedStr.slice(0, 2).toUpperCase();
return isoCountryCode in ibanRegexThroughCountryCode && ibanRegexThroughCountryCode[isoCountryCode].test(strippedStr);
var isoCountryCodeInIbanRegexCodeObject = (isoCountryCode in ibanRegexThroughCountryCode);
if (options.whitelist) {
if (!hasOnlyValidCountryCodes(options.whitelist)) {
return false;
}
var isoCountryCodeInWhiteList = options.whitelist.includes(isoCountryCode);
if (!isoCountryCodeInWhiteList) {
return false;
}
}
if (options.blacklist) {
var isoCountryCodeInBlackList = options.blacklist.includes(isoCountryCode);
if (isoCountryCodeInBlackList) {
return false;
}
}
return isoCountryCodeInIbanRegexCodeObject && ibanRegexThroughCountryCode[isoCountryCode].test(strippedStr);
}

@@ -148,4 +192,5 @@ /**

function isIBAN(str) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
(0, _assertString.default)(str);
return hasValidIbanFormat(str) && hasValidIbanChecksum(str);
return hasValidIbanFormat(str, options) && hasValidIbanChecksum(str);
}

@@ -152,0 +197,0 @@

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

if (len > 3 || len < 2) {
if (len !== 3) {
return false;

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

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

var localeReg = /^[A-Za-z]{2,4}([_-]([A-Za-z]{4}|[\d]{3}))?([_-]([A-Za-z]{2}|[\d]{3}))?$/;
/*
= 3ALPHA ; selected ISO 639 codes
*2("-" 3ALPHA) ; permanently reserved
*/
var extlang = '([A-Za-z]{3}(-[A-Za-z]{3}){0,2})';
/*
= 2*3ALPHA ; shortest ISO 639 code
["-" extlang] ; sometimes followed by
; extended language subtags
/ 4ALPHA ; or reserved for future use
/ 5*8ALPHA ; or registered language subtag
*/
var language = "(([a-zA-Z]{2,3}(-".concat(extlang, ")?)|([a-zA-Z]{5,8}))");
/*
= 4ALPHA ; ISO 15924 code
*/
var script = '([A-Za-z]{4})';
/*
= 2ALPHA ; ISO 3166-1 code
/ 3DIGIT ; UN M.49 code
*/
var region = '([A-Za-z]{2}|\\d{3})';
/*
= 5*8alphanum ; registered variants
/ (DIGIT 3alphanum)
*/
var variant = '([A-Za-z0-9]{5,8}|(\\d[A-Z-a-z0-9]{3}))';
/*
= DIGIT ; 0 - 9
/ %x41-57 ; A - W
/ %x59-5A ; Y - Z
/ %x61-77 ; a - w
/ %x79-7A ; y - z
*/
var singleton = '(\\d|[A-W]|[Y-Z]|[a-w]|[y-z])';
/*
= singleton 1*("-" (2*8alphanum))
; Single alphanumerics
; "x" reserved for private use
*/
var extension = "(".concat(singleton, "(-[A-Za-z0-9]{2,8})+)");
/*
= "x" 1*("-" (1*8alphanum))
*/
var privateuse = '(x(-[A-Za-z0-9]{1,8})+)'; // irregular tags do not match the 'langtag' production and would not
// otherwise be considered 'well-formed'. These tags are all valid, but
// most are deprecated in favor of more modern subtags or subtag combination
var irregular = '((en-GB-oed)|(i-ami)|(i-bnn)|(i-default)|(i-enochian)|' + '(i-hak)|(i-klingon)|(i-lux)|(i-mingo)|(i-navajo)|(i-pwn)|(i-tao)|' + '(i-tay)|(i-tsu)|(sgn-BE-FR)|(sgn-BE-NL)|(sgn-CH-DE))'; // regular tags match the 'langtag' production, but their subtags are not
// extended language or variant subtags: their meaning is defined by
// their registration and all of these are deprecated in favor of a more
// modern subtag or sequence of subtags
var regular = '((art-lojban)|(cel-gaulish)|(no-bok)|(no-nyn)|(zh-guoyu)|' + '(zh-hakka)|(zh-min)|(zh-min-nan)|(zh-xiang))';
/*
= irregular ; non-redundant tags registered
/ regular ; during the RFC 3066 era
*/
var grandfathered = "(".concat(irregular, "|").concat(regular, ")");
/*
RFC 5646 defines delimitation of subtags via a hyphen:
"Subtag" refers to a specific section of a tag, delimited by a
hyphen, such as the subtags 'zh', 'Hant', and 'CN' in the tag "zh-
Hant-CN". Examples of subtags in this document are enclosed in
single quotes ('Hant')
However, we need to add "_" to maintain the existing behaviour.
*/
var delimiter = '(-|_)';
/*
= language
["-" script]
["-" region]
*("-" variant)
*("-" extension)
["-" privateuse]
*/
var langtag = "".concat(language, "(").concat(delimiter).concat(script, ")?(").concat(delimiter).concat(region, ")?(").concat(delimiter).concat(variant, ")*(").concat(delimiter).concat(extension, ")*(").concat(delimiter).concat(privateuse, ")?");
/*
Regex implementation based on BCP RFC 5646
Tags for Identifying Languages
https://www.rfc-editor.org/rfc/rfc5646.html
*/
var languageTagRegex = new RegExp("(^".concat(privateuse, "$)|(^").concat(grandfathered, "$)|(^").concat(langtag, "$)"));
function isLocale(str) {
(0, _assertString.default)(str);
if (str === 'en_US_POSIX' || str === 'ca_ES_VALENCIA') {
return true;
}
return localeReg.test(str);
return languageTagRegex.test(str);
}

@@ -24,0 +115,0 @@

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

'ar-SA': /^(!?(\+?966)|0)?5\d{8}$/,
'ar-SD': /^((\+?249)|0)?(9[012369]|1[012])\d{7}$/,
'ar-SY': /^(!?(\+?963)|0)?9\d{8}$/,

@@ -62,2 +63,3 @@ 'ar-TN': /^(\+?216)?[2459]\d{7}$/,

'en-KE': /^(\+?254|0)(7|1)\d{8}$/,
'fr-CF': /^(\+?236| ?)(70|75|77|72|21|22)\d{6}$/,
'en-SS': /^(\+?211|0)(9[1257])\d{7}$/,

@@ -90,3 +92,3 @@ 'en-KI': /^((\+686|686)?)?( )?((6|7)(2|3|8)[0-9]{6})$/,

'es-CR': /^(\+506)?[2-8]\d{7}$/,
'es-CU': /^(\+53|0053)?5\d{7}/,
'es-CU': /^(\+53|0053)?5\d{7}$/,
'es-DO': /^(\+?1)?8[024]9\d{7}$/,

@@ -119,2 +121,3 @@ 'es-HN': /^(\+?504)?[9|8|3|2]\d{7}$/,

'fr-RE': /^(\+?262|0|00262)[67]\d{8}$/,
'fr-WF': /^(\+681)?\d{6}$/,
'he-IL': /^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/,

@@ -145,3 +148,3 @@ 'hu-HU': /^(\+?36|06)(20|30|31|50|70)\d{7}$/,

'nn-NO': /^(\+?47)?[49]\d{7}$/,
'pl-PL': /^(\+?48)? ?[5-8]\d ?\d{3} ?\d{2} ?\d{2}$/,
'pl-PL': /^(\+?48)? ?([5-8]\d|45) ?\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[1-9]{1}\d{3}\-?\d{4}))$/,

@@ -156,2 +159,3 @@ 'pt-PT': /^(\+?351)?9[1236]\d{7}$/,

'sk-SK': /^(\+?421)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,
'so-SO': /^(\+?252|0)((6[0-9])\d{7}|(7[1-9])\d{7})$/,
'sq-AL': /^(\+355|0)6[789]\d{6}$/,

@@ -158,0 +162,0 @@ 'sr-RS': /^(\+3816|06)[- \d]{5,9}$/,

@@ -21,2 +21,20 @@ "use strict";

var CH = function CH(str) {
// @see {@link https://www.ech.ch/de/ech/ech-0097/5.2.0}
var hasValidCheckNumber = function hasValidCheckNumber(digits) {
var lastDigit = digits.pop(); // used as check number
var weights = [5, 4, 3, 2, 7, 6, 5, 4];
var calculatedCheckNumber = (11 - digits.reduce(function (acc, el, idx) {
return acc + el * weights[idx];
}, 0) % 11) % 11;
return lastDigit === calculatedCheckNumber;
}; // @see {@link https://www.estv.admin.ch/estv/de/home/mehrwertsteuer/uid/mwst-uid-nummer.html}
return /^(CHE[- ]?)?(\d{9}|(\d{3}\.\d{3}\.\d{3})|(\d{3} \d{3} \d{3})) ?(TVA|MWST|IVA)?$/.test(str) && hasValidCheckNumber(str.match(/\d/g).map(function (el) {
return +el;
}));
};
var PT = function PT(str) {

@@ -182,5 +200,3 @@ var match = str.match(/^(PT)?(\d{9})$/);

},
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);
},
CH: CH,
TR: function TR(str) {

@@ -187,0 +203,0 @@ return /^(TR)?\d{10}$/.test(str);

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

@@ -6,0 +6,0 @@ "homepage": "https://github.com/validatorjs/validator.js",

@@ -94,4 +94,4 @@ # validator.js

**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.
**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', 'kk-KZ', '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', 'kk-KZ', '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.

@@ -113,3 +113,3 @@ **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].

**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.
**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, allow_underscores: 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 }`.

@@ -119,2 +119,3 @@ **isEthereumAddress(str)** | check if the string is an [Ethereum][Ethereum] address. Does not validate address checksums.

**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`).
**isFreightContainerID(str)** | alias for `isISO6346`, check if the string is a valid [ISO 6346](https://en.wikipedia.org/wiki/ISO_6346) shipping container identification.
**isFullWidth(str)** | check if the string contains any full-width chars.

@@ -126,3 +127,3 @@ **isHalfWidth(str)** | check if the string contains any half-width chars.

**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).
**isIBAN(str, [, options])** | check if the string is an IBAN (International Bank Account Number).<br/><br/>`options` is an object which accepts two attributes: `whitelist`: where you can restrict IBAN codes you want to receive data from and `blacklist`: where you can remove some of the countries from the current list. For both you can use an array with the following values `['AD','AE','AL','AT','AZ','BA','BE','BG','BH','BR','BY','CH','CR','CY','CZ','DE','DK','DO','EE','EG','ES','FI','FO','FR','GB','GE','GI','GL','GR','GT','HR','HU','IE','IL','IQ','IR','IS','IT','JO','KW','KZ','LB','LC','LI','LT','LU','LV','MC','MD','ME','MK','MR','MT','MU','MZ','NL','NO','PK','PL','PS','PT','QA','RO','RS','SA','SC','SE','SI','SK','SM','SV','TL','TN','TR','UA','VA','VG','XK']`.
**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'.

@@ -136,2 +137,3 @@ **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.

**isISIN(str)** | check if the string is an [ISIN][ISIN] (stock/security identifier).
**isISO6346(str)** | check if the string is a valid [ISO 6346](https://en.wikipedia.org/wiki/ISO_6346) shipping container identification.
**isISO6391(str)** | check if the string is a valid [ISO 639-1][ISO 639-1] language code.

@@ -154,5 +156,6 @@ **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.

**isMagnetURI(str)** | check if the string is a [Magnet URI format][Magnet URI Format].
**isMailtoURI(str, [, options])** | check if the string is a [Magnet URI format][Mailto URI Format].<br/><br/>`options` is an object of validating emails inside the URI (check `isEmail`s options for details).
**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][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`.
**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-SD', '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-CF', 'fr-FR', 'fr-GF', 'fr-GP', 'fr-MQ', 'fr-PF', 'fr-RE', 'fr-WF', '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', 'so-SO', '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].

@@ -308,5 +311,6 @@ **isMultibyte(str)** | check if the string contains one or more multibyte chars.

[Magnet URI Format]: https://en.wikipedia.org/wiki/Magnet_URI_scheme
[Mailto URI Format]: https://en.wikipedia.org/wiki/Mailto
[MIME Type]: https://en.wikipedia.org/wiki/Media_type
[mongoid]: http://docs.mongodb.org/manual/reference/object-id/
[RFC 3339]: https://tools.ietf.org/html/rfc3339
[VAT Number]: https://en.wikipedia.org/wiki/VAT_identification_number
[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