From efff36bf87b4be5a70563c96e857b08961c93c7a Mon Sep 17 00:00:00 2001 From: SCG82 Date: Thu, 12 Jan 2023 22:39:02 +0000 Subject: [PATCH 01/12] allow esm imports --- .editorconfig | 13 +++ .eslintrc.json | 3 +- .gitattributes | 2 + build-browser.js | 8 +- package.json | 28 ++--- src/lib/alpha.js | 2 +- src/lib/isBase64.js | 6 +- src/lib/isCurrency.js | 4 +- src/lib/isDataURI.js | 4 +- src/lib/isDate.js | 4 +- src/lib/isEAN.js | 1 - src/lib/isEmail.js | 18 ++- src/lib/isFloat.js | 10 +- src/lib/isHSL.js | 2 - src/lib/isIBAN.js | 6 +- src/lib/isIMEI.js | 3 - src/lib/isIP.js | 20 ++-- src/lib/isIdentityCard.js | 17 ++- src/lib/isIn.js | 4 +- src/lib/isInt.js | 4 +- src/lib/isLicensePlate.js | 101 ++++++++--------- src/lib/isMobilePhone.js | 4 +- src/lib/isPassportNumber.js | 4 +- src/lib/isPostalCode.js | 2 +- src/lib/isRgbColor.js | 8 +- src/lib/isTaxID.js | 72 ++++++------ src/lib/isURL.js | 1 - src/lib/isVAT.js | 218 ++++++++++++++++++------------------ src/lib/util/algorithms.js | 6 +- src/lib/util/includes.js | 2 +- src/lib/util/merge.js | 1 + test/client-side.js | 3 +- test/exports.js | 3 +- test/sanitizers.js | 6 +- test/validators.js | 41 +++---- 35 files changed, 314 insertions(+), 317 deletions(-) create mode 100644 .editorconfig create mode 100644 .gitattributes diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..e69df2d3b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +max_line_length = 0 +trim_trailing_whitespace = false diff --git a/.eslintrc.json b/.eslintrc.json index 285c41e15..dbe36022a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,6 +1,7 @@ { "extends": "airbnb-base", - "parser": "babel-eslint", + "parser": "@babel/eslint-parser", + "plugins": ["node"], "parserOptions": { "ecmaVersion": 6, "sourceType": "module" diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..4cab1f4d2 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Set the default behavior, in case people don't have core.autocrlf set. +* text=auto diff --git a/build-browser.js b/build-browser.js index c863bd399..302382f6a 100644 --- a/build-browser.js +++ b/build-browser.js @@ -1,12 +1,12 @@ /* eslint import/no-extraneous-dependencies: 0 */ import fs from "fs"; import { rollup } from "rollup"; -import babel from "rollup-plugin-babel"; +import babel from "@rollup/plugin-babel"; import babelPresetEnv from "@babel/preset-env"; import pkg from "./package.json"; rollup({ - entry: "src/index.js", + input: "src/index.js", plugins: [ babel({ presets: [[babelPresetEnv, { modules: false }]], @@ -16,9 +16,9 @@ rollup({ }) .then((bundle) => bundle.write({ - dest: "validator.js", + file: "validator.js", format: "umd", - moduleName: pkg.name, + name: pkg.name, banner: `/*!\n${String(fs.readFileSync("./LICENSE")) .trim() .split("\n") diff --git a/package.json b/package.json index 7d505205e..45a050c66 100644 --- a/package.json +++ b/package.json @@ -3,13 +3,14 @@ "description": "String validation and sanitization", "version": "13.7.0", "sideEffects": false, + "type": "module", "homepage": "https://github.com/validatorjs/validator.js", "files": [ "index.js", "es", "lib", "README.md", - "LICENCE", + "LICENSE", "validator.js", "validator.min.js" ], @@ -36,22 +37,23 @@ "url": "git+https://github.com/validatorjs/validator.js.git" }, "devDependencies": { - "@babel/cli": "^7.0.0", - "@babel/core": "^7.0.0", - "@babel/preset-env": "^7.0.0", - "@babel/register": "^7.0.0", - "babel-eslint": "^10.0.1", - "babel-plugin-add-module-exports": "^1.0.0", - "eslint": "^4.19.1", - "eslint-config-airbnb-base": "^12.1.0", - "eslint-plugin-import": "^2.11.0", + "@babel/cli": "^7.20.7", + "@babel/core": "^7.20.12", + "@babel/eslint-parser": "^7.19.1", + "@babel/preset-env": "^7.20.2", + "@babel/register": "^7.18.9", + "@rollup/plugin-babel": "^6.0.3", + "babel-plugin-add-module-exports": "^1.0.4", + "eslint": "^8.31.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-plugin-import": "^2.27.4", + "eslint-plugin-node": "^11.1.0", "mocha": "^6.2.3", "npm-run-all": "^4.1.5", "nyc": "^14.1.0", "rimraf": "^3.0.0", - "rollup": "^0.47.0", - "rollup-plugin-babel": "^4.0.1", - "uglify-js": "^3.0.19" + "rollup": "^3.10.0", + "uglify-js": "^3.17.4" }, "scripts": { "lint": "eslint src test", diff --git a/src/lib/alpha.js b/src/lib/alpha.js index 0535e50d1..1a9926d5e 100644 --- a/src/lib/alpha.js +++ b/src/lib/alpha.js @@ -1,3 +1,4 @@ +/* eslint-disable no-misleading-character-class */ export const alpha = { 'en-US': /^[A-Z]+$/i, 'az-AZ': /^[A-VXYZÇƏĞİıÖŞÜ]+$/i, @@ -82,7 +83,6 @@ export const decimal = { ar: '٫', }; - export const englishLocales = ['AU', 'GB', 'HK', 'IN', 'NZ', 'ZA', 'ZM']; for (let locale, i = 0; i < englishLocales.length; i++) { diff --git a/src/lib/isBase64.js b/src/lib/isBase64.js index 02dead0f4..d43f37113 100644 --- a/src/lib/isBase64.js +++ b/src/lib/isBase64.js @@ -22,7 +22,7 @@ export default function isBase64(str, options) { } const firstPaddingChar = str.indexOf('='); - return firstPaddingChar === -1 || - firstPaddingChar === len - 1 || - (firstPaddingChar === len - 2 && str[len - 1] === '='); + return firstPaddingChar === -1 + || firstPaddingChar === len - 1 + || (firstPaddingChar === len - 2 && str[len - 1] === '='); } diff --git a/src/lib/isCurrency.js b/src/lib/isCurrency.js index 54b1f7c7c..7a855be7d 100755 --- a/src/lib/isCurrency.js +++ b/src/lib/isCurrency.js @@ -5,8 +5,7 @@ function currencyRegex(options) { let decimal_digits = `\\d{${options.digits_after_decimal[0]}}`; options.digits_after_decimal.forEach((digit, index) => { if (index !== 0) decimal_digits = `${decimal_digits}|\\d{${digit}}`; }); - const symbol = - `(${options.symbol.replace(/\W/, m => `\\${m}`)})${(options.require_symbol ? '' : '?')}`, + const symbol = `(${options.symbol.replace(/\W/, (m) => `\\${m}`)})${(options.require_symbol ? '' : '?')}`, negative = '-?', whole_dollar_amount_without_sep = '[1-9]\\d*', whole_dollar_amount_with_sep = `[1-9]\\d{0,2}(\\${options.thousands_separator}\\d{3})*`, @@ -53,7 +52,6 @@ function currencyRegex(options) { return new RegExp(`^(?!-? )(?=.*\\d)${pattern}$`); } - const default_currency_options = { symbol: '$', require_symbol: false, diff --git a/src/lib/isDataURI.js b/src/lib/isDataURI.js index 0275d2cc8..a293782ba 100644 --- a/src/lib/isDataURI.js +++ b/src/lib/isDataURI.js @@ -23,8 +23,8 @@ export default function isDataURI(str) { } for (let i = 0; i < attributes.length; i++) { if ( - !(i === attributes.length - 1 && attributes[i].toLowerCase() === 'base64') && - !validAttribute.test(attributes[i]) + !(i === attributes.length - 1 && attributes[i].toLowerCase() === 'base64') + && !validAttribute.test(attributes[i]) ) { return false; } diff --git a/src/lib/isDate.js b/src/lib/isDate.js index 8b7862e8b..7d05ede6a 100644 --- a/src/lib/isDate.js +++ b/src/lib/isDate.js @@ -29,10 +29,10 @@ export default function isDate(input, options) { } if (typeof input === 'string' && isValidFormat(options.format)) { const formatDelimiter = options.delimiters - .find(delimiter => options.format.indexOf(delimiter) !== -1); + .find((delimiter) => options.format.indexOf(delimiter) !== -1); const dateDelimiter = options.strictMode ? formatDelimiter - : options.delimiters.find(delimiter => input.indexOf(delimiter) !== -1); + : options.delimiters.find((delimiter) => input.indexOf(delimiter) !== -1); const dateAndFormat = zip( input.split(dateDelimiter), options.format.toLowerCase().split(formatDelimiter) diff --git a/src/lib/isEAN.js b/src/lib/isEAN.js index 968c385dd..48d27aafa 100644 --- a/src/lib/isEAN.js +++ b/src/lib/isEAN.js @@ -23,7 +23,6 @@ const LENGTH_EAN_8 = 8; const LENGTH_EAN_14 = 14; const validEanRegex = /^(\d{8}|\d{13}|\d{14})$/; - /** * Get position weight given: * EAN length and digit index/position diff --git a/src/lib/isEmail.js b/src/lib/isEmail.js index 6db00195c..179b44f0e 100644 --- a/src/lib/isEmail.js +++ b/src/lib/isEmail.js @@ -49,8 +49,7 @@ function validateDisplayName(display_name) { } // the quotes in display name must start with character symbol \ - const all_start_with_back_slash = - display_name_without_quotes.split('"').length === display_name_without_quotes.split('\\"').length; + const all_start_with_back_slash = display_name_without_quotes.split('"').length === display_name_without_quotes.split('\\"').length; if (!all_start_with_back_slash) { return false; } @@ -59,7 +58,6 @@ function validateDisplayName(display_name) { return true; } - export default function isEmail(str, options) { assertString(str); options = merge(options, default_email_options); @@ -133,8 +131,8 @@ export default function isEmail(str, options) { } if (options.ignore_max_length === false && ( - !isByteLength(user, { max: 64 }) || - !isByteLength(domain, { max: 254 })) + !isByteLength(user, { max: 64 }) + || !isByteLength(domain, { max: 254 })) ) { return false; } @@ -159,13 +157,13 @@ export default function isEmail(str, options) { if (user[0] === '"') { user = user.slice(1, user.length - 1); - return options.allow_utf8_local_part ? - quotedEmailUserUtf8.test(user) : - quotedEmailUser.test(user); + return options.allow_utf8_local_part + ? quotedEmailUserUtf8.test(user) + : quotedEmailUser.test(user); } - const pattern = options.allow_utf8_local_part ? - emailUserUtf8Part : emailUserPart; + const pattern = options.allow_utf8_local_part + ? emailUserUtf8Part : emailUserPart; const user_parts = user.split('.'); for (let i = 0; i < user_parts.length; i++) { diff --git a/src/lib/isFloat.js b/src/lib/isFloat.js index e6cced044..3fa35fb3a 100644 --- a/src/lib/isFloat.js +++ b/src/lib/isFloat.js @@ -9,11 +9,11 @@ export default function isFloat(str, options) { return false; } const value = parseFloat(str.replace(',', '.')); - return float.test(str) && - (!options.hasOwnProperty('min') || value >= options.min) && - (!options.hasOwnProperty('max') || value <= options.max) && - (!options.hasOwnProperty('lt') || value < options.lt) && - (!options.hasOwnProperty('gt') || value > options.gt); + return float.test(str) + && (!options.hasOwnProperty('min') || value >= options.min) + && (!options.hasOwnProperty('max') || value <= options.max) + && (!options.hasOwnProperty('lt') || value < options.lt) + && (!options.hasOwnProperty('gt') || value > options.gt); } export const locales = Object.keys(decimal); diff --git a/src/lib/isHSL.js b/src/lib/isHSL.js index 05cb43962..8787a6619 100644 --- a/src/lib/isHSL.js +++ b/src/lib/isHSL.js @@ -1,10 +1,8 @@ import assertString from './util/assertString'; - const hslComma = /^hsla?\(((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?))(deg|grad|rad|turn)?(,(\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%){2}(,((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%?))?\)$/i; const hslSpace = /^hsla?\(((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?))(deg|grad|rad|turn)?(\s(\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%){2}\s?(\/\s((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%?)\s?)?\)$/i; - export default function isHSL(str) { assertString(str); diff --git a/src/lib/isIBAN.js b/src/lib/isIBAN.js index 535a95772..c629ebaf5 100644 --- a/src/lib/isIBAN.js +++ b/src/lib/isIBAN.js @@ -102,8 +102,8 @@ function hasValidIbanFormat(str) { const strippedStr = str.replace(/[\s\-]+/gi, '').toUpperCase(); const isoCountryCode = strippedStr.slice(0, 2).toUpperCase(); - return (isoCountryCode in ibanRegexThroughCountryCode) && - ibanRegexThroughCountryCode[isoCountryCode].test(strippedStr); + return (isoCountryCode in ibanRegexThroughCountryCode) + && ibanRegexThroughCountryCode[isoCountryCode].test(strippedStr); } /** @@ -122,7 +122,7 @@ function hasValidIbanFormat(str) { function hasValidIbanChecksum(str) { const strippedStr = str.replace(/[^A-Z0-9]+/gi, '').toUpperCase(); // Keep only digits and A-Z latin alphabetic const rearranged = strippedStr.slice(4) + strippedStr.slice(0, 4); - const alphaCapsReplacedWithDigits = rearranged.replace(/[A-Z]/g, char => char.charCodeAt(0) - 55); + const alphaCapsReplacedWithDigits = rearranged.replace(/[A-Z]/g, (char) => char.charCodeAt(0) - 55); const remainder = alphaCapsReplacedWithDigits.match(/\d{1,7}/g) .reduce((acc, value) => Number(acc + value) % 97, ''); diff --git a/src/lib/isIMEI.js b/src/lib/isIMEI.js index fb97d4924..6bd594c87 100644 --- a/src/lib/isIMEI.js +++ b/src/lib/isIMEI.js @@ -1,10 +1,8 @@ import assertString from './util/assertString'; - let imeiRegexWithoutHypens = /^[0-9]{15}$/; let imeiRegexWithHypens = /^\d{2}-\d{6}-\d{6}-\d{1}$/; - export default function isIMEI(str, options) { assertString(str); options = options || {}; @@ -17,7 +15,6 @@ export default function isIMEI(str, options) { imeiRegex = imeiRegexWithHypens; } - if (!imeiRegex.test(str)) { return false; } diff --git a/src/lib/isIP.js b/src/lib/isIP.js index 40ca19aec..9244938b2 100644 --- a/src/lib/isIP.js +++ b/src/lib/isIP.js @@ -33,16 +33,16 @@ const IPv4AddressFormat = `(${IPv4SegmentFormat}[.]){3}${IPv4SegmentFormat}`; const IPv4AddressRegExp = new RegExp(`^${IPv4AddressFormat}$`); const IPv6SegmentFormat = '(?:[0-9a-fA-F]{1,4})'; -const IPv6AddressRegExp = new RegExp('^(' + - `(?:${IPv6SegmentFormat}:){7}(?:${IPv6SegmentFormat}|:)|` + - `(?:${IPv6SegmentFormat}:){6}(?:${IPv4AddressFormat}|:${IPv6SegmentFormat}|:)|` + - `(?:${IPv6SegmentFormat}:){5}(?::${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,2}|:)|` + - `(?:${IPv6SegmentFormat}:){4}(?:(:${IPv6SegmentFormat}){0,1}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,3}|:)|` + - `(?:${IPv6SegmentFormat}:){3}(?:(:${IPv6SegmentFormat}){0,2}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,4}|:)|` + - `(?:${IPv6SegmentFormat}:){2}(?:(:${IPv6SegmentFormat}){0,3}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,5}|:)|` + - `(?:${IPv6SegmentFormat}:){1}(?:(:${IPv6SegmentFormat}){0,4}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,6}|:)|` + - `(?::((?::${IPv6SegmentFormat}){0,5}:${IPv4AddressFormat}|(?::${IPv6SegmentFormat}){1,7}|:))` + - ')(%[0-9a-zA-Z-.:]{1,})?$'); +const IPv6AddressRegExp = new RegExp('^(' + + `(?:${IPv6SegmentFormat}:){7}(?:${IPv6SegmentFormat}|:)|` + + `(?:${IPv6SegmentFormat}:){6}(?:${IPv4AddressFormat}|:${IPv6SegmentFormat}|:)|` + + `(?:${IPv6SegmentFormat}:){5}(?::${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,2}|:)|` + + `(?:${IPv6SegmentFormat}:){4}(?:(:${IPv6SegmentFormat}){0,1}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,3}|:)|` + + `(?:${IPv6SegmentFormat}:){3}(?:(:${IPv6SegmentFormat}){0,2}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,4}|:)|` + + `(?:${IPv6SegmentFormat}:){2}(?:(:${IPv6SegmentFormat}){0,3}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,5}|:)|` + + `(?:${IPv6SegmentFormat}:){1}(?:(:${IPv6SegmentFormat}){0,4}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,6}|:)|` + + `(?::((?::${IPv6SegmentFormat}){0,5}:${IPv4AddressFormat}|(?::${IPv6SegmentFormat}){1,7}|:))` + + ')(%[0-9a-zA-Z-.:]{1,})?$'); export default function isIP(str, version = '') { assertString(str); diff --git a/src/lib/isIdentityCard.js b/src/lib/isIdentityCard.js index d34ddae26..3db2cb3bd 100644 --- a/src/lib/isIdentityCard.js +++ b/src/lib/isIdentityCard.js @@ -1,3 +1,4 @@ +/* eslint-disable max-len */ import assertString from './util/assertString'; import isInt from './isInt'; @@ -21,8 +22,7 @@ const validators = { if (str != null && str.length === 11 && isInt(str, { allow_leading_zeroes: true })) { const digits = str.split('').slice(0, -1); - const sum = digits.reduce((acc, digit, index) => - acc + (Number(digit) * weightOfDigits[index + 1]), 0); + const sum = digits.reduce((acc, digit, index) => acc + (Number(digit) * weightOfDigits[index + 1]), 0); const modulo = sum % 10; const lastDigit = Number(str.charAt(str.length - 1)); @@ -59,7 +59,7 @@ const validators = { } // validate the control digit - const number = sanitized.slice(0, -1).replace(/[X,Y,Z]/g, char => charsValue[char]); + const number = sanitized.slice(0, -1).replace(/[X,Y,Z]/g, (char) => charsValue[char]); return sanitized.endsWith(controlDigits[number % 23]); }, @@ -185,7 +185,7 @@ const validators = { const new_nic = /^[1-9]\d{11}$/i; if (str.length === 10 && old_nic.test(str)) return true; - else if (str.length === 12 && new_nic.test(str)) return true; + if (str.length === 12 && new_nic.test(str)) return true; return false; }, 'he-IL': (str) => { @@ -277,7 +277,7 @@ const validators = { const parityBit = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2']; - const checkAddressCode = addressCode => provincesAndCities.includes(addressCode); + const checkAddressCode = (addressCode) => provincesAndCities.includes(addressCode); const checkBirthDayCode = (birDayCode) => { const yyyy = parseInt(birDayCode.substring(0, 4), 10); @@ -287,7 +287,7 @@ const validators = { if (xdata > new Date()) { return false; // eslint-disable-next-line max-len - } else if ((xdata.getFullYear() === yyyy) && (xdata.getMonth() === mm - 1) && (xdata.getDate() === dd)) { + } if ((xdata.getFullYear() === yyyy) && (xdata.getMonth() === mm - 1) && (xdata.getDate() === dd)) { return true; } return false; @@ -305,8 +305,7 @@ const validators = { return parityBit[mod]; }; - const checkParityBit = idCardNo => getParityBit(idCardNo) === idCardNo.charAt(17).toUpperCase(); - + const checkParityBit = (idCardNo) => getParityBit(idCardNo) === idCardNo.charAt(17).toUpperCase(); const check15IdCardNo = (idCardNo) => { let check = /^[1-9]\d{7}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}$/.test(idCardNo); @@ -396,7 +395,7 @@ export default function isIdentityCard(str, locale) { assertString(str); if (locale in validators) { return validators[locale](str); - } else if (locale === 'any') { + } if (locale === 'any') { for (const key in validators) { // https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes // istanbul ignore else diff --git a/src/lib/isIn.js b/src/lib/isIn.js index e7f15804f..56ec76cdb 100644 --- a/src/lib/isIn.js +++ b/src/lib/isIn.js @@ -14,9 +14,9 @@ export default function isIn(str, options) { } } return array.indexOf(str) >= 0; - } else if (typeof options === 'object') { + } if (typeof options === 'object') { return options.hasOwnProperty(str); - } else if (options && typeof options.indexOf === 'function') { + } if (options && typeof options.indexOf === 'function') { return options.indexOf(str) >= 0; } return false; diff --git a/src/lib/isInt.js b/src/lib/isInt.js index 8047a6969..d38f9b14a 100644 --- a/src/lib/isInt.js +++ b/src/lib/isInt.js @@ -10,8 +10,8 @@ export default function isInt(str, options) { // Get the regex to use for testing, based on whether // leading zeroes are allowed or not. let regex = ( - options.hasOwnProperty('allow_leading_zeroes') && !options.allow_leading_zeroes ? - int : intLeadingZeroes + options.hasOwnProperty('allow_leading_zeroes') && !options.allow_leading_zeroes + ? int : intLeadingZeroes ); // Check min/max/lt/gt diff --git a/src/lib/isLicensePlate.js b/src/lib/isLicensePlate.js index e370e5029..6471ee23f 100644 --- a/src/lib/isLicensePlate.js +++ b/src/lib/isLicensePlate.js @@ -1,50 +1,51 @@ -import assertString from './util/assertString'; - -const validators = { - 'cs-CZ': str => - /^(([ABCDEFHKIJKLMNPRSTUVXYZ]|[0-9])-?){5,8}$/.test(str), - 'de-DE': str => - /^((A|AA|AB|AC|AE|AH|AK|AM|AN|AÖ|AP|AS|AT|AU|AW|AZ|B|BA|BB|BC|BE|BF|BH|BI|BK|BL|BM|BN|BO|BÖ|BS|BT|BZ|C|CA|CB|CE|CO|CR|CW|D|DA|DD|DE|DH|DI|DL|DM|DN|DO|DU|DW|DZ|E|EA|EB|ED|EE|EF|EG|EH|EI|EL|EM|EN|ER|ES|EU|EW|F|FB|FD|FF|FG|FI|FL|FN|FO|FR|FS|FT|FÜ|FW|FZ|G|GA|GC|GD|GE|GF|GG|GI|GK|GL|GM|GN|GÖ|GP|GR|GS|GT|GÜ|GV|GW|GZ|H|HA|HB|HC|HD|HE|HF|HG|HH|HI|HK|HL|HM|HN|HO|HP|HR|HS|HU|HV|HX|HY|HZ|IK|IL|IN|IZ|J|JE|JL|K|KA|KB|KC|KE|KF|KG|KH|KI|KK|KL|KM|KN|KO|KR|KS|KT|KU|KW|KY|L|LA|LB|LC|LD|LF|LG|LH|LI|LL|LM|LN|LÖ|LP|LR|LU|M|MA|MB|MC|MD|ME|MG|MH|MI|MK|ML|MM|MN|MO|MQ|MR|MS|MÜ|MW|MY|MZ|N|NB|ND|NE|NF|NH|NI|NK|NM|NÖ|NP|NR|NT|NU|NW|NY|NZ|OA|OB|OC|OD|OE|OF|OG|OH|OK|OL|OP|OS|OZ|P|PA|PB|PE|PF|PI|PL|PM|PN|PR|PS|PW|PZ|R|RA|RC|RD|RE|RG|RH|RI|RL|RM|RN|RO|RP|RS|RT|RU|RV|RW|RZ|S|SB|SC|SE|SG|SI|SK|SL|SM|SN|SO|SP|SR|ST|SU|SW|SY|SZ|TE|TF|TG|TO|TP|TR|TS|TT|TÜ|ÜB|UE|UH|UL|UM|UN|V|VB|VG|VK|VR|VS|W|WA|WB|WE|WF|WI|WK|WL|WM|WN|WO|WR|WS|WT|WÜ|WW|WZ|Z|ZE|ZI|ZP|ZR|ZW|ZZ)[- ]?[A-Z]{1,2}[- ]?\d{1,4}|(ABG|ABI|AIB|AIC|ALF|ALZ|ANA|ANG|ANK|APD|ARN|ART|ASL|ASZ|AUR|AZE|BAD|BAR|BBG|BCH|BED|BER|BGD|BGL|BID|BIN|BIR|BIT|BIW|BKS|BLB|BLK|BNA|BOG|BOH|BOR|BOT|BRA|BRB|BRG|BRK|BRL|BRV|BSB|BSK|BTF|BÜD|BUL|BÜR|BÜS|BÜZ|CAS|CHA|CLP|CLZ|COC|COE|CUX|DAH|DAN|DAU|DBR|DEG|DEL|DGF|DIL|DIN|DIZ|DKB|DLG|DON|DUD|DÜW|EBE|EBN|EBS|ECK|EIC|EIL|EIN|EIS|EMD|EMS|ERB|ERH|ERK|ERZ|ESB|ESW|FDB|FDS|FEU|FFB|FKB|FLÖ|FOR|FRG|FRI|FRW|FTL|FÜS|GAN|GAP|GDB|GEL|GEO|GER|GHA|GHC|GLA|GMN|GNT|GOA|GOH|GRA|GRH|GRI|GRM|GRZ|GTH|GUB|GUN|GVM|HAB|HAL|HAM|HAS|HBN|HBS|HCH|HDH|HDL|HEB|HEF|HEI|HER|HET|HGN|HGW|HHM|HIG|HIP|HMÜ|HOG|HOH|HOL|HOM|HOR|HÖS|HOT|HRO|HSK|HST|HVL|HWI|IGB|ILL|JÜL|KEH|KEL|KEM|KIB|KLE|KLZ|KÖN|KÖT|KÖZ|KRU|KÜN|KUS|KYF|LAN|LAU|LBS|LBZ|LDK|LDS|LEO|LER|LEV|LIB|LIF|LIP|LÖB|LOS|LRO|LSZ|LÜN|LUP|LWL|MAB|MAI|MAK|MAL|MED|MEG|MEI|MEK|MEL|MER|MET|MGH|MGN|MHL|MIL|MKK|MOD|MOL|MON|MOS|MSE|MSH|MSP|MST|MTK|MTL|MÜB|MÜR|MYK|MZG|NAB|NAI|NAU|NDH|NEA|NEB|NEC|NEN|NES|NEW|NMB|NMS|NOH|NOL|NOM|NOR|NVP|NWM|OAL|OBB|OBG|OCH|OHA|ÖHR|OHV|OHZ|OPR|OSL|OVI|OVL|OVP|PAF|PAN|PAR|PCH|PEG|PIR|PLÖ|PRÜ|QFT|QLB|RDG|REG|REH|REI|RID|RIE|ROD|ROF|ROK|ROL|ROS|ROT|ROW|RSL|RÜD|RÜG|SAB|SAD|SAN|SAW|SBG|SBK|SCZ|SDH|SDL|SDT|SEB|SEE|SEF|SEL|SFB|SFT|SGH|SHA|SHG|SHK|SHL|SIG|SIM|SLE|SLF|SLK|SLN|SLS|SLÜ|SLZ|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), - 'de-LI': str => /^FL[- ]?\d{1,5}[UZ]?$/.test(str), - 'fi-FI': str => /^(?=.{4,7})(([A-Z]{1,3}|[0-9]{1,3})[\s-]?([A-Z]{1,3}|[0-9]{1,5}))$/.test(str), - 'pt-PT': str => - /^([A-Z]{2}|[0-9]{2})[ -·]?([A-Z]{2}|[0-9]{2})[ -·]?([A-Z]{2}|[0-9]{2})$/.test(str), - 'sq-AL': str => - /^[A-Z]{2}[- ]?((\d{3}[- ]?(([A-Z]{2})|T))|(R[- ]?\d{3}))$/.test(str), - 'pt-BR': str => - /^[A-Z]{3}[ -]?[0-9][A-Z][0-9]{2}|[A-Z]{3}[ -]?[0-9]{4}$/.test(str), - 'sv-SE': str => - /^[A-HJ-PR-UW-Z]{3} ?[\d]{2}[A-HJ-PR-UW-Z1-9]$|(^[A-ZÅÄÖ ]{2,7}$)/.test(str.trim()), - 'en-IN': str => /^[A-Z]{2}[ -]?[0-9]{1,2}(?:[ -]?[A-Z])(?:[ -]?[A-Z]*)?[ -]?[0-9]{4}$/.test(str), -}; - -validators['hi-IN'] = validators['en-IN']; -validators['gu-IN'] = validators['en-IN']; -validators['as-IN'] = validators['en-IN']; -validators['bn-IN'] = validators['en-IN']; -validators['kn-IN'] = validators['en-IN']; -validators['ml-IN'] = validators['en-IN']; -validators['mr-IN'] = validators['en-IN']; -validators['or-IN'] = validators['en-IN']; -validators['pa-IN'] = validators['en-IN']; -validators['sa-IN'] = validators['en-IN']; -validators['ta-IN'] = validators['en-IN']; -validators['te-IN'] = validators['en-IN']; -validators['kok-IN'] = validators['en-IN']; - -export default function isLicensePlate(str, locale) { - assertString(str); - if (locale in validators) { - return validators[locale](str); - } else if (locale === 'any') { - for (const key in validators) { - /* eslint guard-for-in: 0 */ - const validator = validators[key]; - if (validator(str)) { - return true; - } - } - return false; - } - throw new Error(`Invalid locale '${locale}'`); -} +/* eslint-disable implicit-arrow-linebreak */ +import assertString from './util/assertString'; + +const validators = { + 'cs-CZ': (str) => + /^(([ABCDEFHKIJKLMNPRSTUVXYZ]|[0-9])-?){5,8}$/.test(str), + 'de-DE': (str) => + /^((A|AA|AB|AC|AE|AH|AK|AM|AN|AÖ|AP|AS|AT|AU|AW|AZ|B|BA|BB|BC|BE|BF|BH|BI|BK|BL|BM|BN|BO|BÖ|BS|BT|BZ|C|CA|CB|CE|CO|CR|CW|D|DA|DD|DE|DH|DI|DL|DM|DN|DO|DU|DW|DZ|E|EA|EB|ED|EE|EF|EG|EH|EI|EL|EM|EN|ER|ES|EU|EW|F|FB|FD|FF|FG|FI|FL|FN|FO|FR|FS|FT|FÜ|FW|FZ|G|GA|GC|GD|GE|GF|GG|GI|GK|GL|GM|GN|GÖ|GP|GR|GS|GT|GÜ|GV|GW|GZ|H|HA|HB|HC|HD|HE|HF|HG|HH|HI|HK|HL|HM|HN|HO|HP|HR|HS|HU|HV|HX|HY|HZ|IK|IL|IN|IZ|J|JE|JL|K|KA|KB|KC|KE|KF|KG|KH|KI|KK|KL|KM|KN|KO|KR|KS|KT|KU|KW|KY|L|LA|LB|LC|LD|LF|LG|LH|LI|LL|LM|LN|LÖ|LP|LR|LU|M|MA|MB|MC|MD|ME|MG|MH|MI|MK|ML|MM|MN|MO|MQ|MR|MS|MÜ|MW|MY|MZ|N|NB|ND|NE|NF|NH|NI|NK|NM|NÖ|NP|NR|NT|NU|NW|NY|NZ|OA|OB|OC|OD|OE|OF|OG|OH|OK|OL|OP|OS|OZ|P|PA|PB|PE|PF|PI|PL|PM|PN|PR|PS|PW|PZ|R|RA|RC|RD|RE|RG|RH|RI|RL|RM|RN|RO|RP|RS|RT|RU|RV|RW|RZ|S|SB|SC|SE|SG|SI|SK|SL|SM|SN|SO|SP|SR|ST|SU|SW|SY|SZ|TE|TF|TG|TO|TP|TR|TS|TT|TÜ|ÜB|UE|UH|UL|UM|UN|V|VB|VG|VK|VR|VS|W|WA|WB|WE|WF|WI|WK|WL|WM|WN|WO|WR|WS|WT|WÜ|WW|WZ|Z|ZE|ZI|ZP|ZR|ZW|ZZ)[- ]?[A-Z]{1,2}[- ]?\d{1,4}|(ABG|ABI|AIB|AIC|ALF|ALZ|ANA|ANG|ANK|APD|ARN|ART|ASL|ASZ|AUR|AZE|BAD|BAR|BBG|BCH|BED|BER|BGD|BGL|BID|BIN|BIR|BIT|BIW|BKS|BLB|BLK|BNA|BOG|BOH|BOR|BOT|BRA|BRB|BRG|BRK|BRL|BRV|BSB|BSK|BTF|BÜD|BUL|BÜR|BÜS|BÜZ|CAS|CHA|CLP|CLZ|COC|COE|CUX|DAH|DAN|DAU|DBR|DEG|DEL|DGF|DIL|DIN|DIZ|DKB|DLG|DON|DUD|DÜW|EBE|EBN|EBS|ECK|EIC|EIL|EIN|EIS|EMD|EMS|ERB|ERH|ERK|ERZ|ESB|ESW|FDB|FDS|FEU|FFB|FKB|FLÖ|FOR|FRG|FRI|FRW|FTL|FÜS|GAN|GAP|GDB|GEL|GEO|GER|GHA|GHC|GLA|GMN|GNT|GOA|GOH|GRA|GRH|GRI|GRM|GRZ|GTH|GUB|GUN|GVM|HAB|HAL|HAM|HAS|HBN|HBS|HCH|HDH|HDL|HEB|HEF|HEI|HER|HET|HGN|HGW|HHM|HIG|HIP|HMÜ|HOG|HOH|HOL|HOM|HOR|HÖS|HOT|HRO|HSK|HST|HVL|HWI|IGB|ILL|JÜL|KEH|KEL|KEM|KIB|KLE|KLZ|KÖN|KÖT|KÖZ|KRU|KÜN|KUS|KYF|LAN|LAU|LBS|LBZ|LDK|LDS|LEO|LER|LEV|LIB|LIF|LIP|LÖB|LOS|LRO|LSZ|LÜN|LUP|LWL|MAB|MAI|MAK|MAL|MED|MEG|MEI|MEK|MEL|MER|MET|MGH|MGN|MHL|MIL|MKK|MOD|MOL|MON|MOS|MSE|MSH|MSP|MST|MTK|MTL|MÜB|MÜR|MYK|MZG|NAB|NAI|NAU|NDH|NEA|NEB|NEC|NEN|NES|NEW|NMB|NMS|NOH|NOL|NOM|NOR|NVP|NWM|OAL|OBB|OBG|OCH|OHA|ÖHR|OHV|OHZ|OPR|OSL|OVI|OVL|OVP|PAF|PAN|PAR|PCH|PEG|PIR|PLÖ|PRÜ|QFT|QLB|RDG|REG|REH|REI|RID|RIE|ROD|ROF|ROK|ROL|ROS|ROT|ROW|RSL|RÜD|RÜG|SAB|SAD|SAN|SAW|SBG|SBK|SCZ|SDH|SDL|SDT|SEB|SEE|SEF|SEL|SFB|SFT|SGH|SHA|SHG|SHK|SHL|SIG|SIM|SLE|SLF|SLK|SLN|SLS|SLÜ|SLZ|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), + 'de-LI': (str) => /^FL[- ]?\d{1,5}[UZ]?$/.test(str), + 'fi-FI': (str) => /^(?=.{4,7})(([A-Z]{1,3}|[0-9]{1,3})[\s-]?([A-Z]{1,3}|[0-9]{1,5}))$/.test(str), + 'pt-PT': (str) => + /^([A-Z]{2}|[0-9]{2})[ -·]?([A-Z]{2}|[0-9]{2})[ -·]?([A-Z]{2}|[0-9]{2})$/.test(str), + 'sq-AL': (str) => + /^[A-Z]{2}[- ]?((\d{3}[- ]?(([A-Z]{2})|T))|(R[- ]?\d{3}))$/.test(str), + 'pt-BR': (str) => + /^[A-Z]{3}[ -]?[0-9][A-Z][0-9]{2}|[A-Z]{3}[ -]?[0-9]{4}$/.test(str), + 'sv-SE': (str) => + /^[A-HJ-PR-UW-Z]{3} ?[\d]{2}[A-HJ-PR-UW-Z1-9]$|(^[A-ZÅÄÖ ]{2,7}$)/.test(str.trim()), + 'en-IN': (str) => /^[A-Z]{2}[ -]?[0-9]{1,2}(?:[ -]?[A-Z])(?:[ -]?[A-Z]*)?[ -]?[0-9]{4}$/.test(str), +}; + +validators['hi-IN'] = validators['en-IN']; +validators['gu-IN'] = validators['en-IN']; +validators['as-IN'] = validators['en-IN']; +validators['bn-IN'] = validators['en-IN']; +validators['kn-IN'] = validators['en-IN']; +validators['ml-IN'] = validators['en-IN']; +validators['mr-IN'] = validators['en-IN']; +validators['or-IN'] = validators['en-IN']; +validators['pa-IN'] = validators['en-IN']; +validators['sa-IN'] = validators['en-IN']; +validators['ta-IN'] = validators['en-IN']; +validators['te-IN'] = validators['en-IN']; +validators['kok-IN'] = validators['en-IN']; + +export default function isLicensePlate(str, locale) { + assertString(str); + if (locale in validators) { + return validators[locale](str); + } if (locale === 'any') { + for (const key in validators) { + /* eslint guard-for-in: 0 */ + const validator = validators[key]; + if (validator(str)) { + return true; + } + } + return false; + } + throw new Error(`Invalid locale '${locale}'`); +} diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index f9c552e2f..a44b96dc5 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -181,10 +181,10 @@ export default function isMobilePhone(str, locale, options) { } return false; }); - } else if (locale in phones) { + } if (locale in phones) { return phones[locale].test(str); // alias falsey locale as 'any' - } else if (!locale || locale === 'any') { + } if (!locale || locale === 'any') { for (const key in phones) { // istanbul ignore else if (phones.hasOwnProperty(key)) { diff --git a/src/lib/isPassportNumber.js b/src/lib/isPassportNumber.js index 5b2ebfd7a..1683260d0 100644 --- a/src/lib/isPassportNumber.js +++ b/src/lib/isPassportNumber.js @@ -74,6 +74,6 @@ export default function isPassportNumber(str, countryCode) { /** Remove All Whitespaces, Convert to UPPERCASE */ const normalizedStr = str.replace(/\s/g, '').toUpperCase(); - return (countryCode.toUpperCase() in passportRegexByCountryCode) && - passportRegexByCountryCode[countryCode].test(normalizedStr); + return (countryCode.toUpperCase() in passportRegexByCountryCode) + && passportRegexByCountryCode[countryCode].test(normalizedStr); } diff --git a/src/lib/isPostalCode.js b/src/lib/isPostalCode.js index cf5b50d25..e5fc1f7db 100644 --- a/src/lib/isPostalCode.js +++ b/src/lib/isPostalCode.js @@ -81,7 +81,7 @@ export default function isPostalCode(str, locale) { assertString(str); if (locale in patterns) { return patterns[locale].test(str); - } else if (locale === 'any') { + } if (locale === 'any') { for (const key in patterns) { // https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes // istanbul ignore else diff --git a/src/lib/isRgbColor.js b/src/lib/isRgbColor.js index e6508e29a..93b559d0e 100644 --- a/src/lib/isRgbColor.js +++ b/src/lib/isRgbColor.js @@ -12,8 +12,8 @@ export default function isRgbColor(str, includePercentValues = true) { return rgbColor.test(str) || rgbaColor.test(str); } - return rgbColor.test(str) || - rgbaColor.test(str) || - rgbColorPercent.test(str) || - rgbaColorPercent.test(str); + return rgbColor.test(str) + || rgbaColor.test(str) + || rgbColorPercent.test(str) + || rgbaColorPercent.test(str); } diff --git a/src/lib/isTaxID.js b/src/lib/isTaxID.js index 933783f44..5df0b737d 100644 --- a/src/lib/isTaxID.js +++ b/src/lib/isTaxID.js @@ -48,7 +48,7 @@ function bgBgCheck(tin) { if (!isDate(date, 'YYYY/MM/DD')) { return false; } // split digits into an array for further processing - const digits = tin.split('').map(a => parseInt(a, 10)); + const digits = tin.split('').map((a) => parseInt(a, 10)); // Calculate checksum by multiplying digits with fixed values const multip_lookup = [2, 4, 8, 5, 10, 9, 7, 3, 6]; @@ -77,14 +77,14 @@ function isCanadianSIN(input) { const digitsArray = input.split(''); const even = digitsArray .filter((_, idx) => idx % 2) - .map(i => Number(i) * 2) + .map((i) => Number(i) * 2) .join('') .split(''); const total = digitsArray .filter((_, idx) => !(idx % 2)) .concat(even) - .map(i => Number(i)) + .map((i) => Number(i)) .reduce((acc, cur) => acc + cur); return (total % 10 === 0); @@ -171,7 +171,7 @@ function deAtCheck(tin) { */ function deDeCheck(tin) { // Split digits into an array for further processing - const digits = tin.split('').map(a => parseInt(a, 10)); + const digits = tin.split('').map((a) => parseInt(a, 10)); // Fill array with strings of number positions let occurences = []; @@ -185,12 +185,12 @@ function deDeCheck(tin) { } // Remove digits with one occurence and test for only one duplicate/triplicate - occurences = occurences.filter(a => a.length > 1); + occurences = occurences.filter((a) => a.length > 1); if (occurences.length !== 2 && occurences.length !== 3) { return false; } // In case of triplicate value only two digits are allowed next to each other if (occurences[0].length === 3) { - const trip_locations = occurences[0].split('').map(a => parseInt(a, 10)); + const trip_locations = occurences[0].split('').map((a) => parseInt(a, 10)); let recurrent = 0; // Amount of neighbour occurences for (let i = 0; i < trip_locations.length - 1; i++) { if (trip_locations[i] + 1 === trip_locations[i + 1]) { @@ -250,7 +250,7 @@ function dkDkCheck(tin) { if (!isDate(date, 'YYYY/MM/DD')) { return false; } // Split digits into an array for further processing - const digits = tin.split('').map(a => parseInt(a, 10)); + const digits = tin.split('').map((a) => parseInt(a, 10)); let checksum = 0; let weight = 4; // Multiply by weight and add to checksum @@ -273,7 +273,7 @@ function dkDkCheck(tin) { */ function elCyCheck(tin) { // split digits into an array for further processing - const digits = tin.slice(0, 8).split('').map(a => parseInt(a, 10)); + const digits = tin.slice(0, 8).split('').map((a) => parseInt(a, 10)); let checksum = 0; // add digits in even places @@ -304,7 +304,7 @@ function elCyCheck(tin) { */ function elGrCheck(tin) { // split digits into an array for further processing - const digits = tin.split('').map(a => parseInt(a, 10)); + const digits = tin.split('').map((a) => parseInt(a, 10)); let checksum = 0; for (let i = 0; i < 8; i++) { @@ -325,7 +325,7 @@ function elGrCheck(tin) { * Verify TIN validity by calculating check (second to last) character */ function enIeCheck(tin) { - let checksum = algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 7).map(a => parseInt(a, 10)), 8); + let checksum = algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 7).map((a) => parseInt(a, 10)), 8); if (tin.length === 9 && tin[8] !== 'W') { checksum += (tin[8].charCodeAt(0) - 64) * 9; } @@ -442,7 +442,7 @@ function etEeCheck(tin) { if (!isDate(date, 'YYYY/MM/DD')) { return false; } // Split digits into an array for further processing - const digits = tin.split('').map(a => parseInt(a, 10)); + const digits = tin.split('').map((a) => parseInt(a, 10)); let checksum = 0; let weight = 1; // Multiply by weight and add to checksum @@ -572,7 +572,7 @@ function hrHrCheck(tin) { */ function huHuCheck(tin) { // split digits into an array for further processing - const digits = tin.split('').map(a => parseInt(a, 10)); + const digits = tin.split('').map((a) => parseInt(a, 10)); let checksum = 8; for (let i = 1; i < 9; i++) { @@ -818,7 +818,7 @@ function mtMtCheck(tin) { * Verify TIN validity by calculating check (last) digit (variant of MOD 11) */ function nlNlCheck(tin) { - return algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 8).map(a => parseInt(a, 10)), 9) % 11 === parseInt(tin[8], 10); + return algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 8).map((a) => parseInt(a, 10)), 9) % 11 === parseInt(tin[8], 10); } /* @@ -896,16 +896,16 @@ function ptBrCheck(tin) { sum = 0; if ( // Reject known invalid CPFs - tin === '11111111111' || - tin === '22222222222' || - tin === '33333333333' || - tin === '44444444444' || - tin === '55555555555' || - tin === '66666666666' || - tin === '77777777777' || - tin === '88888888888' || - tin === '99999999999' || - tin === '00000000000' + tin === '11111111111' + || tin === '22222222222' + || tin === '33333333333' + || tin === '44444444444' + || tin === '55555555555' + || tin === '66666666666' + || tin === '77777777777' + || tin === '88888888888' + || tin === '99999999999' + || tin === '00000000000' ) return false; for (let i = 1; i <= 9; i++) sum += parseInt(tin.substring(i - 1, i), 10) * (11 - i); @@ -923,16 +923,16 @@ function ptBrCheck(tin) { } if ( // Reject know invalid CNPJs - tin === '00000000000000' || - tin === '11111111111111' || - tin === '22222222222222' || - tin === '33333333333333' || - tin === '44444444444444' || - tin === '55555555555555' || - tin === '66666666666666' || - tin === '77777777777777' || - tin === '88888888888888' || - tin === '99999999999999') { return false; } + tin === '00000000000000' + || tin === '11111111111111' + || tin === '22222222222222' + || tin === '33333333333333' + || tin === '44444444444444' + || tin === '55555555555555' + || tin === '66666666666666' + || tin === '77777777777777' + || tin === '88888888888888' + || tin === '99999999999999') { return false; } let length = tin.length - 2; let identifiers = tin.substring(0, length); @@ -969,7 +969,7 @@ function ptBrCheck(tin) { * Verify TIN validity by calculating check (last) digit (variant of MOD 11) */ function ptPtCheck(tin) { - let checksum = 11 - (algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 8).map(a => parseInt(a, 10)), 9) % 11); + let checksum = 11 - (algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 8).map((a) => parseInt(a, 10)), 9) % 11); if (checksum > 9) { return parseInt(tin[8], 10) === 0; } return checksum === parseInt(tin[8], 10); } @@ -1009,7 +1009,7 @@ function roRoCheck(tin) { } else if (!isDate(date, 'YYYY/MM/DD')) { return false; } // Calculate check digit - const digits = tin.split('').map(a => parseInt(a, 10)); + const digits = tin.split('').map((a) => parseInt(a, 10)); const multipliers = [2, 7, 9, 1, 4, 6, 3, 5, 8, 2, 7, 9]; let checksum = 0; for (let i = 0; i < multipliers.length; i++) { @@ -1062,7 +1062,7 @@ function skSkCheck(tin) { * Verify TIN validity by calculating check (last) digit (variant of MOD 11) */ function slSiCheck(tin) { - let checksum = 11 - (algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 7).map(a => parseInt(a, 10)), 8) % 11); + let checksum = 11 - (algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 7).map((a) => parseInt(a, 10)), 8) % 11); if (checksum === 10) { return parseInt(tin[7], 10) === 0; } return checksum === parseInt(tin[7], 10); } diff --git a/src/lib/isURL.js b/src/lib/isURL.js index 3d2b1df3e..b05899780 100644 --- a/src/lib/isURL.js +++ b/src/lib/isURL.js @@ -17,7 +17,6 @@ validate_length - if set as false isURL will skip string length validation (IE m */ - const default_url_options = { protocols: ['http', 'https', 'ftp'], require_tld: true, diff --git a/src/lib/isVAT.js b/src/lib/isVAT.js index 95593569d..9f59e344a 100644 --- a/src/lib/isVAT.js +++ b/src/lib/isVAT.js @@ -1,109 +1,109 @@ -import assertString from './util/assertString'; -import * as algorithms from './util/algorithms'; - -const PT = (str) => { - const match = str.match(/^(PT)?(\d{9})$/); - if (!match) { - return false; - } - - const tin = match[2]; - - const checksum = 11 - (algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 8).map(a => parseInt(a, 10)), 9) % 11); - if (checksum > 9) { - return parseInt(tin[8], 10) === 0; - } - return checksum === parseInt(tin[8], 10); -}; - -export const vatMatchers = { - /** - * European Union VAT identification numbers - */ - AT: str => /^(AT)?U\d{8}$/.test(str), - BE: str => /^(BE)?\d{10}$/.test(str), - BG: str => /^(BG)?\d{9,10}$/.test(str), - HR: str => /^(HR)?\d{11}$/.test(str), - CY: str => /^(CY)?\w{9}$/.test(str), - CZ: str => /^(CZ)?\d{8,10}$/.test(str), - DK: str => /^(DK)?\d{8}$/.test(str), - EE: str => /^(EE)?\d{9}$/.test(str), - FI: str => /^(FI)?\d{8}$/.test(str), - FR: str => /^(FR)?\w{2}\d{9}$/.test(str), - DE: str => /^(DE)?\d{9}$/.test(str), - EL: str => /^(EL)?\d{9}$/.test(str), - HU: str => /^(HU)?\d{8}$/.test(str), - IE: str => /^(IE)?\d{7}\w{1}(W)?$/.test(str), - IT: str => /^(IT)?\d{11}$/.test(str), - LV: str => /^(LV)?\d{11}$/.test(str), - LT: str => /^(LT)?\d{9,12}$/.test(str), - LU: str => /^(LU)?\d{8}$/.test(str), - MT: str => /^(MT)?\d{8}$/.test(str), - NL: str => /^(NL)?\d{9}B\d{2}$/.test(str), - PL: str => /^(PL)?(\d{10}|(\d{3}-\d{3}-\d{2}-\d{2})|(\d{3}-\d{2}-\d{2}-\d{3}))$/.test(str), - PT, - RO: str => /^(RO)?\d{2,10}$/.test(str), - SK: str => /^(SK)?\d{10}$/.test(str), - SI: str => /^(SI)?\d{8}$/.test(str), - ES: str => /^(ES)?\w\d{7}[A-Z]$/.test(str), - SE: str => /^(SE)?\d{12}$/.test(str), - - /** - * VAT numbers of non-EU countries - */ - AL: str => /^(AL)?\w{9}[A-Z]$/.test(str), - MK: str => /^(MK)?\d{13}$/.test(str), - AU: str => /^(AU)?\d{11}$/.test(str), - BY: str => /^(УНП )?\d{9}$/.test(str), - CA: str => /^(CA)?\d{9}$/.test(str), - IS: str => /^(IS)?\d{5,6}$/.test(str), - IN: str => /^(IN)?\d{15}$/.test(str), - ID: str => /^(ID)?(\d{15}|(\d{2}.\d{3}.\d{3}.\d{1}-\d{3}.\d{3}))$/.test(str), - IL: str => /^(IL)?\d{9}$/.test(str), - KZ: str => /^(KZ)?\d{9}$/.test(str), - NZ: str => /^(NZ)?\d{9}$/.test(str), - NG: str => /^(NG)?(\d{12}|(\d{8}-\d{4}))$/.test(str), - NO: str => /^(NO)?\d{9}MVA$/.test(str), - PH: str => /^(PH)?(\d{12}|\d{3} \d{3} \d{3} \d{3})$/.test(str), - RU: str => /^(RU)?(\d{10}|\d{12})$/.test(str), - SM: str => /^(SM)?\d{5}$/.test(str), - SA: str => /^(SA)?\d{15}$/.test(str), - RS: str => /^(RS)?\d{9}$/.test(str), - CH: str => /^(CH)?(\d{6}|\d{9}|(\d{3}.\d{3})|(\d{3}.\d{3}.\d{3}))(TVA|MWST|IVA)$/.test(str), - TR: str => /^(TR)?\d{10}$/.test(str), - UA: str => /^(UA)?\d{12}$/.test(str), - GB: str => /^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: str => /^(UZ)?\d{9}$/.test(str), - - /** - * VAT numbers of Latin American countries - */ - AR: str => /^(AR)?\d{11}$/.test(str), - BO: str => /^(BO)?\d{7}$/.test(str), - BR: str => /^(BR)?((\d{2}.\d{3}.\d{3}\/\d{4}-\d{2})|(\d{3}.\d{3}.\d{3}-\d{2}))$/.test(str), - CL: str => /^(CL)?\d{8}-\d{1}$/.test(str), - CO: str => /^(CO)?\d{10}$/.test(str), - CR: str => /^(CR)?\d{9,12}$/.test(str), - EC: str => /^(EC)?\d{13}$/.test(str), - SV: str => /^(SV)?\d{4}-\d{6}-\d{3}-\d{1}$/.test(str), - GT: str => /^(GT)?\d{7}-\d{1}$/.test(str), - HN: str => /^(HN)?$/.test(str), - MX: str => /^(MX)?\w{3,4}\d{6}\w{3}$/.test(str), - NI: str => /^(NI)?\d{3}-\d{6}-\d{4}\w{1}$/.test(str), - PA: str => /^(PA)?$/.test(str), - PY: str => /^(PY)?\d{6,8}-\d{1}$/.test(str), - PE: str => /^(PE)?\d{11}$/.test(str), - DO: str => /^(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: str => /^(UY)?\d{12}$/.test(str), - VE: str => /^(VE)?[J,G,V,E]{1}-(\d{9}|(\d{8}-\d{1}))$/.test(str), -}; - -export default function isVAT(str, countryCode) { - assertString(str); - assertString(countryCode); - - if (countryCode in vatMatchers) { - return vatMatchers[countryCode](str); - } - throw new Error(`Invalid country code: '${countryCode}'`); -} +import assertString from './util/assertString'; +import * as algorithms from './util/algorithms'; + +const PT = (str) => { + const match = str.match(/^(PT)?(\d{9})$/); + if (!match) { + return false; + } + + const tin = match[2]; + + const checksum = 11 - (algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 8).map((a) => parseInt(a, 10)), 9) % 11); + if (checksum > 9) { + return parseInt(tin[8], 10) === 0; + } + return checksum === parseInt(tin[8], 10); +}; + +export const vatMatchers = { + /** + * European Union VAT identification numbers + */ + AT: (str) => /^(AT)?U\d{8}$/.test(str), + BE: (str) => /^(BE)?\d{10}$/.test(str), + BG: (str) => /^(BG)?\d{9,10}$/.test(str), + HR: (str) => /^(HR)?\d{11}$/.test(str), + CY: (str) => /^(CY)?\w{9}$/.test(str), + CZ: (str) => /^(CZ)?\d{8,10}$/.test(str), + DK: (str) => /^(DK)?\d{8}$/.test(str), + EE: (str) => /^(EE)?\d{9}$/.test(str), + FI: (str) => /^(FI)?\d{8}$/.test(str), + FR: (str) => /^(FR)?\w{2}\d{9}$/.test(str), + DE: (str) => /^(DE)?\d{9}$/.test(str), + EL: (str) => /^(EL)?\d{9}$/.test(str), + HU: (str) => /^(HU)?\d{8}$/.test(str), + IE: (str) => /^(IE)?\d{7}\w{1}(W)?$/.test(str), + IT: (str) => /^(IT)?\d{11}$/.test(str), + LV: (str) => /^(LV)?\d{11}$/.test(str), + LT: (str) => /^(LT)?\d{9,12}$/.test(str), + LU: (str) => /^(LU)?\d{8}$/.test(str), + MT: (str) => /^(MT)?\d{8}$/.test(str), + NL: (str) => /^(NL)?\d{9}B\d{2}$/.test(str), + PL: (str) => /^(PL)?(\d{10}|(\d{3}-\d{3}-\d{2}-\d{2})|(\d{3}-\d{2}-\d{2}-\d{3}))$/.test(str), + PT, + RO: (str) => /^(RO)?\d{2,10}$/.test(str), + SK: (str) => /^(SK)?\d{10}$/.test(str), + SI: (str) => /^(SI)?\d{8}$/.test(str), + ES: (str) => /^(ES)?\w\d{7}[A-Z]$/.test(str), + SE: (str) => /^(SE)?\d{12}$/.test(str), + + /** + * VAT numbers of non-EU countries + */ + AL: (str) => /^(AL)?\w{9}[A-Z]$/.test(str), + MK: (str) => /^(MK)?\d{13}$/.test(str), + AU: (str) => /^(AU)?\d{11}$/.test(str), + BY: (str) => /^(УНП )?\d{9}$/.test(str), + CA: (str) => /^(CA)?\d{9}$/.test(str), + IS: (str) => /^(IS)?\d{5,6}$/.test(str), + IN: (str) => /^(IN)?\d{15}$/.test(str), + ID: (str) => /^(ID)?(\d{15}|(\d{2}.\d{3}.\d{3}.\d{1}-\d{3}.\d{3}))$/.test(str), + IL: (str) => /^(IL)?\d{9}$/.test(str), + KZ: (str) => /^(KZ)?\d{9}$/.test(str), + NZ: (str) => /^(NZ)?\d{9}$/.test(str), + NG: (str) => /^(NG)?(\d{12}|(\d{8}-\d{4}))$/.test(str), + NO: (str) => /^(NO)?\d{9}MVA$/.test(str), + PH: (str) => /^(PH)?(\d{12}|\d{3} \d{3} \d{3} \d{3})$/.test(str), + RU: (str) => /^(RU)?(\d{10}|\d{12})$/.test(str), + SM: (str) => /^(SM)?\d{5}$/.test(str), + SA: (str) => /^(SA)?\d{15}$/.test(str), + RS: (str) => /^(RS)?\d{9}$/.test(str), + CH: (str) => /^(CH)?(\d{6}|\d{9}|(\d{3}.\d{3})|(\d{3}.\d{3}.\d{3}))(TVA|MWST|IVA)$/.test(str), + TR: (str) => /^(TR)?\d{10}$/.test(str), + UA: (str) => /^(UA)?\d{12}$/.test(str), + GB: (str) => /^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: (str) => /^(UZ)?\d{9}$/.test(str), + + /** + * VAT numbers of Latin American countries + */ + AR: (str) => /^(AR)?\d{11}$/.test(str), + BO: (str) => /^(BO)?\d{7}$/.test(str), + BR: (str) => /^(BR)?((\d{2}.\d{3}.\d{3}\/\d{4}-\d{2})|(\d{3}.\d{3}.\d{3}-\d{2}))$/.test(str), + CL: (str) => /^(CL)?\d{8}-\d{1}$/.test(str), + CO: (str) => /^(CO)?\d{10}$/.test(str), + CR: (str) => /^(CR)?\d{9,12}$/.test(str), + EC: (str) => /^(EC)?\d{13}$/.test(str), + SV: (str) => /^(SV)?\d{4}-\d{6}-\d{3}-\d{1}$/.test(str), + GT: (str) => /^(GT)?\d{7}-\d{1}$/.test(str), + HN: (str) => /^(HN)?$/.test(str), + MX: (str) => /^(MX)?\w{3,4}\d{6}\w{3}$/.test(str), + NI: (str) => /^(NI)?\d{3}-\d{6}-\d{4}\w{1}$/.test(str), + PA: (str) => /^(PA)?$/.test(str), + PY: (str) => /^(PY)?\d{6,8}-\d{1}$/.test(str), + PE: (str) => /^(PE)?\d{11}$/.test(str), + DO: (str) => /^(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: (str) => /^(UY)?\d{12}$/.test(str), + VE: (str) => /^(VE)?[J,G,V,E]{1}-(\d{9}|(\d{8}-\d{1}))$/.test(str), +}; + +export default function isVAT(str, countryCode) { + assertString(str); + assertString(countryCode); + + if (countryCode in vatMatchers) { + return vatMatchers[countryCode](str); + } + throw new Error(`Invalid country code: '${countryCode}'`); +} diff --git a/src/lib/util/algorithms.js b/src/lib/util/algorithms.js index 4ac1f2784..d5eee6390 100644 --- a/src/lib/util/algorithms.js +++ b/src/lib/util/algorithms.js @@ -11,8 +11,8 @@ export function iso7064Check(str) { let checkvalue = 10; for (let i = 0; i < str.length - 1; i++) { - checkvalue = (parseInt(str[i], 10) + checkvalue) % 10 === 0 ? (10 * 2) % 11 : - (((parseInt(str[i], 10) + checkvalue) % 10) * 2) % 11; + checkvalue = (parseInt(str[i], 10) + checkvalue) % 10 === 0 ? (10 * 2) % 11 + : (((parseInt(str[i], 10) + checkvalue) % 10) * 2) % 11; } checkvalue = checkvalue === 1 ? 0 : 11 - checkvalue; return checkvalue === parseInt(str[10], 10); @@ -31,7 +31,7 @@ export function luhnCheck(str) { const product = parseInt(str[i], 10) * 2; if (product > 9) { // sum digits of product and add to checksum - checksum += product.toString().split('').map(a => parseInt(a, 10)).reduce((a, b) => a + b, 0); + checksum += product.toString().split('').map((a) => parseInt(a, 10)).reduce((a, b) => a + b, 0); } else { checksum += product; } diff --git a/src/lib/util/includes.js b/src/lib/util/includes.js index 70ace8857..e039dafc8 100644 --- a/src/lib/util/includes.js +++ b/src/lib/util/includes.js @@ -1,3 +1,3 @@ -const includes = (arr, val) => arr.some(arrVal => val === arrVal); +const includes = (arr, val) => arr.some((arrVal) => val === arrVal); export default includes; diff --git a/src/lib/util/merge.js b/src/lib/util/merge.js index 071477696..2f03bc203 100644 --- a/src/lib/util/merge.js +++ b/src/lib/util/merge.js @@ -1,3 +1,4 @@ +// eslint-disable-next-line default-param-last export default function merge(obj = { }, defaults) { for (const key in defaults) { if (typeof obj[key] === 'undefined') { diff --git a/test/client-side.js b/test/client-side.js index f0b5ca72c..e62761648 100644 --- a/test/client-side.js +++ b/test/client-side.js @@ -8,7 +8,8 @@ describe('Minified version', () => { if ({}.hasOwnProperty.call(validator, key)) { assert.strictEqual( typeof validator[key], - typeof min[key], `Minified version did not export ${key}` + typeof min[key], + `Minified version did not export ${key}` ); } } diff --git a/test/exports.js b/test/exports.js index 0bff532ab..bbbade449 100644 --- a/test/exports.js +++ b/test/exports.js @@ -21,7 +21,8 @@ describe('Exports', () => { it('should export the version number', () => { /* eslint-disable global-require */ assert.strictEqual( - validator.version, require('../package.json').version, + validator.version, + require('../package.json').version, 'Version number mismatch in "package.json" vs. "validator.js"' ); /* eslint-enable global-require */ diff --git a/test/sanitizers.js b/test/sanitizers.js index ecb0e128f..d28a374b4 100644 --- a/test/sanitizers.js +++ b/test/sanitizers.js @@ -17,7 +17,10 @@ function test(options) { if (result !== expected) { let warning = format( 'validator.%s(%s) returned "%s" but should have returned "%s"', - options.sanitizer, args.join(', '), result, expected + options.sanitizer, + args.join(', '), + result, + expected ); throw new Error(warning); @@ -107,7 +110,6 @@ describe('Sanitizers', () => { expect: { '\\S01010020100001': '01010020100001' }, }); - test({ sanitizer: 'rtrim', args: ['01'], diff --git a/test/validators.js b/test/validators.js index c0e36bec7..2d6bd89d2 100644 --- a/test/validators.js +++ b/test/validators.js @@ -17,7 +17,8 @@ function test(options) { } catch (err) { let warning = format( 'validator.%s(%s) passed but should error', - options.validator, args.join(', ') + options.validator, + args.join(', ') ); throw new Error(warning); } @@ -29,7 +30,8 @@ function test(options) { if (validator[options.validator](...args) !== true) { let warning = format( 'validator.%s(%s) failed but should have passed', - options.validator, args.join(', ') + options.validator, + args.join(', ') ); throw new Error(warning); } @@ -41,7 +43,8 @@ function test(options) { if (validator[options.validator](...args) !== false) { let warning = format( 'validator.%s(%s) passed but should have failed', - options.validator, args.join(', ') + options.validator, + args.join(', ') ); throw new Error(warning); } @@ -139,7 +142,6 @@ describe('Validators', () => { }); }); - it('should validate email addresses without UTF8 characters in local part', () => { test({ validator: 'isEmail', @@ -309,7 +311,6 @@ describe('Validators', () => { }); }); - it('should validate really long emails if ignore_max_length is set', () => { test({ validator: 'isEmail', @@ -505,7 +506,6 @@ describe('Validators', () => { }); }); - it('should validate URLs with any protocol', () => { test({ validator: 'isURL', @@ -2854,7 +2854,6 @@ describe('Validators', () => { ], }); - test({ validator: 'isPassportNumber', args: ['ID'], @@ -3860,7 +3859,6 @@ describe('Validators', () => { }); }); - it('should validate imei strings', () => { test({ validator: 'isIMEI', @@ -3880,7 +3878,6 @@ describe('Validators', () => { }); }); - it('should validate imei strings with hyphens', () => { test({ validator: 'isIMEI', @@ -3901,7 +3898,6 @@ describe('Validators', () => { }); }); - it('should validate uppercase strings', () => { test({ validator: 'isUppercase', @@ -5246,7 +5242,6 @@ describe('Validators', () => { }); }); - it('should validate credit cards without a proper provider', () => { test({ validator: 'isCreditCard', @@ -5262,7 +5257,6 @@ describe('Validators', () => { }); }); - it('should validate AmEx provided credit cards', () => { test({ validator: 'isCreditCard', @@ -5298,7 +5292,6 @@ describe('Validators', () => { }); }); - it('should validate Diners Club provided credit cards', () => { test({ validator: 'isCreditCard', @@ -5408,7 +5401,6 @@ describe('Validators', () => { }); }); - it('should validate Mastercard provided credit cards', () => { test({ validator: 'isCreditCard', @@ -5444,7 +5436,6 @@ describe('Validators', () => { }); }); - it('should validate Union Pay provided credit cards', () => { test({ validator: 'isCreditCard', @@ -5479,7 +5470,6 @@ describe('Validators', () => { }); }); - it('should validate Visa provided credit cards', () => { test({ validator: 'isCreditCard', @@ -5515,7 +5505,6 @@ describe('Validators', () => { }); }); - it('should validate identity cards', () => { const fixtures = [ { @@ -6354,13 +6343,13 @@ describe('Validators', () => { 'TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4=', 'Vml2YW11cyBmZXJtZW50dW0gc2VtcGVyIHBvcnRhLg==', 'U3VzcGVuZGlzc2UgbGVjdHVzIGxlbw==', - 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuMPNS1Ufof9EW/M98FNw' + - 'UAKrwflsqVxaxQjBQnHQmiI7Vac40t8x7pIb8gLGV6wL7sBTJiPovJ0V7y7oc0Ye' + - 'rhKh0Rm4skP2z/jHwwZICgGzBvA0rH8xlhUiTvcwDCJ0kc+fh35hNt8srZQM4619' + - 'FTgB66Xmp4EtVyhpQV+t02g6NzK72oZI0vnAvqhpkxLeLiMCyrI416wHm5Tkukhx' + - 'QmcL2a6hNOyu0ixX/x2kSFXApEnVrJ+/IxGyfyw8kf4N2IZpW5nEP847lpfj0SZZ' + - 'Fwrd1mnfnDbYohX2zRptLy2ZUn06Qo9pkG5ntvFEPo9bfZeULtjYzIl6K8gJ2uGZ' + - 'HQIDAQAB', + 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuMPNS1Ufof9EW/M98FNw' + + 'UAKrwflsqVxaxQjBQnHQmiI7Vac40t8x7pIb8gLGV6wL7sBTJiPovJ0V7y7oc0Ye' + + 'rhKh0Rm4skP2z/jHwwZICgGzBvA0rH8xlhUiTvcwDCJ0kc+fh35hNt8srZQM4619' + + 'FTgB66Xmp4EtVyhpQV+t02g6NzK72oZI0vnAvqhpkxLeLiMCyrI416wHm5Tkukhx' + + 'QmcL2a6hNOyu0ixX/x2kSFXApEnVrJ+/IxGyfyw8kf4N2IZpW5nEP847lpfj0SZZ' + + 'Fwrd1mnfnDbYohX2zRptLy2ZUn06Qo9pkG5ntvFEPo9bfZeULtjYzIl6K8gJ2uGZ' + + 'HQIDAQAB', ], invalid: [ '12345', @@ -9686,7 +9675,6 @@ describe('Validators', () => { args: [], }); - it('should error on invalid locale', () => { test({ validator: 'isMobilePhone', @@ -11123,7 +11111,6 @@ describe('Validators', () => { /* eslint-enable max-len */ }); - it('should validate magnetURI', () => { /* eslint-disable max-len */ test({ @@ -11157,7 +11144,6 @@ describe('Validators', () => { /* eslint-enable max-len */ }); - it('should validate LatLong', () => { test({ validator: 'isLatLong', @@ -12384,7 +12370,6 @@ describe('Validators', () => { }); }); - it('should validate slug', () => { test({ validator: 'isSlug', From ad624ae3f086b0e7c8c01128bffc0819c691d05a Mon Sep 17 00:00:00 2001 From: SCG82 Date: Thu, 12 Jan 2023 22:54:16 +0000 Subject: [PATCH 02/12] add file extensions to all relative imports --- .eslintrc.json | 13 +- build-browser.js | 33 +++-- package.json | 21 +++ src/index.js | 240 +++++++++++++++++------------------ src/lib/blacklist.js | 2 +- src/lib/contains.js | 6 +- src/lib/equals.js | 2 +- src/lib/escape.js | 2 +- src/lib/isAfter.js | 4 +- src/lib/isAlpha.js | 4 +- src/lib/isAlphanumeric.js | 4 +- src/lib/isAscii.js | 2 +- src/lib/isBIC.js | 4 +- src/lib/isBase32.js | 4 +- src/lib/isBase58.js | 2 +- src/lib/isBase64.js | 4 +- src/lib/isBefore.js | 4 +- src/lib/isBoolean.js | 2 +- src/lib/isBtcAddress.js | 2 +- src/lib/isByteLength.js | 2 +- src/lib/isCreditCard.js | 4 +- src/lib/isCurrency.js | 4 +- src/lib/isDataURI.js | 2 +- src/lib/isDate.js | 2 +- src/lib/isDecimal.js | 8 +- src/lib/isDivisibleBy.js | 4 +- src/lib/isEAN.js | 2 +- src/lib/isEmail.js | 10 +- src/lib/isEmpty.js | 4 +- src/lib/isEthereumAddress.js | 2 +- src/lib/isFQDN.js | 4 +- src/lib/isFloat.js | 4 +- src/lib/isFullWidth.js | 2 +- src/lib/isHSL.js | 2 +- src/lib/isHalfWidth.js | 2 +- src/lib/isHash.js | 2 +- src/lib/isHexColor.js | 2 +- src/lib/isHexadecimal.js | 2 +- src/lib/isIBAN.js | 2 +- src/lib/isIMEI.js | 2 +- src/lib/isIP.js | 2 +- src/lib/isIPRange.js | 4 +- src/lib/isISBN.js | 2 +- src/lib/isISIN.js | 2 +- src/lib/isISO31661Alpha2.js | 2 +- src/lib/isISO31661Alpha3.js | 2 +- src/lib/isISO4217.js | 2 +- src/lib/isISO6391.js | 2 +- src/lib/isISO8601.js | 2 +- src/lib/isISRC.js | 2 +- src/lib/isISSN.js | 2 +- src/lib/isIdentityCard.js | 4 +- src/lib/isIn.js | 4 +- src/lib/isInt.js | 2 +- src/lib/isJSON.js | 4 +- src/lib/isJWT.js | 4 +- src/lib/isLatLong.js | 4 +- src/lib/isLength.js | 2 +- src/lib/isLicensePlate.js | 2 +- src/lib/isLocale.js | 2 +- src/lib/isLowercase.js | 2 +- src/lib/isLuhnValid.js | 2 +- src/lib/isMACAddress.js | 2 +- src/lib/isMD5.js | 2 +- src/lib/isMagnetURI.js | 2 +- src/lib/isMimeType.js | 2 +- src/lib/isMobilePhone.js | 2 +- src/lib/isMongoId.js | 4 +- src/lib/isMultibyte.js | 2 +- src/lib/isNumeric.js | 4 +- src/lib/isOctal.js | 2 +- src/lib/isPassportNumber.js | 2 +- src/lib/isPort.js | 2 +- src/lib/isPostalCode.js | 2 +- src/lib/isRFC3339.js | 2 +- src/lib/isRgbColor.js | 2 +- src/lib/isSemVer.js | 4 +- src/lib/isSlug.js | 2 +- src/lib/isStrongPassword.js | 4 +- src/lib/isSurrogatePair.js | 2 +- src/lib/isTaxID.js | 6 +- src/lib/isURL.js | 8 +- src/lib/isUUID.js | 2 +- src/lib/isUppercase.js | 2 +- src/lib/isVAT.js | 4 +- src/lib/isVariableWidth.js | 6 +- src/lib/isWhitelisted.js | 2 +- src/lib/ltrim.js | 2 +- src/lib/matches.js | 2 +- src/lib/normalizeEmail.js | 2 +- src/lib/rtrim.js | 2 +- src/lib/stripLow.js | 4 +- src/lib/toBoolean.js | 2 +- src/lib/toDate.js | 2 +- src/lib/toFloat.js | 2 +- src/lib/toInt.js | 2 +- src/lib/trim.js | 4 +- src/lib/unescape.js | 2 +- src/lib/whitelist.js | 2 +- test/client-side.js | 4 +- test/exports.js | 14 +- test/sanitizers.js | 2 +- test/util.js | 2 +- test/validators.js | 2 +- 104 files changed, 316 insertions(+), 289 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index dbe36022a..128c383d7 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -36,6 +36,15 @@ "allowForLoopAfterthoughts": true }], "no-prototype-builtins": 0, - "no-useless-escape": 0 - } + "no-useless-escape": 0, + "node/file-extension-in-import": ["error", "always"] + }, + "overrides": [ + { + "files": ["*.js"], + "rules": { + "import/extensions": "off" + } + } + ] } diff --git a/build-browser.js b/build-browser.js index 302382f6a..4a5ca7a08 100644 --- a/build-browser.js +++ b/build-browser.js @@ -1,12 +1,11 @@ /* eslint import/no-extraneous-dependencies: 0 */ -import fs from "fs"; -import { rollup } from "rollup"; -import babel from "@rollup/plugin-babel"; -import babelPresetEnv from "@babel/preset-env"; -import pkg from "./package.json"; +import fs from 'fs'; +import { rollup } from 'rollup'; +import babel from '@rollup/plugin-babel'; +import babelPresetEnv from '@babel/preset-env'; rollup({ - input: "src/index.js", + input: 'src/index.js', plugins: [ babel({ presets: [[babelPresetEnv, { modules: false }]], @@ -14,18 +13,16 @@ rollup({ }), ], }) - .then((bundle) => - bundle.write({ - file: "validator.js", - format: "umd", - name: pkg.name, - banner: `/*!\n${String(fs.readFileSync("./LICENSE")) - .trim() - .split("\n") - .map((l) => ` * ${l}`) - .join("\n")}\n */`, - }) - ) + .then((bundle) => bundle.write({ + file: 'validator.js', + format: 'umd', + name: 'validator', + banner: `/*!\n${String(fs.readFileSync('./LICENSE')) + .trim() + .split('\n') + .map((l) => ` * ${l}`) + .join('\n')}\n */`, + })) .catch((e) => { process.stderr.write(`${e.message}\n`); process.exit(1); diff --git a/package.json b/package.json index 45a050c66..d6873202b 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,27 @@ "Anthony Nandaa (https://github.com/profnandaa)" ], "main": "index.js", + "module": "./es/index.js", + "exports": { + ".": { + "import": "./es/index.js", + "require": "./index.js" + }, + "./index.js": { + "import": "./es/index.js", + "require": "./index.js" + }, + "./es": "./es/index.js", + "./es/lib/*": "./es/lib/*.js", + "./es/*": "./es/lib/*.js", + "./package.json": "./package.json", + "./validator.js": "./validator.js", + "./validator.min.js": "./validator.min.js", + "./*": { + "import": "./es/lib/*.js", + "require": "./lib/*.js" + } + }, "bugs": { "url": "https://github.com/validatorjs/validator.js/issues" }, diff --git a/src/index.js b/src/index.js index 42e1e8b69..22a12e391 100644 --- a/src/index.js +++ b/src/index.js @@ -1,127 +1,127 @@ -import toDate from './lib/toDate'; -import toFloat from './lib/toFloat'; -import toInt from './lib/toInt'; -import toBoolean from './lib/toBoolean'; -import equals from './lib/equals'; -import contains from './lib/contains'; -import matches from './lib/matches'; - -import isEmail from './lib/isEmail'; -import isURL from './lib/isURL'; -import isMACAddress from './lib/isMACAddress'; -import isIP from './lib/isIP'; -import isIPRange from './lib/isIPRange'; -import isFQDN from './lib/isFQDN'; -import isDate from './lib/isDate'; - -import isBoolean from './lib/isBoolean'; -import isLocale from './lib/isLocale'; - -import isAlpha, { locales as isAlphaLocales } from './lib/isAlpha'; -import isAlphanumeric, { locales as isAlphanumericLocales } from './lib/isAlphanumeric'; -import isNumeric from './lib/isNumeric'; -import isPassportNumber from './lib/isPassportNumber'; -import isPort from './lib/isPort'; -import isLowercase from './lib/isLowercase'; -import isUppercase from './lib/isUppercase'; - -import isIMEI from './lib/isIMEI'; - -import isAscii from './lib/isAscii'; -import isFullWidth from './lib/isFullWidth'; -import isHalfWidth from './lib/isHalfWidth'; -import isVariableWidth from './lib/isVariableWidth'; -import isMultibyte from './lib/isMultibyte'; -import isSemVer from './lib/isSemVer'; -import isSurrogatePair from './lib/isSurrogatePair'; - -import isInt from './lib/isInt'; -import isFloat, { locales as isFloatLocales } from './lib/isFloat'; -import isDecimal from './lib/isDecimal'; -import isHexadecimal from './lib/isHexadecimal'; -import isOctal from './lib/isOctal'; -import isDivisibleBy from './lib/isDivisibleBy'; - -import isHexColor from './lib/isHexColor'; -import isRgbColor from './lib/isRgbColor'; -import isHSL from './lib/isHSL'; - -import isISRC from './lib/isISRC'; - -import isIBAN, { locales as ibanLocales } from './lib/isIBAN'; -import isBIC from './lib/isBIC'; - -import isMD5 from './lib/isMD5'; -import isHash from './lib/isHash'; -import isJWT from './lib/isJWT'; - -import isJSON from './lib/isJSON'; -import isEmpty from './lib/isEmpty'; - -import isLength from './lib/isLength'; -import isByteLength from './lib/isByteLength'; - -import isUUID from './lib/isUUID'; -import isMongoId from './lib/isMongoId'; - -import isAfter from './lib/isAfter'; -import isBefore from './lib/isBefore'; - -import isIn from './lib/isIn'; - -import isLuhnValid from './lib/isLuhnValid'; -import isCreditCard from './lib/isCreditCard'; -import isIdentityCard from './lib/isIdentityCard'; - -import isEAN from './lib/isEAN'; -import isISIN from './lib/isISIN'; -import isISBN from './lib/isISBN'; -import isISSN from './lib/isISSN'; -import isTaxID from './lib/isTaxID'; - -import isMobilePhone, { locales as isMobilePhoneLocales } from './lib/isMobilePhone'; - -import isEthereumAddress from './lib/isEthereumAddress'; - -import isCurrency from './lib/isCurrency'; - -import isBtcAddress from './lib/isBtcAddress'; - -import isISO6391 from './lib/isISO6391'; -import isISO8601 from './lib/isISO8601'; -import isRFC3339 from './lib/isRFC3339'; -import isISO31661Alpha2 from './lib/isISO31661Alpha2'; -import isISO31661Alpha3 from './lib/isISO31661Alpha3'; -import isISO4217 from './lib/isISO4217'; - -import isBase32 from './lib/isBase32'; -import isBase58 from './lib/isBase58'; -import isBase64 from './lib/isBase64'; -import isDataURI from './lib/isDataURI'; -import isMagnetURI from './lib/isMagnetURI'; - -import isMimeType from './lib/isMimeType'; - -import isLatLong from './lib/isLatLong'; -import isPostalCode, { locales as isPostalCodeLocales } from './lib/isPostalCode'; +import toDate from './lib/toDate.js'; +import toFloat from './lib/toFloat.js'; +import toInt from './lib/toInt.js'; +import toBoolean from './lib/toBoolean.js'; +import equals from './lib/equals.js'; +import contains from './lib/contains.js'; +import matches from './lib/matches.js'; + +import isEmail from './lib/isEmail.js'; +import isURL from './lib/isURL.js'; +import isMACAddress from './lib/isMACAddress.js'; +import isIP from './lib/isIP.js'; +import isIPRange from './lib/isIPRange.js'; +import isFQDN from './lib/isFQDN.js'; +import isDate from './lib/isDate.js'; + +import isBoolean from './lib/isBoolean.js'; +import isLocale from './lib/isLocale.js'; + +import isAlpha, { locales as isAlphaLocales } from './lib/isAlpha.js'; +import isAlphanumeric, { locales as isAlphanumericLocales } from './lib/isAlphanumeric.js'; +import isNumeric from './lib/isNumeric.js'; +import isPassportNumber from './lib/isPassportNumber.js'; +import isPort from './lib/isPort.js'; +import isLowercase from './lib/isLowercase.js'; +import isUppercase from './lib/isUppercase.js'; + +import isIMEI from './lib/isIMEI.js'; + +import isAscii from './lib/isAscii.js'; +import isFullWidth from './lib/isFullWidth.js'; +import isHalfWidth from './lib/isHalfWidth.js'; +import isVariableWidth from './lib/isVariableWidth.js'; +import isMultibyte from './lib/isMultibyte.js'; +import isSemVer from './lib/isSemVer.js'; +import isSurrogatePair from './lib/isSurrogatePair.js'; + +import isInt from './lib/isInt.js'; +import isFloat, { locales as isFloatLocales } from './lib/isFloat.js'; +import isDecimal from './lib/isDecimal.js'; +import isHexadecimal from './lib/isHexadecimal.js'; +import isOctal from './lib/isOctal.js'; +import isDivisibleBy from './lib/isDivisibleBy.js'; + +import isHexColor from './lib/isHexColor.js'; +import isRgbColor from './lib/isRgbColor.js'; +import isHSL from './lib/isHSL.js'; + +import isISRC from './lib/isISRC.js'; + +import isIBAN, { locales as ibanLocales } from './lib/isIBAN.js'; +import isBIC from './lib/isBIC.js'; + +import isMD5 from './lib/isMD5.js'; +import isHash from './lib/isHash.js'; +import isJWT from './lib/isJWT.js'; + +import isJSON from './lib/isJSON.js'; +import isEmpty from './lib/isEmpty.js'; + +import isLength from './lib/isLength.js'; +import isByteLength from './lib/isByteLength.js'; + +import isUUID from './lib/isUUID.js'; +import isMongoId from './lib/isMongoId.js'; + +import isAfter from './lib/isAfter.js'; +import isBefore from './lib/isBefore.js'; + +import isIn from './lib/isIn.js'; + +import isLuhnValid from './lib/isLuhnValid.js'; +import isCreditCard from './lib/isCreditCard.js'; +import isIdentityCard from './lib/isIdentityCard.js'; + +import isEAN from './lib/isEAN.js'; +import isISIN from './lib/isISIN.js'; +import isISBN from './lib/isISBN.js'; +import isISSN from './lib/isISSN.js'; +import isTaxID from './lib/isTaxID.js'; + +import isMobilePhone, { locales as isMobilePhoneLocales } from './lib/isMobilePhone.js'; + +import isEthereumAddress from './lib/isEthereumAddress.js'; + +import isCurrency from './lib/isCurrency.js'; + +import isBtcAddress from './lib/isBtcAddress.js'; + +import isISO6391 from './lib/isISO6391.js'; +import isISO8601 from './lib/isISO8601.js'; +import isRFC3339 from './lib/isRFC3339.js'; +import isISO31661Alpha2 from './lib/isISO31661Alpha2.js'; +import isISO31661Alpha3 from './lib/isISO31661Alpha3.js'; +import isISO4217 from './lib/isISO4217.js'; + +import isBase32 from './lib/isBase32.js'; +import isBase58 from './lib/isBase58.js'; +import isBase64 from './lib/isBase64.js'; +import isDataURI from './lib/isDataURI.js'; +import isMagnetURI from './lib/isMagnetURI.js'; + +import isMimeType from './lib/isMimeType.js'; + +import isLatLong from './lib/isLatLong.js'; +import isPostalCode, { locales as isPostalCodeLocales } from './lib/isPostalCode.js'; -import ltrim from './lib/ltrim'; -import rtrim from './lib/rtrim'; -import trim from './lib/trim'; -import escape from './lib/escape'; -import unescape from './lib/unescape'; -import stripLow from './lib/stripLow'; -import whitelist from './lib/whitelist'; -import blacklist from './lib/blacklist'; -import isWhitelisted from './lib/isWhitelisted'; +import ltrim from './lib/ltrim.js'; +import rtrim from './lib/rtrim.js'; +import trim from './lib/trim.js'; +import escape from './lib/escape.js'; +import unescape from './lib/unescape.js'; +import stripLow from './lib/stripLow.js'; +import whitelist from './lib/whitelist.js'; +import blacklist from './lib/blacklist.js'; +import isWhitelisted from './lib/isWhitelisted.js'; -import normalizeEmail from './lib/normalizeEmail'; +import normalizeEmail from './lib/normalizeEmail.js'; -import isSlug from './lib/isSlug'; -import isLicensePlate from './lib/isLicensePlate'; -import isStrongPassword from './lib/isStrongPassword'; +import isSlug from './lib/isSlug.js'; +import isLicensePlate from './lib/isLicensePlate.js'; +import isStrongPassword from './lib/isStrongPassword.js'; -import isVAT from './lib/isVAT'; +import isVAT from './lib/isVAT.js'; const version = '13.7.0'; diff --git a/src/lib/blacklist.js b/src/lib/blacklist.js index d796dbb10..6839ad738 100644 --- a/src/lib/blacklist.js +++ b/src/lib/blacklist.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; export default function blacklist(str, chars) { assertString(str); diff --git a/src/lib/contains.js b/src/lib/contains.js index 7be314b04..1fd303d74 100644 --- a/src/lib/contains.js +++ b/src/lib/contains.js @@ -1,6 +1,6 @@ -import assertString from './util/assertString'; -import toString from './util/toString'; -import merge from './util/merge'; +import assertString from './util/assertString.js'; +import toString from './util/toString.js'; +import merge from './util/merge.js'; const defaulContainsOptions = { ignoreCase: false, diff --git a/src/lib/equals.js b/src/lib/equals.js index b0307f05a..4107c5321 100644 --- a/src/lib/equals.js +++ b/src/lib/equals.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; export default function equals(str, comparison) { assertString(str); diff --git a/src/lib/escape.js b/src/lib/escape.js index 06562e239..183d3407f 100644 --- a/src/lib/escape.js +++ b/src/lib/escape.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; export default function escape(str) { assertString(str); diff --git a/src/lib/isAfter.js b/src/lib/isAfter.js index 47bfb537f..85ff3fcb6 100644 --- a/src/lib/isAfter.js +++ b/src/lib/isAfter.js @@ -1,5 +1,5 @@ -import assertString from './util/assertString'; -import toDate from './toDate'; +import assertString from './util/assertString.js'; +import toDate from './toDate.js'; export default function isAfter(str, date = String(new Date())) { assertString(str); diff --git a/src/lib/isAlpha.js b/src/lib/isAlpha.js index e961e64eb..c9b6b7a86 100644 --- a/src/lib/isAlpha.js +++ b/src/lib/isAlpha.js @@ -1,5 +1,5 @@ -import assertString from './util/assertString'; -import { alpha } from './alpha'; +import assertString from './util/assertString.js'; +import { alpha } from './alpha.js'; export default function isAlpha(_str, locale = 'en-US', options = {}) { assertString(_str); diff --git a/src/lib/isAlphanumeric.js b/src/lib/isAlphanumeric.js index b259ab908..e08de7504 100644 --- a/src/lib/isAlphanumeric.js +++ b/src/lib/isAlphanumeric.js @@ -1,5 +1,5 @@ -import assertString from './util/assertString'; -import { alphanumeric } from './alpha'; +import assertString from './util/assertString.js'; +import { alphanumeric } from './alpha.js'; export default function isAlphanumeric(_str, locale = 'en-US', options = {}) { assertString(_str); diff --git a/src/lib/isAscii.js b/src/lib/isAscii.js index 6bce344de..038dd68ad 100644 --- a/src/lib/isAscii.js +++ b/src/lib/isAscii.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; /* eslint-disable no-control-regex */ const ascii = /^[\x00-\x7F]+$/; diff --git a/src/lib/isBIC.js b/src/lib/isBIC.js index b5576b24e..5d53f807e 100644 --- a/src/lib/isBIC.js +++ b/src/lib/isBIC.js @@ -1,5 +1,5 @@ -import assertString from './util/assertString'; -import { CountryCodes } from './isISO31661Alpha2'; +import assertString from './util/assertString.js'; +import { CountryCodes } from './isISO31661Alpha2.js'; // https://en.wikipedia.org/wiki/ISO_9362 const isBICReg = /^[A-Za-z]{6}[A-Za-z0-9]{2}([A-Za-z0-9]{3})?$/; diff --git a/src/lib/isBase32.js b/src/lib/isBase32.js index 5e2969cbc..766a3ab58 100644 --- a/src/lib/isBase32.js +++ b/src/lib/isBase32.js @@ -1,5 +1,5 @@ -import assertString from './util/assertString'; -import merge from './util/merge'; +import assertString from './util/assertString.js'; +import merge from './util/merge.js'; const base32 = /^[A-Z2-7]+=*$/; const crockfordBase32 = /^[A-HJKMNP-TV-Z0-9]+$/; diff --git a/src/lib/isBase58.js b/src/lib/isBase58.js index 05c46dc18..4b1ffd861 100644 --- a/src/lib/isBase58.js +++ b/src/lib/isBase58.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; // Accepted chars - 123456789ABCDEFGH JKLMN PQRSTUVWXYZabcdefghijk mnopqrstuvwxyz const base58Reg = /^[A-HJ-NP-Za-km-z1-9]*$/; diff --git a/src/lib/isBase64.js b/src/lib/isBase64.js index d43f37113..0abe10529 100644 --- a/src/lib/isBase64.js +++ b/src/lib/isBase64.js @@ -1,5 +1,5 @@ -import assertString from './util/assertString'; -import merge from './util/merge'; +import assertString from './util/assertString.js'; +import merge from './util/merge.js'; const notBase64 = /[^A-Z0-9+\/=]/i; const urlSafeBase64 = /^[A-Z0-9_\-]*$/i; diff --git a/src/lib/isBefore.js b/src/lib/isBefore.js index 8314f0e14..1a8213881 100644 --- a/src/lib/isBefore.js +++ b/src/lib/isBefore.js @@ -1,5 +1,5 @@ -import assertString from './util/assertString'; -import toDate from './toDate'; +import assertString from './util/assertString.js'; +import toDate from './toDate.js'; export default function isBefore(str, date = String(new Date())) { assertString(str); diff --git a/src/lib/isBoolean.js b/src/lib/isBoolean.js index 9fddc2b48..76b13f56e 100644 --- a/src/lib/isBoolean.js +++ b/src/lib/isBoolean.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; const defaultOptions = { loose: false }; const strictBooleans = ['true', 'false', '1', '0']; diff --git a/src/lib/isBtcAddress.js b/src/lib/isBtcAddress.js index 2dfd04651..679923848 100644 --- a/src/lib/isBtcAddress.js +++ b/src/lib/isBtcAddress.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; // supports Bech32 addresses const bech32 = /^(bc1)[a-z0-9]{25,39}$/; diff --git a/src/lib/isByteLength.js b/src/lib/isByteLength.js index 619d7f604..16514d6f7 100644 --- a/src/lib/isByteLength.js +++ b/src/lib/isByteLength.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; /* eslint-disable prefer-rest-params */ export default function isByteLength(str, options) { diff --git a/src/lib/isCreditCard.js b/src/lib/isCreditCard.js index 0a874c9cf..b7f755ae6 100644 --- a/src/lib/isCreditCard.js +++ b/src/lib/isCreditCard.js @@ -1,5 +1,5 @@ -import assertString from './util/assertString'; -import isLuhnValid from './isLuhnValid'; +import assertString from './util/assertString.js'; +import isLuhnValid from './isLuhnValid.js'; const cards = { amex: /^3[47][0-9]{13}$/, diff --git a/src/lib/isCurrency.js b/src/lib/isCurrency.js index 7a855be7d..7a68bbafa 100755 --- a/src/lib/isCurrency.js +++ b/src/lib/isCurrency.js @@ -1,5 +1,5 @@ -import merge from './util/merge'; -import assertString from './util/assertString'; +import merge from './util/merge.js'; +import assertString from './util/assertString.js'; function currencyRegex(options) { let decimal_digits = `\\d{${options.digits_after_decimal[0]}}`; diff --git a/src/lib/isDataURI.js b/src/lib/isDataURI.js index a293782ba..2fc96540d 100644 --- a/src/lib/isDataURI.js +++ b/src/lib/isDataURI.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; const validMediaType = /^[a-z]+\/[a-z0-9\-\+\.]+$/i; diff --git a/src/lib/isDate.js b/src/lib/isDate.js index 7d05ede6a..fcc974e7f 100644 --- a/src/lib/isDate.js +++ b/src/lib/isDate.js @@ -1,4 +1,4 @@ -import merge from './util/merge'; +import merge from './util/merge.js'; const default_date_options = { format: 'YYYY/MM/DD', diff --git a/src/lib/isDecimal.js b/src/lib/isDecimal.js index 488668a52..4d3b54595 100644 --- a/src/lib/isDecimal.js +++ b/src/lib/isDecimal.js @@ -1,7 +1,7 @@ -import merge from './util/merge'; -import assertString from './util/assertString'; -import includes from './util/includes'; -import { decimal } from './alpha'; +import merge from './util/merge.js'; +import assertString from './util/assertString.js'; +import includes from './util/includes.js'; +import { decimal } from './alpha.js'; function decimalRegExp(options) { const regExp = new RegExp(`^[-+]?([0-9]+)?(\\${decimal[options.locale]}[0-9]{${options.decimal_digits}})${options.force_decimal ? '' : '?'}$`); diff --git a/src/lib/isDivisibleBy.js b/src/lib/isDivisibleBy.js index 2f6c65363..b418be5d1 100644 --- a/src/lib/isDivisibleBy.js +++ b/src/lib/isDivisibleBy.js @@ -1,5 +1,5 @@ -import assertString from './util/assertString'; -import toFloat from './toFloat'; +import assertString from './util/assertString.js'; +import toFloat from './toFloat.js'; export default function isDivisibleBy(str, num) { assertString(str); diff --git a/src/lib/isEAN.js b/src/lib/isEAN.js index 48d27aafa..7843171b7 100644 --- a/src/lib/isEAN.js +++ b/src/lib/isEAN.js @@ -12,7 +12,7 @@ * Reference: https://www.gtin.info/ */ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; /** * Define EAN Lenghts; 8 for EAN-8; 13 for EAN-13; 14 for EAN-14 diff --git a/src/lib/isEmail.js b/src/lib/isEmail.js index 179b44f0e..21fe686f8 100644 --- a/src/lib/isEmail.js +++ b/src/lib/isEmail.js @@ -1,9 +1,9 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; -import merge from './util/merge'; -import isByteLength from './isByteLength'; -import isFQDN from './isFQDN'; -import isIP from './isIP'; +import merge from './util/merge.js'; +import isByteLength from './isByteLength.js'; +import isFQDN from './isFQDN.js'; +import isIP from './isIP.js'; const default_email_options = { allow_display_name: false, diff --git a/src/lib/isEmpty.js b/src/lib/isEmpty.js index eeb5997d0..4b569f280 100644 --- a/src/lib/isEmpty.js +++ b/src/lib/isEmpty.js @@ -1,5 +1,5 @@ -import assertString from './util/assertString'; -import merge from './util/merge'; +import assertString from './util/assertString.js'; +import merge from './util/merge.js'; const default_is_empty_options = { ignore_whitespace: false, diff --git a/src/lib/isEthereumAddress.js b/src/lib/isEthereumAddress.js index e538760bf..fb5a8c013 100644 --- a/src/lib/isEthereumAddress.js +++ b/src/lib/isEthereumAddress.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; const eth = /^(0x)[0-9a-f]{40}$/i; diff --git a/src/lib/isFQDN.js b/src/lib/isFQDN.js index 884d1dd6f..4994f9508 100644 --- a/src/lib/isFQDN.js +++ b/src/lib/isFQDN.js @@ -1,5 +1,5 @@ -import assertString from './util/assertString'; -import merge from './util/merge'; +import assertString from './util/assertString.js'; +import merge from './util/merge.js'; const default_fqdn_options = { require_tld: true, diff --git a/src/lib/isFloat.js b/src/lib/isFloat.js index 3fa35fb3a..8e79a157d 100644 --- a/src/lib/isFloat.js +++ b/src/lib/isFloat.js @@ -1,5 +1,5 @@ -import assertString from './util/assertString'; -import { decimal } from './alpha'; +import assertString from './util/assertString.js'; +import { decimal } from './alpha.js'; export default function isFloat(str, options) { assertString(str); diff --git a/src/lib/isFullWidth.js b/src/lib/isFullWidth.js index a3734d11f..9820a126c 100644 --- a/src/lib/isFullWidth.js +++ b/src/lib/isFullWidth.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; export const fullWidth = /[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/; diff --git a/src/lib/isHSL.js b/src/lib/isHSL.js index 8787a6619..96bd7cfdc 100644 --- a/src/lib/isHSL.js +++ b/src/lib/isHSL.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; const hslComma = /^hsla?\(((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?))(deg|grad|rad|turn)?(,(\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%){2}(,((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%?))?\)$/i; const hslSpace = /^hsla?\(((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?))(deg|grad|rad|turn)?(\s(\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%){2}\s?(\/\s((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%?)\s?)?\)$/i; diff --git a/src/lib/isHalfWidth.js b/src/lib/isHalfWidth.js index b6ace42fc..d02bd0c7c 100644 --- a/src/lib/isHalfWidth.js +++ b/src/lib/isHalfWidth.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; export const halfWidth = /[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/; diff --git a/src/lib/isHash.js b/src/lib/isHash.js index 6efe7c035..83dea6101 100644 --- a/src/lib/isHash.js +++ b/src/lib/isHash.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; const lengths = { md5: 32, diff --git a/src/lib/isHexColor.js b/src/lib/isHexColor.js index 21a037504..747bd20c4 100644 --- a/src/lib/isHexColor.js +++ b/src/lib/isHexColor.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; const hexcolor = /^#?([0-9A-F]{3}|[0-9A-F]{4}|[0-9A-F]{6}|[0-9A-F]{8})$/i; diff --git a/src/lib/isHexadecimal.js b/src/lib/isHexadecimal.js index 19adb077a..556aec3d7 100644 --- a/src/lib/isHexadecimal.js +++ b/src/lib/isHexadecimal.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; const hexadecimal = /^(0x|0h)?[0-9A-F]+$/i; diff --git a/src/lib/isIBAN.js b/src/lib/isIBAN.js index c629ebaf5..2b0edb9aa 100644 --- a/src/lib/isIBAN.js +++ b/src/lib/isIBAN.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; /** * List of country codes with diff --git a/src/lib/isIMEI.js b/src/lib/isIMEI.js index 6bd594c87..c428bb93b 100644 --- a/src/lib/isIMEI.js +++ b/src/lib/isIMEI.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; let imeiRegexWithoutHypens = /^[0-9]{15}$/; let imeiRegexWithHypens = /^\d{2}-\d{6}-\d{6}-\d{1}$/; diff --git a/src/lib/isIP.js b/src/lib/isIP.js index 9244938b2..e1b96148a 100644 --- a/src/lib/isIP.js +++ b/src/lib/isIP.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; /** 11.3. Examples diff --git a/src/lib/isIPRange.js b/src/lib/isIPRange.js index 5bb6916c5..49755a5f0 100644 --- a/src/lib/isIPRange.js +++ b/src/lib/isIPRange.js @@ -1,5 +1,5 @@ -import assertString from './util/assertString'; -import isIP from './isIP'; +import assertString from './util/assertString.js'; +import isIP from './isIP.js'; const subnetMaybe = /^\d{1,3}$/; const v4Subnet = 32; diff --git a/src/lib/isISBN.js b/src/lib/isISBN.js index c66c4c991..a04728322 100644 --- a/src/lib/isISBN.js +++ b/src/lib/isISBN.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; const isbn10Maybe = /^(?:[0-9]{9}X|[0-9]{10})$/; const isbn13Maybe = /^(?:[0-9]{13})$/; diff --git a/src/lib/isISIN.js b/src/lib/isISIN.js index a6f6fa645..2507b8fdd 100644 --- a/src/lib/isISIN.js +++ b/src/lib/isISIN.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; const isin = /^[A-Z]{2}[0-9A-Z]{9}[0-9]$/; diff --git a/src/lib/isISO31661Alpha2.js b/src/lib/isISO31661Alpha2.js index e67bb1e15..df25cda45 100644 --- a/src/lib/isISO31661Alpha2.js +++ b/src/lib/isISO31661Alpha2.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; // from https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 const validISO31661Alpha2CountriesCodes = new Set([ diff --git a/src/lib/isISO31661Alpha3.js b/src/lib/isISO31661Alpha3.js index 34e552cdd..ad27151d4 100644 --- a/src/lib/isISO31661Alpha3.js +++ b/src/lib/isISO31661Alpha3.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; // from https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3 const validISO31661Alpha3CountriesCodes = new Set([ diff --git a/src/lib/isISO4217.js b/src/lib/isISO4217.js index 0738614c9..4b0b546a1 100644 --- a/src/lib/isISO4217.js +++ b/src/lib/isISO4217.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; // from https://en.wikipedia.org/wiki/ISO_4217 const validISO4217CurrencyCodes = new Set([ diff --git a/src/lib/isISO6391.js b/src/lib/isISO6391.js index eaa01c5b4..eab0ffb13 100644 --- a/src/lib/isISO6391.js +++ b/src/lib/isISO6391.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; const isISO6391Set = new Set([ 'aa', 'ab', 'ae', 'af', 'ak', 'am', 'an', 'ar', 'as', 'av', 'ay', 'az', 'az', diff --git a/src/lib/isISO8601.js b/src/lib/isISO8601.js index 1f797347d..4955d99df 100644 --- a/src/lib/isISO8601.js +++ b/src/lib/isISO8601.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; /* eslint-disable max-len */ // from http://goo.gl/0ejHHW diff --git a/src/lib/isISRC.js b/src/lib/isISRC.js index 052f7657a..88eb49965 100644 --- a/src/lib/isISRC.js +++ b/src/lib/isISRC.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; // see http://isrc.ifpi.org/en/isrc-standard/code-syntax const isrc = /^[A-Z]{2}[0-9A-Z]{3}\d{2}\d{5}$/; diff --git a/src/lib/isISSN.js b/src/lib/isISSN.js index 42b9ad7eb..436bbb471 100644 --- a/src/lib/isISSN.js +++ b/src/lib/isISSN.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; const issn = '^\\d{4}-?\\d{3}[\\dX]$'; diff --git a/src/lib/isIdentityCard.js b/src/lib/isIdentityCard.js index 3db2cb3bd..ff1162a16 100644 --- a/src/lib/isIdentityCard.js +++ b/src/lib/isIdentityCard.js @@ -1,6 +1,6 @@ /* eslint-disable max-len */ -import assertString from './util/assertString'; -import isInt from './isInt'; +import assertString from './util/assertString.js'; +import isInt from './isInt.js'; const validators = { PL: (str) => { diff --git a/src/lib/isIn.js b/src/lib/isIn.js index 56ec76cdb..396cc2830 100644 --- a/src/lib/isIn.js +++ b/src/lib/isIn.js @@ -1,5 +1,5 @@ -import assertString from './util/assertString'; -import toString from './util/toString'; +import assertString from './util/assertString.js'; +import toString from './util/toString.js'; export default function isIn(str, options) { assertString(str); diff --git a/src/lib/isInt.js b/src/lib/isInt.js index d38f9b14a..93b22bd51 100644 --- a/src/lib/isInt.js +++ b/src/lib/isInt.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; const int = /^(?:[-+]?(?:0|[1-9][0-9]*))$/; const intLeadingZeroes = /^[-+]?[0-9]+$/; diff --git a/src/lib/isJSON.js b/src/lib/isJSON.js index d3731e337..d8efb3d2e 100644 --- a/src/lib/isJSON.js +++ b/src/lib/isJSON.js @@ -1,5 +1,5 @@ -import assertString from './util/assertString'; -import merge from './util/merge'; +import assertString from './util/assertString.js'; +import merge from './util/merge.js'; const default_json_options = { allow_primitives: false, diff --git a/src/lib/isJWT.js b/src/lib/isJWT.js index 1a8896f98..0edee02a9 100644 --- a/src/lib/isJWT.js +++ b/src/lib/isJWT.js @@ -1,5 +1,5 @@ -import assertString from './util/assertString'; -import isBase64 from './isBase64'; +import assertString from './util/assertString.js'; +import isBase64 from './isBase64.js'; export default function isJWT(str) { assertString(str); diff --git a/src/lib/isLatLong.js b/src/lib/isLatLong.js index 5c53c23aa..33462a9c2 100644 --- a/src/lib/isLatLong.js +++ b/src/lib/isLatLong.js @@ -1,5 +1,5 @@ -import assertString from './util/assertString'; -import merge from './util/merge'; +import assertString from './util/assertString.js'; +import merge from './util/merge.js'; const lat = /^\(?[+-]?(90(\.0+)?|[1-8]?\d(\.\d+)?)$/; const long = /^\s?[+-]?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)\)?$/; diff --git a/src/lib/isLength.js b/src/lib/isLength.js index 4ef8b83eb..7b473a6e9 100644 --- a/src/lib/isLength.js +++ b/src/lib/isLength.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; /* eslint-disable prefer-rest-params */ export default function isLength(str, options) { diff --git a/src/lib/isLicensePlate.js b/src/lib/isLicensePlate.js index 6471ee23f..99208a24f 100644 --- a/src/lib/isLicensePlate.js +++ b/src/lib/isLicensePlate.js @@ -1,5 +1,5 @@ /* eslint-disable implicit-arrow-linebreak */ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; const validators = { 'cs-CZ': (str) => diff --git a/src/lib/isLocale.js b/src/lib/isLocale.js index cacac8aec..1b74b8d78 100644 --- a/src/lib/isLocale.js +++ b/src/lib/isLocale.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; const localeReg = /^[A-Za-z]{2,4}([_-]([A-Za-z]{4}|[\d]{3}))?([_-]([A-Za-z]{2}|[\d]{3}))?$/; diff --git a/src/lib/isLowercase.js b/src/lib/isLowercase.js index 803d478b8..2ebf9bc93 100644 --- a/src/lib/isLowercase.js +++ b/src/lib/isLowercase.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; export default function isLowercase(str) { assertString(str); diff --git a/src/lib/isLuhnValid.js b/src/lib/isLuhnValid.js index da205271f..bbb37309c 100644 --- a/src/lib/isLuhnValid.js +++ b/src/lib/isLuhnValid.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; export default function isLuhnValid(str) { assertString(str); diff --git a/src/lib/isMACAddress.js b/src/lib/isMACAddress.js index d87cd4aa7..e14cf808a 100644 --- a/src/lib/isMACAddress.js +++ b/src/lib/isMACAddress.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; const macAddress48 = /^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){4}([0-9a-fA-F]{2})$/; const macAddress48NoSeparators = /^([0-9a-fA-F]){12}$/; diff --git a/src/lib/isMD5.js b/src/lib/isMD5.js index 2feac5611..32424d0c6 100644 --- a/src/lib/isMD5.js +++ b/src/lib/isMD5.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; const md5 = /^[a-f0-9]{32}$/; diff --git a/src/lib/isMagnetURI.js b/src/lib/isMagnetURI.js index e00ee3c32..9008ac021 100644 --- a/src/lib/isMagnetURI.js +++ b/src/lib/isMagnetURI.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; const 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; diff --git a/src/lib/isMimeType.js b/src/lib/isMimeType.js index 1dfa77767..2128fb31f 100644 --- a/src/lib/isMimeType.js +++ b/src/lib/isMimeType.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; /* Checks if the provided string matches to a correct Media type format (MIME type) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index a44b96dc5..4af7f78e9 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; /* eslint-disable max-len */ const phones = { diff --git a/src/lib/isMongoId.js b/src/lib/isMongoId.js index b1a3baa8b..fe84b288e 100644 --- a/src/lib/isMongoId.js +++ b/src/lib/isMongoId.js @@ -1,6 +1,6 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; -import isHexadecimal from './isHexadecimal'; +import isHexadecimal from './isHexadecimal.js'; export default function isMongoId(str) { assertString(str); diff --git a/src/lib/isMultibyte.js b/src/lib/isMultibyte.js index 5354cdfda..dcd8527d3 100644 --- a/src/lib/isMultibyte.js +++ b/src/lib/isMultibyte.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; /* eslint-disable no-control-regex */ const multibyte = /[^\x00-\x7F]/; diff --git a/src/lib/isNumeric.js b/src/lib/isNumeric.js index 4cc7ea5b3..8b31c75be 100644 --- a/src/lib/isNumeric.js +++ b/src/lib/isNumeric.js @@ -1,5 +1,5 @@ -import assertString from './util/assertString'; -import { decimal } from './alpha'; +import assertString from './util/assertString.js'; +import { decimal } from './alpha.js'; const numericNoSymbols = /^[0-9]+$/; diff --git a/src/lib/isOctal.js b/src/lib/isOctal.js index 205b98ab6..09de2ec2d 100644 --- a/src/lib/isOctal.js +++ b/src/lib/isOctal.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; const octal = /^(0o)?[0-7]+$/i; diff --git a/src/lib/isPassportNumber.js b/src/lib/isPassportNumber.js index 1683260d0..a1e888316 100644 --- a/src/lib/isPassportNumber.js +++ b/src/lib/isPassportNumber.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; /** * Reference: diff --git a/src/lib/isPort.js b/src/lib/isPort.js index 0b316b78c..61702d1c2 100644 --- a/src/lib/isPort.js +++ b/src/lib/isPort.js @@ -1,4 +1,4 @@ -import isInt from './isInt'; +import isInt from './isInt.js'; export default function isPort(str) { return isInt(str, { min: 0, max: 65535 }); diff --git a/src/lib/isPostalCode.js b/src/lib/isPostalCode.js index e5fc1f7db..79e54a0b1 100644 --- a/src/lib/isPostalCode.js +++ b/src/lib/isPostalCode.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; // common patterns const threeDigit = /^\d{3}$/; diff --git a/src/lib/isRFC3339.js b/src/lib/isRFC3339.js index 48b025e0f..d21ad9509 100644 --- a/src/lib/isRFC3339.js +++ b/src/lib/isRFC3339.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; /* Based on https://tools.ietf.org/html/rfc3339#section-5.6 */ diff --git a/src/lib/isRgbColor.js b/src/lib/isRgbColor.js index 93b559d0e..cded60d37 100644 --- a/src/lib/isRgbColor.js +++ b/src/lib/isRgbColor.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; const 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])\)$/; const 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)?)\)$/; diff --git a/src/lib/isSemVer.js b/src/lib/isSemVer.js index 172d36496..22889034d 100644 --- a/src/lib/isSemVer.js +++ b/src/lib/isSemVer.js @@ -1,5 +1,5 @@ -import assertString from './util/assertString'; -import multilineRegexp from './util/multilineRegex'; +import assertString from './util/assertString.js'; +import multilineRegexp from './util/multilineRegex.js'; /** * Regular Expression to match diff --git a/src/lib/isSlug.js b/src/lib/isSlug.js index 28b872a92..8fa4694c6 100644 --- a/src/lib/isSlug.js +++ b/src/lib/isSlug.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; let charsetRegex = /^[^\s-_](?!.*?[-_]{2,})[a-z0-9-\\][^\s]*[^-_\s]$/; diff --git a/src/lib/isStrongPassword.js b/src/lib/isStrongPassword.js index 28bb0637f..647dcaeb0 100644 --- a/src/lib/isStrongPassword.js +++ b/src/lib/isStrongPassword.js @@ -1,5 +1,5 @@ -import merge from './util/merge'; -import assertString from './util/assertString'; +import merge from './util/merge.js'; +import assertString from './util/assertString.js'; const upperCaseRegex = /^[A-Z]$/; const lowerCaseRegex = /^[a-z]$/; diff --git a/src/lib/isSurrogatePair.js b/src/lib/isSurrogatePair.js index 0d04c2dcc..533b140c1 100644 --- a/src/lib/isSurrogatePair.js +++ b/src/lib/isSurrogatePair.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; const surrogatePair = /[\uD800-\uDBFF][\uDC00-\uDFFF]/; diff --git a/src/lib/isTaxID.js b/src/lib/isTaxID.js index 5df0b737d..0cacf9d25 100644 --- a/src/lib/isTaxID.js +++ b/src/lib/isTaxID.js @@ -1,6 +1,6 @@ -import assertString from './util/assertString'; -import * as algorithms from './util/algorithms'; -import isDate from './isDate'; +import assertString from './util/assertString.js'; +import * as algorithms from './util/algorithms.js'; +import isDate from './isDate.js'; /** * TIN Validation diff --git a/src/lib/isURL.js b/src/lib/isURL.js index b05899780..2fe9bf344 100644 --- a/src/lib/isURL.js +++ b/src/lib/isURL.js @@ -1,8 +1,8 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; -import isFQDN from './isFQDN'; -import isIP from './isIP'; -import merge from './util/merge'; +import isFQDN from './isFQDN.js'; +import isIP from './isIP.js'; +import merge from './util/merge.js'; /* options for isURL method diff --git a/src/lib/isUUID.js b/src/lib/isUUID.js index c026ca78c..d8c0d6931 100644 --- a/src/lib/isUUID.js +++ b/src/lib/isUUID.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; const uuid = { 1: /^[0-9A-F]{8}-[0-9A-F]{4}-1[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i, diff --git a/src/lib/isUppercase.js b/src/lib/isUppercase.js index 48ac5d30d..11e6d9331 100644 --- a/src/lib/isUppercase.js +++ b/src/lib/isUppercase.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; export default function isUppercase(str) { assertString(str); diff --git a/src/lib/isVAT.js b/src/lib/isVAT.js index 9f59e344a..2bbbb45a6 100644 --- a/src/lib/isVAT.js +++ b/src/lib/isVAT.js @@ -1,5 +1,5 @@ -import assertString from './util/assertString'; -import * as algorithms from './util/algorithms'; +import assertString from './util/assertString.js'; +import * as algorithms from './util/algorithms.js'; const PT = (str) => { const match = str.match(/^(PT)?(\d{9})$/); diff --git a/src/lib/isVariableWidth.js b/src/lib/isVariableWidth.js index 50901d8f2..9ddd3013e 100644 --- a/src/lib/isVariableWidth.js +++ b/src/lib/isVariableWidth.js @@ -1,7 +1,7 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; -import { fullWidth } from './isFullWidth'; -import { halfWidth } from './isHalfWidth'; +import { fullWidth } from './isFullWidth.js'; +import { halfWidth } from './isHalfWidth.js'; export default function isVariableWidth(str) { assertString(str); diff --git a/src/lib/isWhitelisted.js b/src/lib/isWhitelisted.js index 909c323da..98a1a5031 100644 --- a/src/lib/isWhitelisted.js +++ b/src/lib/isWhitelisted.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; export default function isWhitelisted(str, chars) { assertString(str); diff --git a/src/lib/ltrim.js b/src/lib/ltrim.js index 372d2df8e..ea2de0975 100644 --- a/src/lib/ltrim.js +++ b/src/lib/ltrim.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; export default function ltrim(str, chars) { assertString(str); diff --git a/src/lib/matches.js b/src/lib/matches.js index 9e23c2e46..486ed930a 100644 --- a/src/lib/matches.js +++ b/src/lib/matches.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; export default function matches(str, pattern, modifiers) { assertString(str); diff --git a/src/lib/normalizeEmail.js b/src/lib/normalizeEmail.js index a163bed88..e7cd094a9 100644 --- a/src/lib/normalizeEmail.js +++ b/src/lib/normalizeEmail.js @@ -1,4 +1,4 @@ -import merge from './util/merge'; +import merge from './util/merge.js'; const default_normalize_email_options = { // The following options apply to all email addresses diff --git a/src/lib/rtrim.js b/src/lib/rtrim.js index 2d311574b..d66b0d641 100644 --- a/src/lib/rtrim.js +++ b/src/lib/rtrim.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; export default function rtrim(str, chars) { assertString(str); diff --git a/src/lib/stripLow.js b/src/lib/stripLow.js index d616800de..34024ff32 100644 --- a/src/lib/stripLow.js +++ b/src/lib/stripLow.js @@ -1,6 +1,6 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; -import blacklist from './blacklist'; +import blacklist from './blacklist.js'; export default function stripLow(str, keep_new_lines) { assertString(str); diff --git a/src/lib/toBoolean.js b/src/lib/toBoolean.js index 95e210ca3..2ec1b1ec8 100644 --- a/src/lib/toBoolean.js +++ b/src/lib/toBoolean.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; export default function toBoolean(str, strict) { assertString(str); diff --git a/src/lib/toDate.js b/src/lib/toDate.js index 7cf80510e..c9dba0fd2 100644 --- a/src/lib/toDate.js +++ b/src/lib/toDate.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; export default function toDate(date) { assertString(date); diff --git a/src/lib/toFloat.js b/src/lib/toFloat.js index fa7d7b7c7..c2b3e363e 100644 --- a/src/lib/toFloat.js +++ b/src/lib/toFloat.js @@ -1,4 +1,4 @@ -import isFloat from './isFloat'; +import isFloat from './isFloat.js'; export default function toFloat(str) { if (!isFloat(str)) return NaN; diff --git a/src/lib/toInt.js b/src/lib/toInt.js index 232fd1d92..176e737ad 100644 --- a/src/lib/toInt.js +++ b/src/lib/toInt.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; export default function toInt(str, radix) { assertString(str); diff --git a/src/lib/trim.js b/src/lib/trim.js index 8b08f1ddf..7c1aee28e 100644 --- a/src/lib/trim.js +++ b/src/lib/trim.js @@ -1,5 +1,5 @@ -import rtrim from './rtrim'; -import ltrim from './ltrim'; +import rtrim from './rtrim.js'; +import ltrim from './ltrim.js'; export default function trim(str, chars) { return rtrim(ltrim(str, chars), chars); diff --git a/src/lib/unescape.js b/src/lib/unescape.js index feb255ac0..0c166e5e9 100644 --- a/src/lib/unescape.js +++ b/src/lib/unescape.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; export default function unescape(str) { assertString(str); diff --git a/src/lib/whitelist.js b/src/lib/whitelist.js index 3df56e71b..db706935e 100644 --- a/src/lib/whitelist.js +++ b/src/lib/whitelist.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; export default function whitelist(str, chars) { assertString(str); diff --git a/test/client-side.js b/test/client-side.js index e62761648..32b8462cd 100644 --- a/test/client-side.js +++ b/test/client-side.js @@ -1,6 +1,6 @@ import assert from 'assert'; -import validator from '../validator'; -import min from '../validator.min'; +import validator from '../validator.js'; +import min from '../validator.min.js'; describe('Minified version', () => { it('should export the same things as the server-side version', () => { diff --git a/test/exports.js b/test/exports.js index bbbade449..7a8b6465e 100644 --- a/test/exports.js +++ b/test/exports.js @@ -1,11 +1,11 @@ import assert from 'assert'; -import validator from '../index'; -import { locales as isPostalCodeLocales } from '../src/lib/isPostalCode'; -import { locales as isAlphaLocales } from '../src/lib/isAlpha'; -import { locales as isAlphanumericLocales } from '../src/lib/isAlphanumeric'; -import { locales as isMobilePhoneLocales } from '../src/lib/isMobilePhone'; -import { locales as isFloatLocales } from '../src/lib/isFloat'; -import { locales as ibanCountryCodes } from '../src/lib/isIBAN'; +import validator from '../index.js'; +import { locales as isPostalCodeLocales } from '../src/lib/isPostalCode.js'; +import { locales as isAlphaLocales } from '../src/lib/isAlpha.js'; +import { locales as isAlphanumericLocales } from '../src/lib/isAlphanumeric.js'; +import { locales as isMobilePhoneLocales } from '../src/lib/isMobilePhone.js'; +import { locales as isFloatLocales } from '../src/lib/isFloat.js'; +import { locales as ibanCountryCodes } from '../src/lib/isIBAN.js'; describe('Exports', () => { it('should export validators', () => { diff --git a/test/sanitizers.js b/test/sanitizers.js index d28a374b4..11f3747c3 100644 --- a/test/sanitizers.js +++ b/test/sanitizers.js @@ -1,5 +1,5 @@ import { format } from 'util'; -import validator from '../src/index'; +import validator from '../src/index.js'; function test(options) { let args = options.args || []; diff --git a/test/util.js b/test/util.js index 449cd9ee7..d3a2bac7a 100644 --- a/test/util.js +++ b/test/util.js @@ -3,7 +3,7 @@ * Prevent any breaking of functionality */ import assert from 'assert'; -import typeOf from '../src/lib/util/typeOf'; +import typeOf from '../src/lib/util/typeOf.js'; describe('Util', () => { it('should validate different typeOf', () => { diff --git a/test/validators.js b/test/validators.js index 2d6bd89d2..8af45e64d 100644 --- a/test/validators.js +++ b/test/validators.js @@ -2,7 +2,7 @@ import assert from 'assert'; import fs from 'fs'; import { format } from 'util'; import vm from 'vm'; -import validator from '../src/index'; +import validator from '../src/index.js'; let validator_js = fs.readFileSync(require.resolve('../validator.js')).toString(); From 6300e15e1dfbf3e7baebadaeceeacd5f23c4fe4a Mon Sep 17 00:00:00 2001 From: SCG82 Date: Fri, 13 Jan 2023 00:46:12 +0000 Subject: [PATCH 03/12] switch to vitest --- build-browser.js | 29 ----------------- package.json | 14 ++++---- rollup.config.mjs | 34 ++++++++++++++++++++ test/{client-side.js => client-side.test.js} | 2 ++ test/{exports.js => exports.test.js} | 7 +++- test/{sanitizers.js => sanitizers.test.js} | 2 ++ test/{util.js => util.test.js} | 2 ++ test/{validators.js => validators.test.js} | 6 +++- 8 files changed, 57 insertions(+), 39 deletions(-) delete mode 100644 build-browser.js create mode 100644 rollup.config.mjs rename test/{client-side.js => client-side.test.js} (90%) rename test/{exports.js => exports.test.js} (90%) rename test/{sanitizers.js => sanitizers.test.js} (99%) rename test/{util.js => util.test.js} (88%) rename test/{validators.js => validators.test.js} (99%) diff --git a/build-browser.js b/build-browser.js deleted file mode 100644 index 4a5ca7a08..000000000 --- a/build-browser.js +++ /dev/null @@ -1,29 +0,0 @@ -/* eslint import/no-extraneous-dependencies: 0 */ -import fs from 'fs'; -import { rollup } from 'rollup'; -import babel from '@rollup/plugin-babel'; -import babelPresetEnv from '@babel/preset-env'; - -rollup({ - input: 'src/index.js', - plugins: [ - babel({ - presets: [[babelPresetEnv, { modules: false }]], - babelrc: false, - }), - ], -}) - .then((bundle) => bundle.write({ - file: 'validator.js', - format: 'umd', - name: 'validator', - banner: `/*!\n${String(fs.readFileSync('./LICENSE')) - .trim() - .split('\n') - .map((l) => ` * ${l}`) - .join('\n')}\n */`, - })) - .catch((e) => { - process.stderr.write(`${e.message}\n`); - process.exit(1); - }); diff --git a/package.json b/package.json index d6873202b..a5f5d5253 100644 --- a/package.json +++ b/package.json @@ -62,19 +62,18 @@ "@babel/core": "^7.20.12", "@babel/eslint-parser": "^7.19.1", "@babel/preset-env": "^7.20.2", - "@babel/register": "^7.18.9", "@rollup/plugin-babel": "^6.0.3", + "@rollup/plugin-terser": "^0.3.0", + "@vitest/coverage-c8": "^0.27.1", "babel-plugin-add-module-exports": "^1.0.4", "eslint": "^8.31.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-plugin-import": "^2.27.4", "eslint-plugin-node": "^11.1.0", - "mocha": "^6.2.3", "npm-run-all": "^4.1.5", - "nyc": "^14.1.0", - "rimraf": "^3.0.0", + "rimraf": "^3.0.2", "rollup": "^3.10.0", - "uglify-js": "^3.17.4" + "vitest": "^0.27.1" }, "scripts": { "lint": "eslint src test", @@ -83,13 +82,12 @@ "clean:es": "rimraf es", "clean:browser": "rimraf validator*.js", "clean": "run-p clean:*", - "minify": "uglifyjs validator.js -o validator.min.js --compress --mangle --comments /Copyright/", - "build:browser": "node --require @babel/register build-browser && npm run minify", + "build:browser": "rollup -c", "build:es": "babel src -d es --env-name=es", "build:node": "babel src -d .", "build": "run-p build:*", "pretest": "npm run build && npm run lint", - "test": "nyc --reporter=cobertura --reporter=text-summary mocha --require @babel/register --reporter dot" + "test": "vitest --coverage" }, "engines": { "node": ">= 0.10" diff --git a/rollup.config.mjs b/rollup.config.mjs new file mode 100644 index 000000000..33cc1b407 --- /dev/null +++ b/rollup.config.mjs @@ -0,0 +1,34 @@ +/* eslint-disable import/no-extraneous-dependencies */ +import fs from 'fs'; +import babel from '@rollup/plugin-babel'; +import babelPresetEnv from '@babel/preset-env'; +import terser from '@rollup/plugin-terser'; + +const license = `/*!\n${String(fs.readFileSync('./LICENSE')).trim().split('\n').map((l) => (l ? ` * ${l}` : ' *')).join('\n')}\n */`; + +/** + * @type {import('rollup').RollupOptions} + */ +const config = { + input: 'src/index.js', + output: [{ + file: 'validator.js', + format: 'umd', + name: 'validator', + banner: license, + }, { + file: 'validator.min.js', + format: 'umd', + name: 'validator', + plugins: [terser()], + banner: license, + }], + plugins: [ + babel({ + presets: [[babelPresetEnv, { modules: false }]], + babelrc: false, + }), + ], +}; + +export default config; diff --git a/test/client-side.js b/test/client-side.test.js similarity index 90% rename from test/client-side.js rename to test/client-side.test.js index 32b8462cd..a38aa978a 100644 --- a/test/client-side.js +++ b/test/client-side.test.js @@ -1,4 +1,6 @@ +/* eslint-disable import/no-extraneous-dependencies */ import assert from 'assert'; +import { describe, it } from 'vitest'; import validator from '../validator.js'; import min from '../validator.min.js'; diff --git a/test/exports.js b/test/exports.test.js similarity index 90% rename from test/exports.js rename to test/exports.test.js index 7a8b6465e..cba278ee9 100644 --- a/test/exports.js +++ b/test/exports.test.js @@ -1,5 +1,8 @@ +/* eslint-disable import/no-extraneous-dependencies */ import assert from 'assert'; -import validator from '../index.js'; +import { createRequire } from 'module'; +import { describe, it } from 'vitest'; +import validator from '../src/index.js'; import { locales as isPostalCodeLocales } from '../src/lib/isPostalCode.js'; import { locales as isAlphaLocales } from '../src/lib/isAlpha.js'; import { locales as isAlphanumericLocales } from '../src/lib/isAlphanumeric.js'; @@ -7,6 +10,8 @@ import { locales as isMobilePhoneLocales } from '../src/lib/isMobilePhone.js'; import { locales as isFloatLocales } from '../src/lib/isFloat.js'; import { locales as ibanCountryCodes } from '../src/lib/isIBAN.js'; +const require = createRequire(import.meta.url); + describe('Exports', () => { it('should export validators', () => { assert.strictEqual(typeof validator.isEmail, 'function'); diff --git a/test/sanitizers.js b/test/sanitizers.test.js similarity index 99% rename from test/sanitizers.js rename to test/sanitizers.test.js index 11f3747c3..eeeae44ee 100644 --- a/test/sanitizers.js +++ b/test/sanitizers.test.js @@ -1,4 +1,6 @@ +/* eslint-disable import/no-extraneous-dependencies */ import { format } from 'util'; +import { describe, it } from 'vitest'; import validator from '../src/index.js'; function test(options) { diff --git a/test/util.js b/test/util.test.js similarity index 88% rename from test/util.js rename to test/util.test.js index d3a2bac7a..f77efafd5 100644 --- a/test/util.js +++ b/test/util.test.js @@ -1,8 +1,10 @@ +/* eslint-disable import/no-extraneous-dependencies */ /** * All tests that tests any utility. * Prevent any breaking of functionality */ import assert from 'assert'; +import { describe, it } from 'vitest'; import typeOf from '../src/lib/util/typeOf.js'; describe('Util', () => { diff --git a/test/validators.js b/test/validators.test.js similarity index 99% rename from test/validators.js rename to test/validators.test.js index 8af45e64d..daa4c0443 100644 --- a/test/validators.js +++ b/test/validators.test.js @@ -1,10 +1,14 @@ +/* eslint-disable import/no-extraneous-dependencies */ import assert from 'assert'; import fs from 'fs'; +import path from 'path'; import { format } from 'util'; +import { describe, it } from 'vitest'; import vm from 'vm'; import validator from '../src/index.js'; -let validator_js = fs.readFileSync(require.resolve('../validator.js')).toString(); +const dirname = path.dirname(new URL(import.meta.url).pathname); +let validator_js = fs.readFileSync(path.join(dirname, '..', 'validator.js')).toString(); function test(options) { let args = options.args || []; From 2844462574905f4c6cf347dce405b1dc95db6b7d Mon Sep 17 00:00:00 2001 From: SCG82 Date: Fri, 13 Jan 2023 01:05:45 +0000 Subject: [PATCH 04/12] improve package exports --- package.json | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index a5f5d5253..ba21490c6 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,8 @@ "exports": { ".": { "import": "./es/index.js", - "require": "./index.js" + "require": "./index.js", + "browser": "./validator.min.js" }, "./index.js": { "import": "./es/index.js", @@ -41,13 +42,27 @@ }, "./es": "./es/index.js", "./es/lib/*": "./es/lib/*.js", + "./es/lib/*.js": "./es/lib/*.js", "./es/*": "./es/lib/*.js", + "./es/*.js": "./es/lib/*.js", + "./lib/*": { + "import": "./es/lib/*.js", + "require": "./lib/*.js" + }, + "./lib/*.js": { + "import": "./es/lib/*.js", + "require": "./lib/*.js" + }, "./package.json": "./package.json", "./validator.js": "./validator.js", "./validator.min.js": "./validator.min.js", "./*": { "import": "./es/lib/*.js", "require": "./lib/*.js" + }, + "./*.js": { + "import": "./es/lib/*.js", + "require": "./lib/*.js" } }, "bugs": { From a7d3de0731680471b02db8c25d889cbc54409b91 Mon Sep 17 00:00:00 2001 From: SCG82 Date: Fri, 13 Jan 2023 01:55:35 +0000 Subject: [PATCH 05/12] ci: node 18, 16, 14 --- .github/workflows/ci.yml | 4 ++-- .github/workflows/npm-publish.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21686d855..ce5ff6a72 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - node-version: [14, 12, 10, 8, 6] + node-version: [18, 16, 14] name: Run tests on Node.js ${{ matrix.node-version }} steps: - name: Setup Node.js ${{ matrix.node-version }} @@ -23,7 +23,7 @@ jobs: run: npm install - name: Run tests run: npm test - - if: matrix.node-version == 14 + - if: matrix.node-version == 18 name: Send coverage info to Codecov uses: codecov/codecov-action@v1 with: diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index b4b62f1b9..48f7479e0 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -6,10 +6,10 @@ jobs: publish: runs-on: ubuntu-20.04 steps: - - name: Setup Node.js 14 + - name: Setup Node.js 18 uses: actions/setup-node@v2-beta with: - node-version: 14 + node-version: 18 check-latest: true registry-url: https://registry.npmjs.org/ - name: Checkout Repository From 0e6120940a24a9694a228b83e8a239be4aac971b Mon Sep 17 00:00:00 2001 From: Henk Bakker Date: Fri, 5 Jan 2024 15:08:07 +0100 Subject: [PATCH 06/12] remove bower --- README.md | 7 ------- bower.json | 19 ------------------- 2 files changed, 26 deletions(-) delete mode 100644 bower.json diff --git a/README.md b/README.md index e00b7cfac..2d9df463f 100644 --- a/README.md +++ b/README.md @@ -60,12 +60,6 @@ The library can be loaded either as a standalone script, or through an [AMD][amd ``` -The library can also be installed through [bower][bower] - -```bash -$ bower install validator-js -``` - CDN ```html @@ -282,7 +276,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. [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 diff --git a/bower.json b/bower.json deleted file mode 100644 index 427670cfc..000000000 --- a/bower.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "validator-js", - "main": "validator.js", - "homepage": "https://github.com/validatorjs/validator.js", - "authors": [ - "Chris O'Hara " - ], - "description": "String validation and sanitization", - "license": "MIT", - "ignore": [ - "**/.*", - "index.js", - "build*.js", - "package.json", - "node_modules", - "bower_components", - "test" - ] -} From e866637c32beb7f9b03ce9a14a61e161b95436d3 Mon Sep 17 00:00:00 2001 From: Henk Bakker Date: Fri, 5 Jan 2024 15:08:14 +0100 Subject: [PATCH 07/12] add package lock --- .gitignore | 2 - package-lock.json | 6706 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 6706 insertions(+), 2 deletions(-) create mode 100644 package-lock.json diff --git a/.gitignore b/.gitignore index 86aaedee1..764919a9f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,11 +3,9 @@ node_modules coverage coverage.lcov .nyc_output -package-lock.json yarn.lock /es /lib /index.js validator.js validator.min.js - diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..496d7ffeb --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6706 @@ +{ + "name": "validator", + "version": "13.11.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "validator", + "version": "13.11.0", + "license": "MIT", + "devDependencies": { + "@babel/cli": "^7.20.7", + "@babel/core": "^7.20.12", + "@babel/eslint-parser": "^7.19.1", + "@babel/preset-env": "^7.20.2", + "@rollup/plugin-babel": "^6.0.3", + "@rollup/plugin-terser": "^0.3.0", + "@vitest/coverage-c8": "^0.27.1", + "babel-plugin-add-module-exports": "^1.0.4", + "eslint": "^8.31.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-plugin-import": "^2.27.4", + "eslint-plugin-node": "^11.1.0", + "npm-run-all": "^4.1.5", + "rimraf": "^3.0.2", + "rollup": "^3.10.0", + "timezone-mock": "^1.3.6", + "vitest": "^0.27.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", + "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@ampproject/remapping": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", + "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/cli": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.23.4.tgz", + "integrity": "sha512-j3luA9xGKCXVyCa5R7lJvOMM+Kc2JEnAEIgz2ggtjQ/j5YUVgfsg/WsG95bbsgq7YLHuiCOzMnoSasuY16qiCw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.17", + "commander": "^4.0.1", + "convert-source-map": "^2.0.0", + "fs-readdir-recursive": "^1.1.0", + "glob": "^7.2.0", + "make-dir": "^2.1.0", + "slash": "^2.0.0" + }, + "bin": { + "babel": "bin/babel.js", + "babel-external-helpers": "bin/babel-external-helpers.js" + }, + "engines": { + "node": ">=6.9.0" + }, + "optionalDependencies": { + "@nicolo-ribaudo/chokidar-2": "2.1.8-no-fsevents.3", + "chokidar": "^3.4.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", + "integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.23.4", + "chalk": "^2.4.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.5.tgz", + "integrity": "sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.23.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.7.tgz", + "integrity": "sha512-+UpDgowcmqe36d4NwqvKsyPMlOLNGMsfMmQ5WGCu+siCe3t3dfe9njrzGfdN4qq+bcNUt0+Vw6haRxBOycs4dw==", + "dev": true, + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.23.5", + "@babel/generator": "^7.23.6", + "@babel/helper-compilation-targets": "^7.23.6", + "@babel/helper-module-transforms": "^7.23.3", + "@babel/helpers": "^7.23.7", + "@babel/parser": "^7.23.6", + "@babel/template": "^7.22.15", + "@babel/traverse": "^7.23.7", + "@babel/types": "^7.23.6", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/eslint-parser": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.23.3.tgz", + "integrity": "sha512-9bTuNlyx7oSstodm1cR1bECj4fkiknsDa1YniISkJemMY3DGhJNYBECbe6QD/q54mp2J8VO66jW3/7uP//iFCw==", + "dev": true, + "dependencies": { + "@nicolo-ribaudo/eslint-scope-5-internals": "5.1.1-v1", + "eslint-visitor-keys": "^2.1.0", + "semver": "^6.3.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || >=14.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.11.0", + "eslint": "^7.5.0 || ^8.0.0" + } + }, + "node_modules/@babel/generator": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz", + "integrity": "sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.23.6", + "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", + "jsesc": "^2.5.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-annotate-as-pure": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.22.5.tgz", + "integrity": "sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-builder-binary-assignment-operator-visitor": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.22.15.tgz", + "integrity": "sha512-QkBXwGgaoC2GtGZRoma6kv7Szfv06khvhFav67ZExau2RaXzy8MpHSMO2PNoP2XtmQphJQRHFfg77Bq731Yizw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.23.6.tgz", + "integrity": "sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.23.5", + "@babel/helper-validator-option": "^7.23.5", + "browserslist": "^4.22.2", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-create-class-features-plugin": { + "version": "7.23.7", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.23.7.tgz", + "integrity": "sha512-xCoqR/8+BoNnXOY7RVSgv6X+o7pmT5q1d+gGcRlXYkI+9B31glE4jeejhKVpA04O1AtzOt7OSQ6VYKP5FcRl9g==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.22.5", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-member-expression-to-functions": "^7.23.0", + "@babel/helper-optimise-call-expression": "^7.22.5", + "@babel/helper-replace-supers": "^7.22.20", + "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-create-regexp-features-plugin": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.22.15.tgz", + "integrity": "sha512-29FkPLFjn4TPEa3RE7GpW+qbE8tlsu3jntNYNfcGsc49LphF1PQIiD+vMZ1z1xVOKt+93khA9tc2JBs3kBjA7w==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.22.5", + "regexpu-core": "^5.3.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-define-polyfill-provider": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.4.4.tgz", + "integrity": "sha512-QcJMILQCu2jm5TFPGA3lCpJJTeEP+mqeXooG/NZbg/h5FTFi6V0+99ahlRsW8/kRLyb24LZVCCiclDedhLKcBA==", + "dev": true, + "dependencies": { + "@babel/helper-compilation-targets": "^7.22.6", + "@babel/helper-plugin-utils": "^7.22.5", + "debug": "^4.1.1", + "lodash.debounce": "^4.0.8", + "resolve": "^1.14.2" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/@babel/helper-environment-visitor": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-function-name": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", + "dev": true, + "dependencies": { + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-hoist-variables": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-member-expression-to-functions": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.23.0.tgz", + "integrity": "sha512-6gfrPwh7OuT6gZyJZvd6WbTfrqAo7vm4xCzAXOusKqq/vWdKXphTpj5klHKNmRUU6/QRGlBsyU9mAIPaWHlqJA==", + "dev": true, + "dependencies": { + "@babel/types": "^7.23.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz", + "integrity": "sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz", + "integrity": "sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ==", + "dev": true, + "dependencies": { + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-module-imports": "^7.22.15", + "@babel/helper-simple-access": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/helper-validator-identifier": "^7.22.20" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-optimise-call-expression": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.22.5.tgz", + "integrity": "sha512-HBwaojN0xFRx4yIvpwGqxiV2tUfl7401jlok564NgB9EHS1y6QT17FmKWm4ztqjeVdXLuC4fSvHc5ePpQjoTbw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", + "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-remap-async-to-generator": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.22.20.tgz", + "integrity": "sha512-pBGyV4uBqOns+0UvhsTO8qgl8hO89PmiDYv+/COyp1aeMcmfrfruz+/nCMFiYyFF/Knn0yfrC85ZzNFjembFTw==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.22.5", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-wrap-function": "^7.22.20" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-replace-supers": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.22.20.tgz", + "integrity": "sha512-qsW0In3dbwQUbK8kejJ4R7IHVGwHJlV6lpG6UA7a9hSa2YEiAib+N1T2kr6PEeUT+Fl7najmSOS6SmAwCHK6Tw==", + "dev": true, + "dependencies": { + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-member-expression-to-functions": "^7.22.15", + "@babel/helper-optimise-call-expression": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-simple-access": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz", + "integrity": "sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-skip-transparent-expression-wrappers": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.22.5.tgz", + "integrity": "sha512-tK14r66JZKiC43p8Ki33yLBVJKlQDFoA8GYN67lWCDCqoL6EMMSuM9b+Iff2jHaM/RRFYl7K+iiru7hbRqNx8Q==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-split-export-declaration": { + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz", + "integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz", + "integrity": "sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-wrap-function": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.22.20.tgz", + "integrity": "sha512-pms/UwkOpnQe/PDAEdV/d7dVCoBbB+R4FvYoHGZz+4VPcg7RtYy2KP7S2lbuWM6FCSgob5wshfGESbC/hzNXZw==", + "dev": true, + "dependencies": { + "@babel/helper-function-name": "^7.22.5", + "@babel/template": "^7.22.15", + "@babel/types": "^7.22.19" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.23.7", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.7.tgz", + "integrity": "sha512-6AMnjCoC8wjqBzDHkuqpa7jAKwvMo4dC+lr/TFBz+ucfulO1XMpDnwWPGBNwClOKZ8h6xn5N81W/R5OrcKtCbQ==", + "dev": true, + "dependencies": { + "@babel/template": "^7.22.15", + "@babel/traverse": "^7.23.7", + "@babel/types": "^7.23.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", + "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.6.tgz", + "integrity": "sha512-Z2uID7YJ7oNvAI20O9X0bblw7Qqs8Q2hFy0R9tAfnfLkp5MW0UH9eUvnDSnFwKZ0AvgS1ucqR4KzvVHgnke1VQ==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.23.3.tgz", + "integrity": "sha512-iRkKcCqb7iGnq9+3G6rZ+Ciz5VywC4XNRHe57lKM+jOeYAoR0lVqdeeDRfh0tQcTfw/+vBhHn926FmQhLtlFLQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.23.3.tgz", + "integrity": "sha512-WwlxbfMNdVEpQjZmK5mhm7oSwD3dS6eU+Iwsi4Knl9wAletWem7kaRsGOG+8UEbRyqxY4SS5zvtfXwX+jMxUwQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5", + "@babel/plugin-transform-optional-chaining": "^7.23.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.13.0" + } + }, + "node_modules/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": { + "version": "7.23.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.23.7.tgz", + "integrity": "sha512-LlRT7HgaifEpQA1ZgLVOIJZZFVPWN5iReq/7/JixwBtwcoeVGDBD53ZV28rrsLYOZs1Y/EHhA8N/Z6aazHR8cw==", + "dev": true, + "dependencies": { + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-proposal-private-property-in-object": { + "version": "7.21.0-placeholder-for-preset-env.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz", + "integrity": "sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==", + "dev": true, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.12.13" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-static-block": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", + "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-dynamic-import": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", + "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-export-namespace-from": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz", + "integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-assertions": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.23.3.tgz", + "integrity": "sha512-lPgDSU+SJLK3xmFDTV2ZRQAiM7UuUjGidwBywFavObCiZc1BeAAcMtHJKUya92hPHO+at63JJPLygilZard8jw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-attributes": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.23.3.tgz", + "integrity": "sha512-pawnE0P9g10xgoP7yKr6CK63K2FMsTE+FZidZO/1PwRdzmAPVs+HS1mAURUsgaoxammTJvULUdIkEK0gOcU2tA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-private-property-in-object": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", + "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-unicode-sets-regex": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz", + "integrity": "sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.18.6", + "@babel/helper-plugin-utils": "^7.18.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-transform-arrow-functions": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.23.3.tgz", + "integrity": "sha512-NzQcQrzaQPkaEwoTm4Mhyl8jI1huEL/WWIEvudjTCMJ9aBZNpsJbMASx7EQECtQQPS/DcnFpo0FIh3LvEO9cxQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-async-generator-functions": { + "version": "7.23.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.23.7.tgz", + "integrity": "sha512-PdxEpL71bJp1byMG0va5gwQcXHxuEYC/BgI/e88mGTtohbZN28O5Yit0Plkkm/dBzCF/BxmbNcses1RH1T+urA==", + "dev": true, + "dependencies": { + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-remap-async-to-generator": "^7.22.20", + "@babel/plugin-syntax-async-generators": "^7.8.4" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-async-to-generator": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.23.3.tgz", + "integrity": "sha512-A7LFsKi4U4fomjqXJlZg/u0ft/n8/7n7lpffUP/ZULx/DtV9SGlNKZolHH6PE8Xl1ngCc0M11OaeZptXVkfKSw==", + "dev": true, + "dependencies": { + "@babel/helper-module-imports": "^7.22.15", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-remap-async-to-generator": "^7.22.20" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-block-scoped-functions": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.23.3.tgz", + "integrity": "sha512-vI+0sIaPIO6CNuM9Kk5VmXcMVRiOpDh7w2zZt9GXzmE/9KD70CUEVhvPR/etAeNK/FAEkhxQtXOzVF3EuRL41A==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-block-scoping": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.23.4.tgz", + "integrity": "sha512-0QqbP6B6HOh7/8iNR4CQU2Th/bbRtBp4KS9vcaZd1fZ0wSh5Fyssg0UCIHwxh+ka+pNDREbVLQnHCMHKZfPwfw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-class-properties": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.23.3.tgz", + "integrity": "sha512-uM+AN8yCIjDPccsKGlw271xjJtGii+xQIF/uMPS8H15L12jZTsLfF4o5vNO7d/oUguOyfdikHGc/yi9ge4SGIg==", + "dev": true, + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.22.15", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-class-static-block": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.23.4.tgz", + "integrity": "sha512-nsWu/1M+ggti1SOALj3hfx5FXzAY06fwPJsUZD4/A5e1bWi46VUIWtD+kOX6/IdhXGsXBWllLFDSnqSCdUNydQ==", + "dev": true, + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.22.15", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-class-static-block": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.12.0" + } + }, + "node_modules/@babel/plugin-transform-classes": { + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.23.5.tgz", + "integrity": "sha512-jvOTR4nicqYC9yzOHIhXG5emiFEOpappSJAl73SDSEDcybD+Puuze8Tnpb9p9qEyYup24tq891gkaygIFvWDqg==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.22.5", + "@babel/helper-compilation-targets": "^7.22.15", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-optimise-call-expression": "^7.22.5", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-replace-supers": "^7.22.20", + "@babel/helper-split-export-declaration": "^7.22.6", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-computed-properties": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.23.3.tgz", + "integrity": "sha512-dTj83UVTLw/+nbiHqQSFdwO9CbTtwq1DsDqm3CUEtDrZNET5rT5E6bIdTlOftDTDLMYxvxHNEYO4B9SLl8SLZw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/template": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-destructuring": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.23.3.tgz", + "integrity": "sha512-n225npDqjDIr967cMScVKHXJs7rout1q+tt50inyBCPkyZ8KxeI6d+GIbSBTT/w/9WdlWDOej3V9HE5Lgk57gw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-dotall-regex": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.23.3.tgz", + "integrity": "sha512-vgnFYDHAKzFaTVp+mneDsIEbnJ2Np/9ng9iviHw3P/KVcgONxpNULEW/51Z/BaFojG2GI2GwwXck5uV1+1NOYQ==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.22.15", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-duplicate-keys": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.23.3.tgz", + "integrity": "sha512-RrqQ+BQmU3Oyav3J+7/myfvRCq7Tbz+kKLLshUmMwNlDHExbGL7ARhajvoBJEvc+fCguPPu887N+3RRXBVKZUA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-dynamic-import": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.23.4.tgz", + "integrity": "sha512-V6jIbLhdJK86MaLh4Jpghi8ho5fGzt3imHOBu/x0jlBaPYqDoWz4RDXjmMOfnh+JWNaQleEAByZLV0QzBT4YQQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-dynamic-import": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-exponentiation-operator": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.23.3.tgz", + "integrity": "sha512-5fhCsl1odX96u7ILKHBj4/Y8vipoqwsJMh4csSA8qFfxrZDEA4Ssku2DyNvMJSmZNOEBT750LfFPbtrnTP90BQ==", + "dev": true, + "dependencies": { + "@babel/helper-builder-binary-assignment-operator-visitor": "^7.22.15", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-export-namespace-from": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.23.4.tgz", + "integrity": "sha512-GzuSBcKkx62dGzZI1WVgTWvkkz84FZO5TC5T8dl/Tht/rAla6Dg/Mz9Yhypg+ezVACf/rgDuQt3kbWEv7LdUDQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-for-of": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.23.6.tgz", + "integrity": "sha512-aYH4ytZ0qSuBbpfhuofbg/e96oQ7U2w1Aw/UQmKT+1l39uEhUPoFS3fHevDc1G0OvewyDudfMKY1OulczHzWIw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-function-name": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.23.3.tgz", + "integrity": "sha512-I1QXp1LxIvt8yLaib49dRW5Okt7Q4oaxao6tFVKS/anCdEOMtYwWVKoiOA1p34GOWIZjUK0E+zCp7+l1pfQyiw==", + "dev": true, + "dependencies": { + "@babel/helper-compilation-targets": "^7.22.15", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-json-strings": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.23.4.tgz", + "integrity": "sha512-81nTOqM1dMwZ/aRXQ59zVubN9wHGqk6UtqRK+/q+ciXmRy8fSolhGVvG09HHRGo4l6fr/c4ZhXUQH0uFW7PZbg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-json-strings": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-literals": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.23.3.tgz", + "integrity": "sha512-wZ0PIXRxnwZvl9AYpqNUxpZ5BiTGrYt7kueGQ+N5FiQ7RCOD4cm8iShd6S6ggfVIWaJf2EMk8eRzAh52RfP4rQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-logical-assignment-operators": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.23.4.tgz", + "integrity": "sha512-Mc/ALf1rmZTP4JKKEhUwiORU+vcfarFVLfcFiolKUo6sewoxSEgl36ak5t+4WamRsNr6nzjZXQjM35WsU+9vbg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-member-expression-literals": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.23.3.tgz", + "integrity": "sha512-sC3LdDBDi5x96LA+Ytekz2ZPk8i/Ck+DEuDbRAll5rknJ5XRTSaPKEYwomLcs1AA8wg9b3KjIQRsnApj+q51Ag==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-amd": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.23.3.tgz", + "integrity": "sha512-vJYQGxeKM4t8hYCKVBlZX/gtIY2I7mRGFNcm85sgXGMTBcoV3QdVtdpbcWEbzbfUIUZKwvgFT82mRvaQIebZzw==", + "dev": true, + "dependencies": { + "@babel/helper-module-transforms": "^7.23.3", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-commonjs": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.23.3.tgz", + "integrity": "sha512-aVS0F65LKsdNOtcz6FRCpE4OgsP2OFnW46qNxNIX9h3wuzaNcSQsJysuMwqSibC98HPrf2vCgtxKNwS0DAlgcA==", + "dev": true, + "dependencies": { + "@babel/helper-module-transforms": "^7.23.3", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-simple-access": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-systemjs": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.23.3.tgz", + "integrity": "sha512-ZxyKGTkF9xT9YJuKQRo19ewf3pXpopuYQd8cDXqNzc3mUNbOME0RKMoZxviQk74hwzfQsEe66dE92MaZbdHKNQ==", + "dev": true, + "dependencies": { + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-module-transforms": "^7.23.3", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.20" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-umd": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.23.3.tgz", + "integrity": "sha512-zHsy9iXX2nIsCBFPud3jKn1IRPWg3Ing1qOZgeKV39m1ZgIdpJqvlWVeiHBZC6ITRG0MfskhYe9cLgntfSFPIg==", + "dev": true, + "dependencies": { + "@babel/helper-module-transforms": "^7.23.3", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.22.5.tgz", + "integrity": "sha512-YgLLKmS3aUBhHaxp5hi1WJTgOUb/NCuDHzGT9z9WTt3YG+CPRhJs6nprbStx6DnWM4dh6gt7SU3sZodbZ08adQ==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.22.5", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-transform-new-target": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.23.3.tgz", + "integrity": "sha512-YJ3xKqtJMAT5/TIZnpAR3I+K+WaDowYbN3xyxI8zxx/Gsypwf9B9h0VB+1Nh6ACAAPRS5NSRje0uVv5i79HYGQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-nullish-coalescing-operator": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.23.4.tgz", + "integrity": "sha512-jHE9EVVqHKAQx+VePv5LLGHjmHSJR76vawFPTdlxR/LVJPfOEGxREQwQfjuZEOPTwG92X3LINSh3M40Rv4zpVA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-numeric-separator": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.23.4.tgz", + "integrity": "sha512-mps6auzgwjRrwKEZA05cOwuDc9FAzoyFS4ZsG/8F43bTLf/TgkJg7QXOrPO1JO599iA3qgK9MXdMGOEC8O1h6Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-numeric-separator": "^7.10.4" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-object-rest-spread": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.23.4.tgz", + "integrity": "sha512-9x9K1YyeQVw0iOXJlIzwm8ltobIIv7j2iLyP2jIhEbqPRQ7ScNgwQufU2I0Gq11VjyG4gI4yMXt2VFags+1N3g==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.23.3", + "@babel/helper-compilation-targets": "^7.22.15", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.23.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-object-super": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.23.3.tgz", + "integrity": "sha512-BwQ8q0x2JG+3lxCVFohg+KbQM7plfpBwThdW9A6TMtWwLsbDA01Ek2Zb/AgDN39BiZsExm4qrXxjk+P1/fzGrA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-replace-supers": "^7.22.20" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-optional-catch-binding": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.23.4.tgz", + "integrity": "sha512-XIq8t0rJPHf6Wvmbn9nFxU6ao4c7WhghTR5WyV8SrJfUFzyxhCm4nhC+iAp3HFhbAKLfYpgzhJ6t4XCtVwqO5A==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-optional-chaining": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.23.4.tgz", + "integrity": "sha512-ZU8y5zWOfjM5vZ+asjgAPwDaBjJzgufjES89Rs4Lpq63O300R/kOz30WCLo6BxxX6QVEilwSlpClnG5cZaikTA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5", + "@babel/plugin-syntax-optional-chaining": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-parameters": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.23.3.tgz", + "integrity": "sha512-09lMt6UsUb3/34BbECKVbVwrT9bO6lILWln237z7sLaWnMsTi7Yc9fhX5DLpkJzAGfaReXI22wP41SZmnAA3Vw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-private-methods": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.23.3.tgz", + "integrity": "sha512-UzqRcRtWsDMTLrRWFvUBDwmw06tCQH9Rl1uAjfh6ijMSmGYQ+fpdB+cnqRC8EMh5tuuxSv0/TejGL+7vyj+50g==", + "dev": true, + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.22.15", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-private-property-in-object": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.23.4.tgz", + "integrity": "sha512-9G3K1YqTq3F4Vt88Djx1UZ79PDyj+yKRnUy7cZGSMe+a7jkwD259uKKuUzQlPkGam7R+8RJwh5z4xO27fA1o2A==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.22.5", + "@babel/helper-create-class-features-plugin": "^7.22.15", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-property-literals": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.23.3.tgz", + "integrity": "sha512-jR3Jn3y7cZp4oEWPFAlRsSWjxKe4PZILGBSd4nis1TsC5qeSpb+nrtihJuDhNI7QHiVbUaiXa0X2RZY3/TI6Nw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-regenerator": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.23.3.tgz", + "integrity": "sha512-KP+75h0KghBMcVpuKisx3XTu9Ncut8Q8TuvGO4IhY+9D5DFEckQefOuIsB/gQ2tG71lCke4NMrtIPS8pOj18BQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "regenerator-transform": "^0.15.2" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-reserved-words": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.23.3.tgz", + "integrity": "sha512-QnNTazY54YqgGxwIexMZva9gqbPa15t/x9VS+0fsEFWplwVpXYZivtgl43Z1vMpc1bdPP2PP8siFeVcnFvA3Cg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-shorthand-properties": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.23.3.tgz", + "integrity": "sha512-ED2fgqZLmexWiN+YNFX26fx4gh5qHDhn1O2gvEhreLW2iI63Sqm4llRLCXALKrCnbN4Jy0VcMQZl/SAzqug/jg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-spread": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.23.3.tgz", + "integrity": "sha512-VvfVYlrlBVu+77xVTOAoxQ6mZbnIq5FM0aGBSFEcIh03qHf+zNqA4DC/3XMUozTg7bZV3e3mZQ0i13VB6v5yUg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-sticky-regex": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.23.3.tgz", + "integrity": "sha512-HZOyN9g+rtvnOU3Yh7kSxXrKbzgrm5X4GncPY1QOquu7epga5MxKHVpYu2hvQnry/H+JjckSYRb93iNfsioAGg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-template-literals": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.23.3.tgz", + "integrity": "sha512-Flok06AYNp7GV2oJPZZcP9vZdszev6vPBkHLwxwSpaIqx75wn6mUd3UFWsSsA0l8nXAKkyCmL/sR02m8RYGeHg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-typeof-symbol": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.23.3.tgz", + "integrity": "sha512-4t15ViVnaFdrPC74be1gXBSMzXk3B4Us9lP7uLRQHTFpV5Dvt33pn+2MyyNxmN3VTTm3oTrZVMUmuw3oBnQ2oQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-escapes": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.23.3.tgz", + "integrity": "sha512-OMCUx/bU6ChE3r4+ZdylEqAjaQgHAgipgW8nsCfu5pGqDcFytVd91AwRvUJSBZDz0exPGgnjoqhgRYLRjFZc9Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-property-regex": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.23.3.tgz", + "integrity": "sha512-KcLIm+pDZkWZQAFJ9pdfmh89EwVfmNovFBcXko8szpBeF8z68kWIPeKlmSOkT9BXJxs2C0uk+5LxoxIv62MROA==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.22.15", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-regex": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.23.3.tgz", + "integrity": "sha512-wMHpNA4x2cIA32b/ci3AfwNgheiva2W0WUKWTK7vBHBhDKfPsc5cFGNWm69WBqpwd86u1qwZ9PWevKqm1A3yAw==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.22.15", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-sets-regex": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.23.3.tgz", + "integrity": "sha512-W7lliA/v9bNR83Qc3q1ip9CQMZ09CcHDbHfbLRDNuAhn1Mvkr1ZNF7hPmztMQvtTGVLJ9m8IZqWsTkXOml8dbw==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.22.15", + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/preset-env": { + "version": "7.23.7", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.23.7.tgz", + "integrity": "sha512-SY27X/GtTz/L4UryMNJ6p4fH4nsgWbz84y9FE0bQeWJP6O5BhgVCt53CotQKHCOeXJel8VyhlhujhlltKms/CA==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.23.5", + "@babel/helper-compilation-targets": "^7.23.6", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-validator-option": "^7.23.5", + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.23.3", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.23.3", + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": "^7.23.7", + "@babel/plugin-proposal-private-property-in-object": "7.21.0-placeholder-for-preset-env.2", + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-class-properties": "^7.12.13", + "@babel/plugin-syntax-class-static-block": "^7.14.5", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3", + "@babel/plugin-syntax-import-assertions": "^7.23.3", + "@babel/plugin-syntax-import-attributes": "^7.23.3", + "@babel/plugin-syntax-import-meta": "^7.10.4", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.10.4", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5", + "@babel/plugin-syntax-top-level-await": "^7.14.5", + "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6", + "@babel/plugin-transform-arrow-functions": "^7.23.3", + "@babel/plugin-transform-async-generator-functions": "^7.23.7", + "@babel/plugin-transform-async-to-generator": "^7.23.3", + "@babel/plugin-transform-block-scoped-functions": "^7.23.3", + "@babel/plugin-transform-block-scoping": "^7.23.4", + "@babel/plugin-transform-class-properties": "^7.23.3", + "@babel/plugin-transform-class-static-block": "^7.23.4", + "@babel/plugin-transform-classes": "^7.23.5", + "@babel/plugin-transform-computed-properties": "^7.23.3", + "@babel/plugin-transform-destructuring": "^7.23.3", + "@babel/plugin-transform-dotall-regex": "^7.23.3", + "@babel/plugin-transform-duplicate-keys": "^7.23.3", + "@babel/plugin-transform-dynamic-import": "^7.23.4", + "@babel/plugin-transform-exponentiation-operator": "^7.23.3", + "@babel/plugin-transform-export-namespace-from": "^7.23.4", + "@babel/plugin-transform-for-of": "^7.23.6", + "@babel/plugin-transform-function-name": "^7.23.3", + "@babel/plugin-transform-json-strings": "^7.23.4", + "@babel/plugin-transform-literals": "^7.23.3", + "@babel/plugin-transform-logical-assignment-operators": "^7.23.4", + "@babel/plugin-transform-member-expression-literals": "^7.23.3", + "@babel/plugin-transform-modules-amd": "^7.23.3", + "@babel/plugin-transform-modules-commonjs": "^7.23.3", + "@babel/plugin-transform-modules-systemjs": "^7.23.3", + "@babel/plugin-transform-modules-umd": "^7.23.3", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.22.5", + "@babel/plugin-transform-new-target": "^7.23.3", + "@babel/plugin-transform-nullish-coalescing-operator": "^7.23.4", + "@babel/plugin-transform-numeric-separator": "^7.23.4", + "@babel/plugin-transform-object-rest-spread": "^7.23.4", + "@babel/plugin-transform-object-super": "^7.23.3", + "@babel/plugin-transform-optional-catch-binding": "^7.23.4", + "@babel/plugin-transform-optional-chaining": "^7.23.4", + "@babel/plugin-transform-parameters": "^7.23.3", + "@babel/plugin-transform-private-methods": "^7.23.3", + "@babel/plugin-transform-private-property-in-object": "^7.23.4", + "@babel/plugin-transform-property-literals": "^7.23.3", + "@babel/plugin-transform-regenerator": "^7.23.3", + "@babel/plugin-transform-reserved-words": "^7.23.3", + "@babel/plugin-transform-shorthand-properties": "^7.23.3", + "@babel/plugin-transform-spread": "^7.23.3", + "@babel/plugin-transform-sticky-regex": "^7.23.3", + "@babel/plugin-transform-template-literals": "^7.23.3", + "@babel/plugin-transform-typeof-symbol": "^7.23.3", + "@babel/plugin-transform-unicode-escapes": "^7.23.3", + "@babel/plugin-transform-unicode-property-regex": "^7.23.3", + "@babel/plugin-transform-unicode-regex": "^7.23.3", + "@babel/plugin-transform-unicode-sets-regex": "^7.23.3", + "@babel/preset-modules": "0.1.6-no-external-plugins", + "babel-plugin-polyfill-corejs2": "^0.4.7", + "babel-plugin-polyfill-corejs3": "^0.8.7", + "babel-plugin-polyfill-regenerator": "^0.5.4", + "core-js-compat": "^3.31.0", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/preset-modules": { + "version": "0.1.6-no-external-plugins", + "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.6-no-external-plugins.tgz", + "integrity": "sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/types": "^7.4.4", + "esutils": "^2.0.2" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/@babel/regjsgen": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@babel/regjsgen/-/regjsgen-0.8.0.tgz", + "integrity": "sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==", + "dev": true + }, + "node_modules/@babel/runtime": { + "version": "7.23.7", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.7.tgz", + "integrity": "sha512-w06OXVOFso7LcbzMiDGt+3X7Rh7Ho8MmgPoWU3rarH+8upf+wSU/grlGbWzQyr3DkdN6ZeuMFjpdwW0Q+HxobA==", + "dev": true, + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/template": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.23.7", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.7.tgz", + "integrity": "sha512-tY3mM8rH9jM0YHFGyfC0/xf+SB5eKUu7HPj7/k3fpi9dAlsMc5YbQvDi0Sh2QTPXqMhyaAtzAr807TIyfQrmyg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.23.5", + "@babel/generator": "^7.23.6", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.23.6", + "@babel/types": "^7.23.6", + "debug": "^4.3.1", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.6.tgz", + "integrity": "sha512-+uarb83brBzPKN38NX1MkB6vb6+mwvR6amUulqAE7ccQw1pEl+bCia9TbdG1lsnFP7lZySvUn37CHyXQdfTwzg==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.23.4", + "@babel/helper-validator-identifier": "^7.22.20", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, + "node_modules/@esbuild/android-arm": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", + "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", + "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", + "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz", + "integrity": "sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", + "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", + "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", + "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", + "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", + "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", + "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", + "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", + "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", + "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", + "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", + "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", + "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", + "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", + "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", + "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", + "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", + "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", + "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", + "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/js": { + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", + "integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.13", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", + "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^2.0.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", + "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", + "dev": true + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.5.tgz", + "integrity": "sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.20", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", + "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@nicolo-ribaudo/chokidar-2": { + "version": "2.1.8-no-fsevents.3", + "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz", + "integrity": "sha512-s88O1aVtXftvp5bCPB7WnmXc5IwOZZ7YPuwNPt+GtOOXpPvad1LfbmjYv+qII7zP6RU2QGnqve27dnLycEnyEQ==", + "dev": true, + "optional": true + }, + "node_modules/@nicolo-ribaudo/eslint-scope-5-internals": { + "version": "5.1.1-v1", + "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz", + "integrity": "sha512-54/JRvkLIzzDWshCWfuhadfrfZVPiElY8Fcgmg1HroEly/EDSszzhBAsarCux+D/kOslTRquNzuyGSmUSTTHGg==", + "dev": true, + "dependencies": { + "eslint-scope": "5.1.1" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@rollup/plugin-babel": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-6.0.4.tgz", + "integrity": "sha512-YF7Y52kFdFT/xVSuVdjkV5ZdX/3YtmX0QulG+x0taQOtJdHYzVU61aSSkAgVJ7NOv6qPkIYiJSgSWWN/DM5sGw==", + "dev": true, + "dependencies": { + "@babel/helper-module-imports": "^7.18.6", + "@rollup/pluginutils": "^5.0.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0", + "@types/babel__core": "^7.1.9", + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "@types/babel__core": { + "optional": true + }, + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-terser": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-terser/-/plugin-terser-0.3.0.tgz", + "integrity": "sha512-mYTkNW9KjOscS/3QWU5LfOKsR3/fAAVDaqcAe2TZ7ng6pN46f+C7FOZbITuIW/neA+PhcjoKl7yMyB3XcmA4gw==", + "dev": true, + "dependencies": { + "serialize-javascript": "^6.0.0", + "smob": "^0.0.6", + "terser": "^5.15.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.x || ^3.x" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.0.tgz", + "integrity": "sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==", + "dev": true, + "dependencies": { + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@types/chai": { + "version": "4.3.11", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.11.tgz", + "integrity": "sha512-qQR1dr2rGIHYlJulmr8Ioq3De0Le9E4MJ5AiaeAETJJpndT1uUNHsGFK3L/UIu+rbkQSdj8J/w2bCsBZc/Y5fQ==", + "dev": true + }, + "node_modules/@types/chai-subset": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.5.tgz", + "integrity": "sha512-c2mPnw+xHtXDoHmdtcCXGwyLMiauiAyxWMzhGpqHC4nqI/Y5G2XhTampslK2rb59kpcuHon03UH8W6iYUzw88A==", + "dev": true, + "dependencies": { + "@types/chai": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", + "dev": true + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", + "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", + "dev": true + }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true + }, + "node_modules/@types/node": { + "version": "20.10.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.6.tgz", + "integrity": "sha512-Vac8H+NlRNNlAmDfGUP7b5h/KA+AtWIzuXy0E6OyP8f1tCLYAtPvKRRDJjAPqhpCb0t6U2j7/xqAuLEebW2kiw==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "dev": true + }, + "node_modules/@vitest/coverage-c8": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@vitest/coverage-c8/-/coverage-c8-0.27.3.tgz", + "integrity": "sha512-xIN4FXXwJqeP6z0gfQ06gbyBMRN2mYvZ4/mn4F96mKXzch0Y93fBeS81eo7D/2YtjbeJBUcU9/amPVb2T+h83Q==", + "deprecated": "v8 coverage is moved to @vitest/coverage-v8 package", + "dev": true, + "dependencies": { + "c8": "^7.12.0", + "vitest": "0.27.3" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/acorn": { + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.3.1", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.1.tgz", + "integrity": "sha512-TgUZgYvqZprrl7YldZNoa9OciCAyZR+Ejm9eXzKCmjsF5IKp/wgQ7Z/ZpjpGTIUPwrHQIcYeI8qDh4PsEwxMbw==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "optional": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", + "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "is-array-buffer": "^3.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array-includes": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.7.tgz", + "integrity": "sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "is-string": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.findlastindex": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz", + "integrity": "sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0", + "get-intrinsic": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flat": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", + "integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flatmap": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", + "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz", + "integrity": "sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.0", + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "is-array-buffer": "^3.0.2", + "is-shared-array-buffer": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/babel-plugin-add-module-exports": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/babel-plugin-add-module-exports/-/babel-plugin-add-module-exports-1.0.4.tgz", + "integrity": "sha512-g+8yxHUZ60RcyaUpfNzy56OtWW+x9cyEe9j+CranqLiqbju2yf/Cy6ZtYK40EZxtrdHllzlVZgLmcOUCTlJ7Jg==", + "dev": true + }, + "node_modules/babel-plugin-polyfill-corejs2": { + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.7.tgz", + "integrity": "sha512-LidDk/tEGDfuHW2DWh/Hgo4rmnw3cduK6ZkOI1NPFceSK3n/yAGeOsNT7FLnSGHkXj3RHGSEVkN3FsCTY6w2CQ==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.22.6", + "@babel/helper-define-polyfill-provider": "^0.4.4", + "semver": "^6.3.1" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/babel-plugin-polyfill-corejs3": { + "version": "0.8.7", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.8.7.tgz", + "integrity": "sha512-KyDvZYxAzkC0Aj2dAPyDzi2Ym15e5JKZSK+maI7NAwSqofvuFglbSsxE7wUOvTg9oFVnHMzVzBKcqEb4PJgtOA==", + "dev": true, + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.4.4", + "core-js-compat": "^3.33.1" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/babel-plugin-polyfill-regenerator": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.5.4.tgz", + "integrity": "sha512-S/x2iOCvDaCASLYsOOgWOq4bCfKYVqvO/uxjkaYyZ3rVsVE3CeAI/c84NpyuBBymEgNvHgjEot3a9/Z/kXvqsg==", + "dev": true, + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.4.4" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "optional": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "optional": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.22.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.2.tgz", + "integrity": "sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "caniuse-lite": "^1.0.30001565", + "electron-to-chromium": "^1.4.601", + "node-releases": "^2.0.14", + "update-browserslist-db": "^1.0.13" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "node_modules/c8": { + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/c8/-/c8-7.14.0.tgz", + "integrity": "sha512-i04rtkkcNcCf7zsQcSv/T9EbUn4RXQ6mropeMcjFOsQXQ0iGLAr/xT6TImQg4+U9hmNpN9XdvPkjUL1IzbgxJw==", + "dev": true, + "dependencies": { + "@bcoe/v8-coverage": "^0.2.3", + "@istanbuljs/schema": "^0.1.3", + "find-up": "^5.0.0", + "foreground-child": "^2.0.0", + "istanbul-lib-coverage": "^3.2.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-reports": "^3.1.4", + "rimraf": "^3.0.2", + "test-exclude": "^6.0.0", + "v8-to-istanbul": "^9.0.0", + "yargs": "^16.2.0", + "yargs-parser": "^20.2.9" + }, + "bin": { + "c8": "bin/c8.js" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/call-bind": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz", + "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.1", + "set-function-length": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001574", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001574.tgz", + "integrity": "sha512-BtYEK4r/iHt/txm81KBudCUcTy7t+s9emrIaHqjYurQ10x71zJ5VQ9x1dYPcz/b+pKSp4y/v1xSI67A+LzpNyg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ] + }, + "node_modules/chai": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.0.tgz", + "integrity": "sha512-x9cHNq1uvkCdU+5xTkNh5WtgD4e4yDFCsp9jVc7N7qVeKeftv3gO/ZrviX5d+3ZfxdYnZXZYujjRInu1RogU6A==", + "dev": true, + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.3", + "deep-eql": "^4.1.3", + "get-func-name": "^2.0.2", + "loupe": "^2.3.6", + "pathval": "^1.1.1", + "type-detect": "^4.0.8" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/check-error": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", + "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", + "dev": true, + "dependencies": { + "get-func-name": "^2.0.2" + }, + "engines": { + "node": "*" + } + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "optional": true, + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/confusing-browser-globals": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.11.tgz", + "integrity": "sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA==", + "dev": true + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + }, + "node_modules/core-js-compat": { + "version": "3.35.0", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.35.0.tgz", + "integrity": "sha512-5blwFAddknKeNgsjBzilkdQ0+YK8L1PfqPYq40NOYMYFSS38qj+hpTcLLWwpIwA2A5bje/x5jmVn2tzUMg9IVw==", + "dev": true, + "dependencies": { + "browserslist": "^4.22.2" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-eql": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "dev": true, + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "node_modules/define-data-property": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", + "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.4.622", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.622.tgz", + "integrity": "sha512-GZ47DEy0Gm2Z8RVG092CkFvX7SdotG57c4YZOe8W8qD4rOmk3plgeNmiLVRHP/Liqj1wRiY3uUUod9vb9hnxZA==", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/es-abstract": { + "version": "1.22.3", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.3.tgz", + "integrity": "sha512-eiiY8HQeYfYH2Con2berK+To6GrK2RxbPawDkGq4UiCQQfZHb6wX9qQqkbpPqaxQFcl8d9QzZqo0tGE0VcrdwA==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.0", + "arraybuffer.prototype.slice": "^1.0.2", + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.5", + "es-set-tostringtag": "^2.0.1", + "es-to-primitive": "^1.2.1", + "function.prototype.name": "^1.1.6", + "get-intrinsic": "^1.2.2", + "get-symbol-description": "^1.0.0", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0", + "internal-slot": "^1.0.5", + "is-array-buffer": "^3.0.2", + "is-callable": "^1.2.7", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-typed-array": "^1.1.12", + "is-weakref": "^1.0.2", + "object-inspect": "^1.13.1", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.5.1", + "safe-array-concat": "^1.0.1", + "safe-regex-test": "^1.0.0", + "string.prototype.trim": "^1.2.8", + "string.prototype.trimend": "^1.0.7", + "string.prototype.trimstart": "^1.0.7", + "typed-array-buffer": "^1.0.0", + "typed-array-byte-length": "^1.0.0", + "typed-array-byte-offset": "^1.0.0", + "typed-array-length": "^1.0.4", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.2.tgz", + "integrity": "sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.2", + "has-tostringtag": "^1.0.0", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-shim-unscopables": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz", + "integrity": "sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==", + "dev": true, + "dependencies": { + "hasown": "^2.0.0" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/esbuild": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz", + "integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.18.20", + "@esbuild/android-arm64": "0.18.20", + "@esbuild/android-x64": "0.18.20", + "@esbuild/darwin-arm64": "0.18.20", + "@esbuild/darwin-x64": "0.18.20", + "@esbuild/freebsd-arm64": "0.18.20", + "@esbuild/freebsd-x64": "0.18.20", + "@esbuild/linux-arm": "0.18.20", + "@esbuild/linux-arm64": "0.18.20", + "@esbuild/linux-ia32": "0.18.20", + "@esbuild/linux-loong64": "0.18.20", + "@esbuild/linux-mips64el": "0.18.20", + "@esbuild/linux-ppc64": "0.18.20", + "@esbuild/linux-riscv64": "0.18.20", + "@esbuild/linux-s390x": "0.18.20", + "@esbuild/linux-x64": "0.18.20", + "@esbuild/netbsd-x64": "0.18.20", + "@esbuild/openbsd-x64": "0.18.20", + "@esbuild/sunos-x64": "0.18.20", + "@esbuild/win32-arm64": "0.18.20", + "@esbuild/win32-ia32": "0.18.20", + "@esbuild/win32-x64": "0.18.20" + } + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/eslint": { + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", + "integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.56.0", + "@humanwhocodes/config-array": "^0.11.13", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-config-airbnb-base": { + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-15.0.0.tgz", + "integrity": "sha512-xaX3z4ZZIcFLvh2oUNvcX5oEofXda7giYmuplVxoOg5A7EXJMrUyqRgR+mhDhPK8LZ4PttFOBvCYDbX3sUoUig==", + "dev": true, + "dependencies": { + "confusing-browser-globals": "^1.0.10", + "object.assign": "^4.1.2", + "object.entries": "^1.1.5", + "semver": "^6.3.0" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "peerDependencies": { + "eslint": "^7.32.0 || ^8.2.0", + "eslint-plugin-import": "^2.25.2" + } + }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", + "dev": true, + "dependencies": { + "debug": "^3.2.7", + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-module-utils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", + "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", + "dev": true, + "dependencies": { + "debug": "^3.2.7" + }, + "engines": { + "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-es": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz", + "integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==", + "dev": true, + "dependencies": { + "eslint-utils": "^2.0.0", + "regexpp": "^3.0.0" + }, + "engines": { + "node": ">=8.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=4.19.1" + } + }, + "node_modules/eslint-plugin-import": { + "version": "2.29.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz", + "integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.7", + "array.prototype.findlastindex": "^1.2.3", + "array.prototype.flat": "^1.3.2", + "array.prototype.flatmap": "^1.3.2", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.9", + "eslint-module-utils": "^2.8.0", + "hasown": "^2.0.0", + "is-core-module": "^2.13.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.fromentries": "^2.0.7", + "object.groupby": "^1.0.1", + "object.values": "^1.1.7", + "semver": "^6.3.1", + "tsconfig-paths": "^3.15.0" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" + } + }, + "node_modules/eslint-plugin-import/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint-plugin-node": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", + "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==", + "dev": true, + "dependencies": { + "eslint-plugin-es": "^3.0.0", + "eslint-utils": "^2.0.0", + "ignore": "^5.1.1", + "minimatch": "^3.0.4", + "resolve": "^1.10.1", + "semver": "^6.1.0" + }, + "engines": { + "node": ">=8.10.0" + }, + "peerDependencies": { + "eslint": ">=5.16.0" + } + }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/eslint/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/eslint/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/eslint/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/eslint/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/eslint/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/eslint/node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esquery/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "node_modules/fastq": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.16.0.tgz", + "integrity": "sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "optional": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "dev": true, + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.3", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.2.9", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz", + "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", + "dev": true + }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.3" + } + }, + "node_modules/foreground-child": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", + "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/fs-readdir-recursive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz", + "integrity": "sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA==", + "dev": true + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/function.prototype.name": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", + "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "functions-have-names": "^1.2.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-func-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", + "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "optional": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/globalthis": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", + "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", + "dev": true, + "dependencies": { + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, + "node_modules/has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", + "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "node_modules/ignore": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", + "integrity": "sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/internal-slot": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.6.tgz", + "integrity": "sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.2", + "hasown": "^2.0.0", + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-array-buffer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", + "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.0", + "is-typed-array": "^1.1.10" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "dependencies": { + "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "optional": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", + "dev": true, + "dependencies": { + "hasown": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "optional": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz", + "integrity": "sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==", + "dev": true, + "dependencies": { + "which-typed-array": "^1.1.11" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-report/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-report/node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/istanbul-lib-report/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-report/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/istanbul-reports": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz", + "integrity": "sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==", + "dev": true, + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, + "node_modules/json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "dev": true + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/load-json-file/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/local-pkg": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.4.3.tgz", + "integrity": "sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==", + "dev": true + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/loupe": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", + "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", + "dev": true, + "dependencies": { + "get-func-name": "^2.0.1" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "dev": true, + "dependencies": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/memorystream": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", + "integrity": "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==", + "dev": true, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mlly": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.4.2.tgz", + "integrity": "sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg==", + "dev": true, + "dependencies": { + "acorn": "^8.10.0", + "pathe": "^1.1.1", + "pkg-types": "^1.0.3", + "ufo": "^1.3.0" + } + }, + "node_modules/mlly/node_modules/pathe": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.1.tgz", + "integrity": "sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==", + "dev": true + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/nanoid": { + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, + "node_modules/nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "node_modules/node-releases": { + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", + "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", + "dev": true + }, + "node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/normalize-package-data/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-all": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.5.tgz", + "integrity": "sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "chalk": "^2.4.1", + "cross-spawn": "^6.0.5", + "memorystream": "^0.3.1", + "minimatch": "^3.0.4", + "pidtree": "^0.3.0", + "read-pkg": "^3.0.0", + "shell-quote": "^1.6.1", + "string.prototype.padend": "^3.0.0" + }, + "bin": { + "npm-run-all": "bin/npm-run-all/index.js", + "run-p": "bin/run-p/index.js", + "run-s": "bin/run-s/index.js" + }, + "engines": { + "node": ">= 4" + } + }, + "node_modules/npm-run-all/node_modules/cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "dependencies": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "engines": { + "node": ">=4.8" + } + }, + "node_modules/npm-run-all/node_modules/path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/npm-run-all/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/npm-run-all/node_modules/shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", + "dev": true, + "dependencies": { + "shebang-regex": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-all/node_modules/shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-all/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/object-inspect": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.5.tgz", + "integrity": "sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.entries": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.7.tgz", + "integrity": "sha512-jCBs/0plmPsOnrKAfFQXRG2NFjlhZgjjcBLSmTnEhU8U6vVTsVe8ANeQJCHTl3gSsI4J+0emOoCgoKlmQPMgmA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.fromentries": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.7.tgz", + "integrity": "sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.groupby": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.1.tgz", + "integrity": "sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1" + } + }, + "node_modules/object.values": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.7.tgz", + "integrity": "sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", + "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", + "dev": true, + "dependencies": { + "@aashutoshrathi/word-wrap": "^1.2.3", + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", + "dev": true, + "dependencies": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "dependencies": { + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/path-type/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/pathe": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-0.2.0.tgz", + "integrity": "sha512-sTitTPYnn23esFR3RlqYBWn4c45WGeLcsKzQiUpXJAyfcWkolvlYpV8FLo7JishK946oQwMFUCHXQ9AjGPKExw==", + "dev": true + }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pidtree": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.1.tgz", + "integrity": "sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA==", + "dev": true, + "bin": { + "pidtree": "bin/pidtree.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-types": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.3.tgz", + "integrity": "sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==", + "dev": true, + "dependencies": { + "jsonc-parser": "^3.2.0", + "mlly": "^1.2.0", + "pathe": "^1.1.0" + } + }, + "node_modules/pkg-types/node_modules/pathe": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.1.tgz", + "integrity": "sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==", + "dev": true + }, + "node_modules/postcss": { + "version": "8.4.33", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.33.tgz", + "integrity": "sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==", + "dev": true, + "dependencies": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "optional": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/regenerate": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", + "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==", + "dev": true + }, + "node_modules/regenerate-unicode-properties": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.1.tgz", + "integrity": "sha512-X007RyZLsCJVVrjgEFVpLUTZwyOZk3oiL75ZcuYjlIWd6rNJtOjkBwQc5AsRrpbKVkxN6sklw/k/9m2jJYOf8Q==", + "dev": true, + "dependencies": { + "regenerate": "^1.4.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", + "dev": true + }, + "node_modules/regenerator-transform": { + "version": "0.15.2", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.15.2.tgz", + "integrity": "sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.8.4" + } + }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz", + "integrity": "sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "set-function-name": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/regexpu-core": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.3.2.tgz", + "integrity": "sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ==", + "dev": true, + "dependencies": { + "@babel/regjsgen": "^0.8.0", + "regenerate": "^1.4.2", + "regenerate-unicode-properties": "^10.1.0", + "regjsparser": "^0.9.1", + "unicode-match-property-ecmascript": "^2.0.0", + "unicode-match-property-value-ecmascript": "^2.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regjsparser": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.9.1.tgz", + "integrity": "sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ==", + "dev": true, + "dependencies": { + "jsesc": "~0.5.0" + }, + "bin": { + "regjsparser": "bin/parser" + } + }, + "node_modules/regjsparser/node_modules/jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dev": true, + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rollup": { + "version": "3.29.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", + "integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=14.18.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-array-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.1.tgz", + "integrity": "sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1", + "has-symbols": "^1.0.3", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safe-regex-test": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", + "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-regex": "^1.1.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/serialize-javascript": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.1.tgz", + "integrity": "sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/set-function-length": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz", + "integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.1", + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-function-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz", + "integrity": "sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==", + "dev": true, + "dependencies": { + "define-data-property": "^1.0.1", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/shell-quote": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz", + "integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/slash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/smob": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/smob/-/smob-0.0.6.tgz", + "integrity": "sha512-V21+XeNni+tTyiST1MHsa84AQhT1aFZipzPpOFAVB8DkHzwJyjjAmt9bgwnuZiZWnIbMo2duE29wybxv/7HWUw==", + "dev": true + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/spdx-correct": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "dev": true, + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.16", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.16.tgz", + "integrity": "sha512-eWN+LnM3GR6gPu35WxNgbGl8rmY1AEmoMDvL/QD6zYmPWgywxWqJWNdLGT+ke8dKNWrcYgYjPpG5gbTfghP8rw==", + "dev": true + }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true + }, + "node_modules/std-env": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.7.0.tgz", + "integrity": "sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==", + "dev": true + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string.prototype.padend": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/string.prototype.padend/-/string.prototype.padend-3.1.5.tgz", + "integrity": "sha512-DOB27b/2UTTD+4myKUFh+/fXWcu/UDyASIXfg+7VzoCNNGOfWvoyU/x5pvVHr++ztyt/oSYI1BcWBBG/hmlNjA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trim": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz", + "integrity": "sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz", + "integrity": "sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz", + "integrity": "sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strip-literal": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-1.3.0.tgz", + "integrity": "sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg==", + "dev": true, + "dependencies": { + "acorn": "^8.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/terser": { + "version": "5.26.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.26.0.tgz", + "integrity": "sha512-dytTGoE2oHgbNV9nTzgBEPaqAWvcJNl66VZ0BkJqlvp71IjO8CxdBx/ykCNb47cLnCmCvRZ6ZR0tLkqvZCdVBQ==", + "dev": true, + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/terser/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, + "node_modules/timezone-mock": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/timezone-mock/-/timezone-mock-1.3.6.tgz", + "integrity": "sha512-YcloWmZfLD9Li5m2VcobkCDNVaLMx8ohAb/97l/wYS3m+0TIEK5PFNMZZfRcusc6sFjIfxu8qcJT0CNnOdpqmg==", + "dev": true + }, + "node_modules/tinybench": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.5.1.tgz", + "integrity": "sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg==", + "dev": true + }, + "node_modules/tinypool": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.3.1.tgz", + "integrity": "sha512-zLA1ZXlstbU2rlpA4CIeVaqvWq41MTWqLY3FfsAXgC8+f7Pk7zroaJQxDgxn1xNudKW6Kmj4808rPFShUlIRmQ==", + "dev": true, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tinyspy": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-1.1.1.tgz", + "integrity": "sha512-UVq5AXt/gQlti7oxoIg5oi/9r0WpF7DGEVwXgqWSMmyN16+e3tl5lIvTaOpJ3TAtu5xFzWccFRM4R5NaWHF+4g==", + "dev": true, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "optional": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tsconfig-paths": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", + "dev": true, + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, + "node_modules/tsconfig-paths/node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typed-array-buffer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz", + "integrity": "sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz", + "integrity": "sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "has-proto": "^1.0.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz", + "integrity": "sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "has-proto": "^1.0.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", + "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "is-typed-array": "^1.1.9" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ufo": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.3.2.tgz", + "integrity": "sha512-o+ORpgGwaYQXgqGDwd+hkS4PuZ3QnmqMMxRuajK/a38L6fTpcE5GPIfrf+L/KemFzfUpeUQc1rRS1iDBozvnFA==", + "dev": true + }, + "node_modules/unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, + "node_modules/unicode-canonical-property-names-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", + "integrity": "sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", + "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", + "dev": true, + "dependencies": { + "unicode-canonical-property-names-ecmascript": "^2.0.0", + "unicode-property-aliases-ecmascript": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-value-ecmascript": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.1.0.tgz", + "integrity": "sha512-qxkjQt6qjg/mYscYMC0XKRn3Rh0wFPlfxB0xkt9CfyTvpX1Ra0+rAmdX2QyAobptSEvuy4RtpPRui6XkV+8wjA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-property-aliases-ecmascript": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz", + "integrity": "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", + "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/v8-to-istanbul": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz", + "integrity": "sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/vite": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.1.tgz", + "integrity": "sha512-AXXFaAJ8yebyqzoNB9fu2pHoo/nWX+xZlaRwoeYUxEqBO+Zj4msE5G+BhGBll9lYEKv9Hfks52PAF2X7qDYXQA==", + "dev": true, + "dependencies": { + "esbuild": "^0.18.10", + "postcss": "^8.4.27", + "rollup": "^3.27.1" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + }, + "peerDependencies": { + "@types/node": ">= 14", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, + "node_modules/vite-node": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-0.27.3.tgz", + "integrity": "sha512-eyJYOO64o5HIp8poc4bJX+ZNBwMZeI3f6/JdiUmJgW02Mt7LnoCtDMRVmLaY9S05SIsjGe339ZK4uo2wQ+bF9g==", + "dev": true, + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.3.4", + "mlly": "^1.1.0", + "pathe": "^0.2.0", + "picocolors": "^1.0.0", + "source-map": "^0.6.1", + "source-map-support": "^0.5.21", + "vite": "^3.0.0 || ^4.0.0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, + "engines": { + "node": ">=v14.16.0" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/vitest": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.27.3.tgz", + "integrity": "sha512-Ld3UVgRVhJUtqvQ3dW89GxiApFAgBsWJZBCWzK+gA3w2yG68csXlGZZ4WDJURf+8ecNfgrScga6xY+8YSOpiMg==", + "dev": true, + "dependencies": { + "@types/chai": "^4.3.4", + "@types/chai-subset": "^1.3.3", + "@types/node": "*", + "acorn": "^8.8.1", + "acorn-walk": "^8.2.0", + "cac": "^6.7.14", + "chai": "^4.3.7", + "debug": "^4.3.4", + "local-pkg": "^0.4.2", + "picocolors": "^1.0.0", + "source-map": "^0.6.1", + "std-env": "^3.3.1", + "strip-literal": "^1.0.0", + "tinybench": "^2.3.1", + "tinypool": "^0.3.0", + "tinyspy": "^1.0.2", + "vite": "^3.0.0 || ^4.0.0", + "vite-node": "0.27.3", + "why-is-node-running": "^2.2.2" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": ">=v14.16.0" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@vitest/browser": "*", + "@vitest/ui": "*", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.13.tgz", + "integrity": "sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.4", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/why-is-node-running": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", + "integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==", + "dev": true, + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/wrap-ansi/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + }, + "node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} From 157d9ec38ab5c63bc75536d5d8779858a058ef85 Mon Sep 17 00:00:00 2001 From: Henk Bakker Date: Fri, 5 Jan 2024 15:16:38 +0100 Subject: [PATCH 08/12] add prettier --- .eslintrc.json | 35 +++++++++++++++++++++++------------ .prettierignore | 3 +++ .prettierrc | 3 +++ package-lock.json | 31 ++++++++++++++++++++++++++++++- package.json | 11 +++++++---- 5 files changed, 66 insertions(+), 17 deletions(-) create mode 100644 .prettierignore create mode 100644 .prettierrc diff --git a/.eslintrc.json b/.eslintrc.json index 128c383d7..7282863a1 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,5 +1,5 @@ { - "extends": "airbnb-base", + "extends": ["airbnb-base", "prettier"], "parser": "@babel/eslint-parser", "plugins": ["node"], "parserOptions": { @@ -22,19 +22,30 @@ "newline-per-chained-call": 0, "prefer-const": 0, "linebreak-style": 0, - "no-restricted-syntax": [2, "DebuggerStatement", "LabeledStatement", "WithStatement"], + "no-restricted-syntax": [ + 2, + "DebuggerStatement", + "LabeledStatement", + "WithStatement" + ], "no-restricted-globals": 0, "prefer-destructuring": 0, - "comma-dangle": [2, { - "arrays": "always-multiline", - "objects": "always-multiline", - "imports": "always-multiline", - "exports": "always-multiline", - "functions": "never" - }], - "no-plusplus": [2, { - "allowForLoopAfterthoughts": true - }], + "comma-dangle": [ + 2, + { + "arrays": "always-multiline", + "objects": "always-multiline", + "imports": "always-multiline", + "exports": "always-multiline", + "functions": "never" + } + ], + "no-plusplus": [ + 2, + { + "allowForLoopAfterthoughts": true + } + ], "no-prototype-builtins": 0, "no-useless-escape": 0, "node/file-extension-in-import": ["error", "always"] diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..1b8ac8894 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,3 @@ +# Ignore artifacts: +build +coverage diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..544138be4 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +{ + "singleQuote": true +} diff --git a/package-lock.json b/package-lock.json index 496d7ffeb..c27110eae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,16 +19,18 @@ "babel-plugin-add-module-exports": "^1.0.4", "eslint": "^8.31.0", "eslint-config-airbnb-base": "^15.0.0", + "eslint-config-prettier": "9.1.0", "eslint-plugin-import": "^2.27.4", "eslint-plugin-node": "^11.1.0", "npm-run-all": "^4.1.5", + "prettier": "3.1.1", "rimraf": "^3.0.2", "rollup": "^3.10.0", "timezone-mock": "^1.3.6", "vitest": "^0.27.1" }, "engines": { - "node": ">= 0.10" + "node": ">= 14" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -3368,6 +3370,18 @@ "eslint-plugin-import": "^2.25.2" } }, + "node_modules/eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, "node_modules/eslint-import-resolver-node": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", @@ -5387,6 +5401,21 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.1.tgz", + "integrity": "sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", diff --git a/package.json b/package.json index c1748bb7f..8392f13ab 100644 --- a/package.json +++ b/package.json @@ -83,13 +83,15 @@ "babel-plugin-add-module-exports": "^1.0.4", "eslint": "^8.31.0", "eslint-config-airbnb-base": "^15.0.0", + "eslint-config-prettier": "9.1.0", "eslint-plugin-import": "^2.27.4", "eslint-plugin-node": "^11.1.0", "npm-run-all": "^4.1.5", + "prettier": "3.1.1", "rimraf": "^3.0.2", "rollup": "^3.10.0", - "vitest": "^0.27.1", - "timezone-mock": "^1.3.6" + "timezone-mock": "^1.3.6", + "vitest": "^0.27.1" }, "scripts": { "lint": "eslint src test", @@ -103,10 +105,11 @@ "build:node": "babel src -d .", "build": "run-p build:*", "pretest": "npm run build && npm run lint", - "test": "vitest --coverage" + "test": "vitest --coverage", + "format": "prettier . --write" }, "engines": { - "node": ">= 0.10" + "node": ">= 14" }, "license": "MIT" } From 130807203df8118c993730f1fb3fa1472614cbca Mon Sep 17 00:00:00 2001 From: Henk Bakker Date: Fri, 5 Jan 2024 15:17:34 +0100 Subject: [PATCH 09/12] eslint fix --- src/lib/isISO6346.js | 2 +- src/lib/isLicensePlate.js | 27 ++++++++++++++------------- src/lib/isMailtoURI.js | 6 +++--- src/lib/isTime.js | 2 +- test/validators/isAfter.test.js | 2 +- test/validators/isFQDN.test.js | 2 +- test/validators/isISBN.test.js | 2 +- 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/lib/isISO6346.js b/src/lib/isISO6346.js index 0cb657e7c..e9e9e9730 100644 --- a/src/lib/isISO6346.js +++ b/src/lib/isISO6346.js @@ -1,4 +1,4 @@ -import assertString from './util/assertString'; +import assertString from './util/assertString.js'; // https://en.wikipedia.org/wiki/ISO_6346 // according to ISO6346 standard, checksum digit is mandatory for freight container but recommended diff --git a/src/lib/isLicensePlate.js b/src/lib/isLicensePlate.js index 58f3b3c34..03e26b837 100644 --- a/src/lib/isLicensePlate.js +++ b/src/lib/isLicensePlate.js @@ -1,35 +1,35 @@ -import assertString from "./util/assertString.js"; +import assertString from './util/assertString.js'; const validators = { - "cs-CZ": (str) => /^(([ABCDEFHIJKLMNPRSTUVXYZ]|[0-9])-?){5,8}$/.test(str), - "de-DE": (str) => + 'cs-CZ': (str) => /^(([ABCDEFHIJKLMNPRSTUVXYZ]|[0-9])-?){5,8}$/.test(str), + 'de-DE': (str) => /^((A|AA|AB|AC|AE|AH|AK|AM|AN|AÖ|AP|AS|AT|AU|AW|AZ|B|BA|BB|BC|BE|BF|BH|BI|BK|BL|BM|BN|BO|BÖ|BS|BT|BZ|C|CA|CB|CE|CO|CR|CW|D|DA|DD|DE|DH|DI|DL|DM|DN|DO|DU|DW|DZ|E|EA|EB|ED|EE|EF|EG|EH|EI|EL|EM|EN|ER|ES|EU|EW|F|FB|FD|FF|FG|FI|FL|FN|FO|FR|FS|FT|FÜ|FW|FZ|G|GA|GC|GD|GE|GF|GG|GI|GK|GL|GM|GN|GÖ|GP|GR|GS|GT|GÜ|GV|GW|GZ|H|HA|HB|HC|HD|HE|HF|HG|HH|HI|HK|HL|HM|HN|HO|HP|HR|HS|HU|HV|HX|HY|HZ|IK|IL|IN|IZ|J|JE|JL|K|KA|KB|KC|KE|KF|KG|KH|KI|KK|KL|KM|KN|KO|KR|KS|KT|KU|KW|KY|L|LA|LB|LC|LD|LF|LG|LH|LI|LL|LM|LN|LÖ|LP|LR|LU|M|MA|MB|MC|MD|ME|MG|MH|MI|MK|ML|MM|MN|MO|MQ|MR|MS|MÜ|MW|MY|MZ|N|NB|ND|NE|NF|NH|NI|NK|NM|NÖ|NP|NR|NT|NU|NW|NY|NZ|OA|OB|OC|OD|OE|OF|OG|OH|OK|OL|OP|OS|OZ|P|PA|PB|PE|PF|PI|PL|PM|PN|PR|PS|PW|PZ|R|RA|RC|RD|RE|RG|RH|RI|RL|RM|RN|RO|RP|RS|RT|RU|RV|RW|RZ|S|SB|SC|SE|SG|SI|SK|SL|SM|SN|SO|SP|SR|ST|SU|SW|SY|SZ|TE|TF|TG|TO|TP|TR|TS|TT|TÜ|ÜB|UE|UH|UL|UM|UN|V|VB|VG|VK|VR|VS|W|WA|WB|WE|WF|WI|WK|WL|WM|WN|WO|WR|WS|WT|WÜ|WW|WZ|Z|ZE|ZI|ZP|ZR|ZW|ZZ)[- ]?[A-Z]{1,2}[- ]?\d{1,4}|(ABG|ABI|AIB|AIC|ALF|ALZ|ANA|ANG|ANK|APD|ARN|ART|ASL|ASZ|AUR|AZE|BAD|BAR|BBG|BCH|BED|BER|BGD|BGL|BID|BIN|BIR|BIT|BIW|BKS|BLB|BLK|BNA|BOG|BOH|BOR|BOT|BRA|BRB|BRG|BRK|BRL|BRV|BSB|BSK|BTF|BÜD|BUL|BÜR|BÜS|BÜZ|CAS|CHA|CLP|CLZ|COC|COE|CUX|DAH|DAN|DAU|DBR|DEG|DEL|DGF|DIL|DIN|DIZ|DKB|DLG|DON|DUD|DÜW|EBE|EBN|EBS|ECK|EIC|EIL|EIN|EIS|EMD|EMS|ERB|ERH|ERK|ERZ|ESB|ESW|FDB|FDS|FEU|FFB|FKB|FLÖ|FOR|FRG|FRI|FRW|FTL|FÜS|GAN|GAP|GDB|GEL|GEO|GER|GHA|GHC|GLA|GMN|GNT|GOA|GOH|GRA|GRH|GRI|GRM|GRZ|GTH|GUB|GUN|GVM|HAB|HAL|HAM|HAS|HBN|HBS|HCH|HDH|HDL|HEB|HEF|HEI|HER|HET|HGN|HGW|HHM|HIG|HIP|HMÜ|HOG|HOH|HOL|HOM|HOR|HÖS|HOT|HRO|HSK|HST|HVL|HWI|IGB|ILL|JÜL|KEH|KEL|KEM|KIB|KLE|KLZ|KÖN|KÖT|KÖZ|KRU|KÜN|KUS|KYF|LAN|LAU|LBS|LBZ|LDK|LDS|LEO|LER|LEV|LIB|LIF|LIP|LÖB|LOS|LRO|LSZ|LÜN|LUP|LWL|MAB|MAI|MAK|MAL|MED|MEG|MEI|MEK|MEL|MER|MET|MGH|MGN|MHL|MIL|MKK|MOD|MOL|MON|MOS|MSE|MSH|MSP|MST|MTK|MTL|MÜB|MÜR|MYK|MZG|NAB|NAI|NAU|NDH|NEA|NEB|NEC|NEN|NES|NEW|NMB|NMS|NOH|NOL|NOM|NOR|NVP|NWM|OAL|OBB|OBG|OCH|OHA|ÖHR|OHV|OHZ|OPR|OSL|OVI|OVL|OVP|PAF|PAN|PAR|PCH|PEG|PIR|PLÖ|PRÜ|QFT|QLB|RDG|REG|REH|REI|RID|RIE|ROD|ROF|ROK|ROL|ROS|ROT|ROW|RSL|RÜD|RÜG|SAB|SAD|SAN|SAW|SBG|SBK|SCZ|SDH|SDL|SDT|SEB|SEE|SEF|SEL|SFB|SFT|SGH|SHA|SHG|SHK|SHL|SIG|SIM|SLE|SLF|SLK|SLN|SLS|SLÜ|SLZ|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 ), - "de-LI": (str) => /^FL[- ]?\d{1,5}[UZ]?$/.test(str), - "en-IN": (str) => + 'de-LI': (str) => /^FL[- ]?\d{1,5}[UZ]?$/.test(str), + 'en-IN': (str) => /^[A-Z]{2}[ -]?[0-9]{1,2}(?:[ -]?[A-Z])(?:[ -]?[A-Z]*)?[ -]?[0-9]{4}$/.test( str ), - "es-AR": (str) => + 'es-AR': (str) => /^(([A-Z]{2} ?[0-9]{3} ?[A-Z]{2})|([A-Z]{3} ?[0-9]{3}))$/.test(str), - "fi-FI": (str) => + 'fi-FI': (str) => /^(?=.{4,7})(([A-Z]{1,3}|[0-9]{1,3})[\s-]?([A-Z]{1,3}|[0-9]{1,5}))$/.test( str ), - "hu-HU": (str) => + 'hu-HU': (str) => /^((((?!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": (str) => + 'pt-BR': (str) => /^[A-Z]{3}[ -]?[0-9][A-Z][0-9]{2}|[A-Z]{3}[ -]?[0-9]{4}$/.test(str), - "pt-PT": (str) => + 'pt-PT': (str) => /^([A-Z]{2}|[0-9]{2})[ -·]?([A-Z]{2}|[0-9]{2})[ -·]?([A-Z]{2}|[0-9]{2})$/.test( str ), - "sq-AL": (str) => + 'sq-AL': (str) => /^[A-Z]{2}[- ]?((\d{3}[- ]?(([A-Z]{2})|T))|(R[- ]?\d{3}))$/.test(str), - "sv-SE": (str) => + 'sv-SE': (str) => /^[A-HJ-PR-UW-Z]{3} ?[\d]{2}[A-HJ-PR-UW-Z1-9]$|(^[A-ZÅÄÖ ]{2,7}$)/.test( str.trim() ), @@ -39,7 +39,8 @@ export default function isLicensePlate(str, locale) { assertString(str); if (locale in validators) { return validators[locale](str); - } else if (locale === "any") { + } + if (locale === 'any') { for (const key in validators) { /* eslint guard-for-in: 0 */ const validator = validators[key]; diff --git a/src/lib/isMailtoURI.js b/src/lib/isMailtoURI.js index 0dd95b6a9..1b1f0b568 100644 --- a/src/lib/isMailtoURI.js +++ b/src/lib/isMailtoURI.js @@ -1,6 +1,6 @@ -import trim from './trim'; -import isEmail from './isEmail'; -import assertString from './util/assertString'; +import trim from './trim.js'; +import isEmail from './isEmail.js'; +import assertString from './util/assertString.js'; function parseMailtoQueryString(queryString) { const allowedParams = new Set(['subject', 'body', 'cc', 'bcc']), diff --git a/src/lib/isTime.js b/src/lib/isTime.js index 076bbfa34..9ad235bfa 100644 --- a/src/lib/isTime.js +++ b/src/lib/isTime.js @@ -1,4 +1,4 @@ -import merge from './util/merge'; +import merge from './util/merge.js'; const default_time_options = { hourFormat: 'hour24', diff --git a/test/validators/isAfter.test.js b/test/validators/isAfter.test.js index d771d9198..65257580f 100644 --- a/test/validators/isAfter.test.js +++ b/test/validators/isAfter.test.js @@ -1,4 +1,4 @@ -import test from '../testFunctions'; +import test from '../testFunctions.js'; describe('isAfter', () => { it('should validate dates against a start date', () => { diff --git a/test/validators/isFQDN.test.js b/test/validators/isFQDN.test.js index 134bab005..1ec999007 100644 --- a/test/validators/isFQDN.test.js +++ b/test/validators/isFQDN.test.js @@ -1,4 +1,4 @@ -import test from '../testFunctions'; +import test from '../testFunctions.js'; describe('isFQDN', () => { it('should validate domain names.', () => { diff --git a/test/validators/isISBN.test.js b/test/validators/isISBN.test.js index 99fb2e014..b9e0a800b 100644 --- a/test/validators/isISBN.test.js +++ b/test/validators/isISBN.test.js @@ -1,4 +1,4 @@ -import test from '../testFunctions'; +import test from '../testFunctions.js'; describe('isISBN', () => { it('should validate ISBNs', () => { From 841424a28346be7b3a84ff0b009395305222cae9 Mon Sep 17 00:00:00 2001 From: Henk Bakker Date: Fri, 5 Jan 2024 15:20:18 +0100 Subject: [PATCH 10/12] prettier format --- .babelrc | 45 +- .github/ISSUE_TEMPLATE/bug_report.md | 2 - .github/workflows/ci.yml | 32 +- .github/workflows/codeql-analysis.yml | 58 +- .github/workflows/npm-publish.yml | 32 +- .nycrc | 9 +- CHANGELOG.md | 245 +- README.md | 226 +- SECURITY.md | 2 +- jsconfig.json | 2 +- rollup.config.mjs | 33 +- src/index.js | 204 +- src/lib/alpha.js | 62 +- src/lib/contains.js | 5 +- src/lib/escape.js | 5 +- src/lib/isAfter.js | 3 +- src/lib/isAlpha.js | 8 +- src/lib/isAlphanumeric.js | 8 +- src/lib/isBase64.js | 8 +- src/lib/isByteLength.js | 5 +- src/lib/isCreditCard.js | 6 +- src/lib/isCurrency.js | 28 +- src/lib/isDataURI.js | 6 +- src/lib/isDate.js | 24 +- src/lib/isDecimal.js | 11 +- src/lib/isEAN.js | 14 +- src/lib/isEmail.js | 36 +- src/lib/isFQDN.js | 7 +- src/lib/isFloat.js | 18 +- src/lib/isFullWidth.js | 3 +- src/lib/isHSL.js | 10 +- src/lib/isHalfWidth.js | 3 +- src/lib/isIBAN.js | 12 +- src/lib/isIMEI.js | 2 +- src/lib/isIP.js | 25 +- src/lib/isISBN.js | 2 +- src/lib/isISIN.js | 6 +- src/lib/isISO31661Alpha2.js | 270 +- src/lib/isISO31661Alpha3.js | 265 +- src/lib/isISO4217.js | 197 +- src/lib/isISO6346.js | 10 +- src/lib/isISO6391.js | 207 +- src/lib/isISO8601.js | 21 +- src/lib/isISSN.js | 4 +- src/lib/isIdentityCard.js | 146 +- src/lib/isIn.js | 6 +- src/lib/isInt.js | 25 +- src/lib/isJSON.js | 4 +- src/lib/isJWT.js | 5 +- src/lib/isLatLong.js | 13 +- src/lib/isLength.js | 5 +- src/lib/isLicensePlate.js | 12 +- src/lib/isLocale.js | 16 +- src/lib/isLuhnNumber.js | 6 +- src/lib/isMACAddress.js | 12 +- src/lib/isMagnetURI.js | 3 +- src/lib/isMailtoURI.js | 16 +- src/lib/isMimeType.js | 15 +- src/lib/isMobilePhone.js | 27 +- src/lib/isNumeric.js | 6 +- src/lib/isPassportNumber.js | 6 +- src/lib/isPostalCode.js | 3 +- src/lib/isRFC3339.js | 8 +- src/lib/isRgbColor.js | 22 +- src/lib/isSemVer.js | 13 +- src/lib/isSlug.js | 2 +- src/lib/isStrongPassword.js | 17 +- src/lib/isTaxID.js | 472 +- src/lib/isURL.js | 10 +- src/lib/isVAT.js | 18 +- src/lib/ltrim.js | 4 +- src/lib/normalizeEmail.js | 10 +- src/lib/rtrim.js | 5 +- src/lib/stripLow.js | 4 +- src/lib/unescape.js | 5 +- src/lib/util/algorithms.js | 12 +- src/lib/util/merge.js | 2 +- src/lib/util/toString.js | 6 +- test/clientSide.test.js | 28 +- test/exports.test.js | 12 +- test/sanitizers.test.js | 157 +- test/testFunctions.js | 18 +- test/validators.test.js | 17624 ++++++++++++------------ test/validators/isFQDN.test.js | 16 +- test/validators/isISBN.test.js | 140 +- 85 files changed, 11257 insertions(+), 9855 deletions(-) diff --git a/.babelrc b/.babelrc index 332bba6f9..e240ad7aa 100644 --- a/.babelrc +++ b/.babelrc @@ -1,24 +1,25 @@ { - "env": { - "es": { - "presets": [ - ["@babel/preset-env", { - "modules": false - }] - ] - }, - "development": { - "presets": [ - ["@babel/preset-env", { "targets": { "node": "0.10" } }] - ], - "plugins": [ - [ - "add-module-exports", - { - "addDefaultProperty": true - } - ] - ] - } + "env": { + "es": { + "presets": [ + [ + "@babel/preset-env", + { + "modules": false + } + ] + ] + }, + "development": { + "presets": [["@babel/preset-env", { "targets": { "node": "0.10" } }]], + "plugins": [ + [ + "add-module-exports", + { + "addDefaultProperty": true + } + ] + ] } -} \ No newline at end of file + } +} diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index feab2fa77..ccd456973 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -4,13 +4,11 @@ about: Create a report to help us improve title: '' labels: "\U0001F41B bug" assignees: '' - --- **Describe the bug** A clear and concise description of what the bug is. - **Examples** If applicable, add screenshots to help explain your problem. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce5ff6a72..6bfc2f819 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,19 +12,19 @@ jobs: node-version: [18, 16, 14] name: Run tests on Node.js ${{ matrix.node-version }} steps: - - name: Setup Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2-beta - with: - node-version: ${{ matrix.node-version }} - check-latest: true - - name: Checkout repository - uses: actions/checkout@v2 - - name: Install dependencies - run: npm install - - name: Run tests - run: npm test - - if: matrix.node-version == 18 - name: Send coverage info to Codecov - uses: codecov/codecov-action@v1 - with: - file: ./coverage/cobertura-coverage.xml + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2-beta + with: + node-version: ${{ matrix.node-version }} + check-latest: true + - name: Checkout repository + uses: actions/checkout@v2 + - name: Install dependencies + run: npm install + - name: Run tests + run: npm test + - if: matrix.node-version == 18 + name: Send coverage info to Codecov + uses: codecov/codecov-action@v1 + with: + file: ./coverage/cobertura-coverage.xml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 2c6af7763..7a99da6df 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -9,14 +9,14 @@ # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # -name: "CodeQL" +name: 'CodeQL' on: push: - branches: [ master ] + branches: [master] pull_request: # The branches below must be a subset of the branches above - branches: [ master ] + branches: [master] schedule: - cron: '38 10 * * 4' @@ -32,39 +32,39 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'javascript' ] + language: ['javascript'] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Learn more about CodeQL language support at https://git.io/codeql-language-support steps: - - name: Checkout repository - uses: actions/checkout@v2 + - name: Checkout repository + uses: actions/checkout@v2 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 - # ℹ️ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl + # ℹ️ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl - # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language - #- run: | - # make bootstrap - # make release + #- run: | + # make bootstrap + # make release - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 48f7479e0..d0c630592 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -6,19 +6,19 @@ jobs: publish: runs-on: ubuntu-20.04 steps: - - name: Setup Node.js 18 - uses: actions/setup-node@v2-beta - with: - node-version: 18 - check-latest: true - registry-url: https://registry.npmjs.org/ - - name: Checkout Repository - uses: actions/checkout@v2 - - name: Install Dependencies - run: npm install - - name: Run Tests - run: npm test - - name: Publish Package to NPM Registry - run: npm publish - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_SECRET}} + - name: Setup Node.js 18 + uses: actions/setup-node@v2-beta + with: + node-version: 18 + check-latest: true + registry-url: https://registry.npmjs.org/ + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Install Dependencies + run: npm install + - name: Run Tests + run: npm test + - name: Publish Package to NPM Registry + run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_SECRET}} diff --git a/.nycrc b/.nycrc index 6b79f893c..ac704fdda 100644 --- a/.nycrc +++ b/.nycrc @@ -1,9 +1,4 @@ { - "reporter": [ - "html", - "text-summary" - ], - "include": [ - "src/**/*.js" - ] + "reporter": ["html", "text-summary"], + "include": ["src/**/*.js"] } diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d27cf979..67cfa36cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,30 +3,28 @@ ### New Features / Validators - [#2144](https://github.com/validatorjs/validator.js/pull/2144) `isFreightContainerID`: for shipping containers IDs @songyuew -- [#2188](https://github.com/validatorjs/validator.js/pull/2188) `isMailtoURI` @uksarkar +- [#2188](https://github.com/validatorjs/validator.js/pull/2188) `isMailtoURI` @uksarkar ### Fixes, New Locales and Enhancements - [#2025](https://github.com/validatorjs/validator.js/pull/2025) `isIBAN` add `MA` locale @lroudge -- [#2117](https://github.com/validatorjs/validator.js/pull/2117) `isCreditCard` refactor @pano9000 +- [#2117](https://github.com/validatorjs/validator.js/pull/2117) `isCreditCard` refactor @pano9000 - [#2189](https://github.com/validatorjs/validator.js/pull/2189) `isLocale` add support for more language tags @kwahome -- [#2203](https://github.com/validatorjs/validator.js/pull/2203) `isVAT` for `CU` @jimmyorpheus -- [#2217](https://github.com/validatorjs/validator.js/pull/2217) `isJWT` @Prathamesh061 -- [#2222](https://github.com/validatorjs/validator.js/pull/2222) `IsFQDN` test enhancements @aalekhpatel07 -- [#2226](https://github.com/validatorjs/validator.js/pull/2226) `isAlpha`, `isAlphanumeric` for `kk-KZ` @BekStar7 -- [#2229](https://github.com/validatorjs/validator.js/pull/2229) `isEmail` support `allow_underscores` @guspower -- [#2231](https://github.com/validatorjs/validator.js/pull/2231) `isDate` enhance Date declaration compatibility across multiple environments @CiprianS -- [#2235](https://github.com/validatorjs/validator.js/pull/2235) `isIBAN` add white and blacklist options to the isIBAN validator @edilson -- [#2237](https://github.com/validatorjs/validator.js/pull/2237) `isEmail` do not allow non-breaking space in user part @jeremy21212121 +- [#2203](https://github.com/validatorjs/validator.js/pull/2203) `isVAT` for `CU` @jimmyorpheus +- [#2217](https://github.com/validatorjs/validator.js/pull/2217) `isJWT` @Prathamesh061 +- [#2222](https://github.com/validatorjs/validator.js/pull/2222) `IsFQDN` test enhancements @aalekhpatel07 +- [#2226](https://github.com/validatorjs/validator.js/pull/2226) `isAlpha`, `isAlphanumeric` for `kk-KZ` @BekStar7 +- [#2229](https://github.com/validatorjs/validator.js/pull/2229) `isEmail` support `allow_underscores` @guspower +- [#2231](https://github.com/validatorjs/validator.js/pull/2231) `isDate` enhance Date declaration compatibility across multiple environments @CiprianS +- [#2235](https://github.com/validatorjs/validator.js/pull/2235) `isIBAN` add white and blacklist options to the isIBAN validator @edilson +- [#2237](https://github.com/validatorjs/validator.js/pull/2237) `isEmail` do not allow non-breaking space in user part @jeremy21212121 - `isMobilePhone`: - [#2175](https://github.com/validatorjs/validator.js/pull/2175) `so-SO` @ohersi - [#2176](https://github.com/validatorjs/validator.js/pull/2176) `fr-CF` @cheboi - - [#2197](https://github.com/validatorjs/validator.js/pull/2197) `es-CU` @klaframboise - - [#2202](https://github.com/validatorjs/validator.js/pull/2202) `pl-PL` @czerwony03 - - [#2209](https://github.com/validatorjs/validator.js/pull/2209) `fr-WF` @aidos42 - - [#2246](https://github.com/validatorjs/validator.js/pull/2246) `ar-SD` @Hussienma - - + - [#2197](https://github.com/validatorjs/validator.js/pull/2197) `es-CU` @klaframboise + - [#2202](https://github.com/validatorjs/validator.js/pull/2202) `pl-PL` @czerwony03 + - [#2209](https://github.com/validatorjs/validator.js/pull/2209) `fr-WF` @aidos42 + - [#2246](https://github.com/validatorjs/validator.js/pull/2246) `ar-SD` @Hussienma # 13.9.0 @@ -56,6 +54,7 @@ - [#2020](https://github.com/validatorjs/validator.js/pull/2170) `isFloat`: fix comma(,) passing as float @frederike-ramin - Documentation fixes: + - [#1860](https://github.com/validatorjs/validator.js/pull/1860) @leonardovillela - [#1861](https://github.com/validatorjs/validator.js/pull/1860) @tux-tn - [#1957](https://github.com/validatorjs/validator.js/pull/1957) @tfilo @@ -71,18 +70,22 @@ ### New and Improved Locales - `isAlpha`, `isAlphanumeric`: + - [#1678](https://github.com/validatorjs/validator.js/pull/1678) `bn-BD` @rak810 - [#1996](https://github.com/validatorjs/validator.js/pull/1996) `si-LK` @melkorCBA - [#2014](https://github.com/validatorjs/validator.js/pull/2014) `ja-JP` @starcharles - [#1995](https://github.com/validatorjs/validator.js/pull/1995) `ko-KR` @Dongkyuuuu - `isBIC`: + - [#2046](https://github.com/validatorjs/validator.js/pull/2046) `XK` @import-brain - `isIdentityCard`: + - [#2142](https://github.com/validatorjs/validator.js/pull/2142) `hk-HK` @Dongkyuuuu - `isMobilePhone`: + - [#1813](https://github.com/validatorjs/validator.js/pull/1813) `my-MM`, @ferdousulhaque - [#1868](https://github.com/validatorjs/validator.js/pull/1868) `de-DE`, @thomaschaaf - [#1896](https://github.com/validatorjs/validator.js/pull/1896) `en-LS`, @DevilsAutumn @@ -117,6 +120,7 @@ - [#2156](https://github.com/validatorjs/validator.js/pull/2156) `ro-RO`, @pano9000 - `isLicensePlate`: + - [#1665](https://github.com/validatorjs/validator.js/pull/1665) `sv-SE`, @elmaxe - [#1895](https://github.com/validatorjs/validator.js/pull/1895) `hu-HU`, @szabolcstarnai - [#1944](https://github.com/validatorjs/validator.js/pull/1944) `en-NI`, @NishantJS @@ -125,16 +129,17 @@ - [#2103](https://github.com/validatorjs/validator.js/pull/2103) `es-AR`, @alvarocastro - `isPassportNumber`: + - [#1515](https://github.com/validatorjs/validator.js/pull/1515) `JM`,`KZ`,`LI`,`NZ` @JuanFML - [#1814](https://github.com/validatorjs/validator.js/pull/1814) `TH` @TonPC64 @braaar - [#2061](https://github.com/validatorjs/validator.js/pull/2061) `AZ` @djeks922 - [#2073](https://github.com/validatorjs/validator.js/pull/2073) `PH`,`PK` @digambar-t7 - `isPostalCode`: + - [#1951](https://github.com/validatorjs/validator.js/pull/1951) `BA`, @matheusnascgomes - [#2134](https://github.com/validatorjs/validator.js/pull/2134) `BY`, @pano9000 - [#2136](https://github.com/validatorjs/validator.js/pull/2136) `IR`, @pano9000 - - `isTaxID`: - [#1867](https://github.com/validatorjs/validator.js/pull/1867) `en-CA`, @boonya @@ -177,26 +182,31 @@ ### New and Improved Locales - `isAlpha`, `isAlphanumeric`: + - [#1716](https://github.com/validatorjs/validator.js/pull/1716) `hi-IN` @MiKr13 - [#1837](https://github.com/validatorjs/validator.js/pull/1837) `fi-FI` @Marcholio - `isPassportNumber`: + - [#1656](https://github.com/validatorjs/validator.js/pull/1656) `ID` @rubiin - [#1714](https://github.com/validatorjs/validator.js/pull/1714) `CN` @anirudhgiri - [#1809](https://github.com/validatorjs/validator.js/pull/1809) `PL` @Ronqn - [#1810](https://github.com/validatorjs/validator.js/pull/1810) `RU` @Theta-Dev - `isPostalCode`: + - [#1788](https://github.com/validatorjs/validator.js/pull/1788) `LK` @nimanthadilz - `isIdentityCard`: + - [#1657](https://github.com/validatorjs/validator.js/pull/1657) `TH` @tithanayut - [#1745](https://github.com/validatorjs/validator.js/pull/1745) `PL` @wiktorwojcik112 @fedeci @tux-tn - [#1786](https://github.com/validatorjs/validator.js/pull/1786) `LK` @nimanthadilz @tux-tn - [#1838](https://github.com/validatorjs/validator.js/pull/1838) `FI` @Marcholio - `isMobilePhone`: - - [#1679](https://github.com/validatorjs/validator.js/pull/1679) `de-DE` @AnnaMariaJansen + + - [#1679](https://github.com/validatorjs/validator.js/pull/1679) `de-DE` @AnnaMariaJansen - [#1689](https://github.com/validatorjs/validator.js/pull/1689) `vi-VN` @luisrivas - [#1695](https://github.com/validatorjs/validator.js/pull/1695) [#1682](https://github.com/validatorjs/validator.js/pull/1682) `zh-CN` @laulujan @yisibl - [#1734](https://github.com/validatorjs/validator.js/pull/1734) `es-VE` @islasjuanp @@ -219,6 +229,7 @@ - [#1846](https://github.com/validatorjs/validator.js/pull/1846) `tg-TJ` @mgnss - `isLicensePlate`: + - [#1565](https://github.com/validatorjs/validator.js/pull/1565) `cs-CZ` @filiptronicek - [#1790](https://github.com/validatorjs/validator.js/pull/1790) `fi-FI` @Marcholio @@ -228,9 +239,11 @@ #### 13.6.1 - **New features**: + - [#1495](https://github.com/validatorjs/validator.js/pull/1495) `isLicensePlate` @firlus - **Fixes and Enhancements**: + - [#1651](https://github.com/validatorjs/validator.js/pull/1651) fix ReDOS vulnerabilities in `isHSL` and `isEmail` @tux-tn - [#1644](https://github.com/validatorjs/validator.js/pull/1644) `isURL`: Allow URLs to have only a username in the userinfo subcomponent @jbuchmann-coosto - [#1633](https://github.com/validatorjs/validator.js/pull/1633) `isISIN`: optimization @bmacnaughton @@ -272,12 +285,14 @@ #### ~~13.5.0~~ 13.5.1 - **New features**: + - `isVAT` [#1463](https://github.com/validatorjs/validator.js/pull/1463) @ CodingNagger - `isTaxID` [#1446](https://github.com/validatorjs/validator.js/pull/1446) @tplessas - `isBase58` [#1445](https://github.com/validatorjs/validator.js/pull/1445) @ezkemboi - `isStrongPassword` [#1348](https://github.com/validatorjs/validator.js/pull/1348) @door-bell - **Fixes and Enhancements**: + - [#1486](https://github.com/validatorjs/validator.js/pull/1486) `isISO8601`: add `strictSeparator` @brostone51 - [#1474](https://github.com/validatorjs/validator.js/pull/1474) `isFQDN`: make more strict @CristhianMotoche - [#1469](https://github.com/validatorjs/validator.js/pull/1469) `isFQDN`: `allow_underscore` option @gibson042 @@ -321,10 +336,11 @@ - **New features**: - None - **Fixes and chores**: + - [#1425](https://github.com/validatorjs/validator.js/pull/1425) fix validation for _userinfo_ part for `isURL` @heanzyzabala - - [#1419](https://github.com/validatorjs/validator.js/pull/1419) fix `isBase32` and `isBase64` to validate empty strings properly @AberDerBart - - [#1408](https://github.com/validatorjs/validator.js/pull/1408) tests for `isTaxId` @dspinellis - - [#1397](https://github.com/validatorjs/validator.js/pull/1397) added `validate_length` option for `isURL` @tomgrossman + - [#1419](https://github.com/validatorjs/validator.js/pull/1419) fix `isBase32` and `isBase64` to validate empty strings properly @AberDerBart + - [#1408](https://github.com/validatorjs/validator.js/pull/1408) tests for `isTaxId` @dspinellis + - [#1397](https://github.com/validatorjs/validator.js/pull/1397) added `validate_length` option for `isURL` @tomgrossman - [#1383](https://github.com/validatorjs/validator.js/pull/1383) [#1428](https://github.com/validatorjs/validator.js/pull/1428) doc typos @0xflotus @timgates42 - [#1376](https://github.com/validatorjs/validator.js/pull/1376) add missing tests and switch to Coverall @tux-tn - [#1373](https://github.com/validatorjs/validator.js/pull/1373) improve code coverage @ezkemboi @@ -351,7 +367,6 @@ - `isIdentityCard`: - [#1384](https://github.com/validatorjs/validator.js/pull/1384) `IT` @lorenzodb1 - #### 13.1.1 - Hotfix for a regex incompatibility in some browsers @@ -383,24 +398,24 @@ ([#1338](https://github.com/validatorjs/validator.js/pull/1338)) - New and improved locales ([#1112](https://github.com/validatorjs/validator.js/pull/1112), - [#1167](https://github.com/validatorjs/validator.js/pull/1167), - [#1198](https://github.com/validatorjs/validator.js/pull/1198), - [#1199](https://github.com/validatorjs/validator.js/pull/1199), - [#1273](https://github.com/validatorjs/validator.js/pull/1273), - [#1279](https://github.com/validatorjs/validator.js/pull/1279), - [#1281](https://github.com/validatorjs/validator.js/pull/1281), - [#1293](https://github.com/validatorjs/validator.js/pull/1293), - [#1294](https://github.com/validatorjs/validator.js/pull/1294), - [#1311](https://github.com/validatorjs/validator.js/pull/1311), - [#1312](https://github.com/validatorjs/validator.js/pull/1312), - [#1313](https://github.com/validatorjs/validator.js/pull/1313), - [#1314](https://github.com/validatorjs/validator.js/pull/1314), - [#1315](https://github.com/validatorjs/validator.js/pull/1315), - [#1317](https://github.com/validatorjs/validator.js/pull/1317), - [#1322](https://github.com/validatorjs/validator.js/pull/1322), - [#1324](https://github.com/validatorjs/validator.js/pull/1324), - [#1330](https://github.com/validatorjs/validator.js/pull/1330), - [#1337](https://github.com/validatorjs/validator.js/pull/1337)) + [#1167](https://github.com/validatorjs/validator.js/pull/1167), + [#1198](https://github.com/validatorjs/validator.js/pull/1198), + [#1199](https://github.com/validatorjs/validator.js/pull/1199), + [#1273](https://github.com/validatorjs/validator.js/pull/1273), + [#1279](https://github.com/validatorjs/validator.js/pull/1279), + [#1281](https://github.com/validatorjs/validator.js/pull/1281), + [#1293](https://github.com/validatorjs/validator.js/pull/1293), + [#1294](https://github.com/validatorjs/validator.js/pull/1294), + [#1311](https://github.com/validatorjs/validator.js/pull/1311), + [#1312](https://github.com/validatorjs/validator.js/pull/1312), + [#1313](https://github.com/validatorjs/validator.js/pull/1313), + [#1314](https://github.com/validatorjs/validator.js/pull/1314), + [#1315](https://github.com/validatorjs/validator.js/pull/1315), + [#1317](https://github.com/validatorjs/validator.js/pull/1317), + [#1322](https://github.com/validatorjs/validator.js/pull/1322), + [#1324](https://github.com/validatorjs/validator.js/pull/1324), + [#1330](https://github.com/validatorjs/validator.js/pull/1330), + [#1337](https://github.com/validatorjs/validator.js/pull/1337)) #### 13.0.0 @@ -433,7 +448,7 @@ ([#1267](https://github.com/validatorjs/validator.js/pull/1267)) - New and improved locales ([#1238](https://github.com/validatorjs/validator.js/pull/1238), - [#1265](https://github.com/validatorjs/validator.js/pull/1265)) + [#1265](https://github.com/validatorjs/validator.js/pull/1265)) #### 12.2.0 @@ -443,10 +458,10 @@ ([#1227](https://github.com/validatorjs/validator.js/pull/1227)) - New and improved locales ([#1200](https://github.com/validatorjs/validator.js/pull/1200), - [#1207](https://github.com/validatorjs/validator.js/pull/1207), - [#1213](https://github.com/validatorjs/validator.js/pull/1213), - [#1217](https://github.com/validatorjs/validator.js/pull/1217), - [#1234](https://github.com/validatorjs/validator.js/pull/1234)) + [#1207](https://github.com/validatorjs/validator.js/pull/1207), + [#1213](https://github.com/validatorjs/validator.js/pull/1213), + [#1217](https://github.com/validatorjs/validator.js/pull/1217), + [#1234](https://github.com/validatorjs/validator.js/pull/1234)) #### 12.1.0 @@ -456,9 +471,9 @@ ([#1160](https://github.com/validatorjs/validator.js/pull/1160)) - New and improved locales ([#1162](https://github.com/validatorjs/validator.js/pull/1162), - [#1183](https://github.com/validatorjs/validator.js/pull/1183), - [#1187](https://github.com/validatorjs/validator.js/pull/1187), - [#1191](https://github.com/validatorjs/validator.js/pull/1191)) + [#1183](https://github.com/validatorjs/validator.js/pull/1183), + [#1187](https://github.com/validatorjs/validator.js/pull/1187), + [#1191](https://github.com/validatorjs/validator.js/pull/1191)) #### 12.0.0 @@ -480,18 +495,18 @@ ([#1074](https://github.com/validatorjs/validator.js/pull/1074)) - New and improved locales ([#1059](https://github.com/validatorjs/validator.js/pull/1059), - [#1060](https://github.com/validatorjs/validator.js/pull/1060), - [#1069](https://github.com/validatorjs/validator.js/pull/1069), - [#1073](https://github.com/validatorjs/validator.js/pull/1073), - [#1082](https://github.com/validatorjs/validator.js/pull/1082), - [#1092](https://github.com/validatorjs/validator.js/pull/1092), - [#1121](https://github.com/validatorjs/validator.js/pull/1121), - [#1125](https://github.com/validatorjs/validator.js/pull/1125), - [#1132](https://github.com/validatorjs/validator.js/pull/1132), - [#1152](https://github.com/validatorjs/validator.js/pull/1152), - [#1165](https://github.com/validatorjs/validator.js/pull/1165), - [#1166](https://github.com/validatorjs/validator.js/pull/1166), - [#1174](https://github.com/validatorjs/validator.js/pull/1174)) + [#1060](https://github.com/validatorjs/validator.js/pull/1060), + [#1069](https://github.com/validatorjs/validator.js/pull/1069), + [#1073](https://github.com/validatorjs/validator.js/pull/1073), + [#1082](https://github.com/validatorjs/validator.js/pull/1082), + [#1092](https://github.com/validatorjs/validator.js/pull/1092), + [#1121](https://github.com/validatorjs/validator.js/pull/1121), + [#1125](https://github.com/validatorjs/validator.js/pull/1125), + [#1132](https://github.com/validatorjs/validator.js/pull/1132), + [#1152](https://github.com/validatorjs/validator.js/pull/1152), + [#1165](https://github.com/validatorjs/validator.js/pull/1165), + [#1166](https://github.com/validatorjs/validator.js/pull/1166), + [#1174](https://github.com/validatorjs/validator.js/pull/1174)) #### 11.1.0 @@ -499,15 +514,15 @@ ([#1024](https://github.com/validatorjs/validator.js/pull/1024)) - New and improved locales ([#1035](https://github.com/validatorjs/validator.js/pull/1035), - [#1040](https://github.com/validatorjs/validator.js/pull/1040), - [#1041](https://github.com/validatorjs/validator.js/pull/1041), - [#1048](https://github.com/validatorjs/validator.js/pull/1048), - [#1049](https://github.com/validatorjs/validator.js/pull/1049), - [#1052](https://github.com/validatorjs/validator.js/pull/1052), - [#1054](https://github.com/validatorjs/validator.js/pull/1054), - [#1055](https://github.com/validatorjs/validator.js/pull/1055), - [#1056](https://github.com/validatorjs/validator.js/pull/1056), - [#1057](https://github.com/validatorjs/validator.js/pull/1057)) + [#1040](https://github.com/validatorjs/validator.js/pull/1040), + [#1041](https://github.com/validatorjs/validator.js/pull/1041), + [#1048](https://github.com/validatorjs/validator.js/pull/1048), + [#1049](https://github.com/validatorjs/validator.js/pull/1049), + [#1052](https://github.com/validatorjs/validator.js/pull/1052), + [#1054](https://github.com/validatorjs/validator.js/pull/1054), + [#1055](https://github.com/validatorjs/validator.js/pull/1055), + [#1056](https://github.com/validatorjs/validator.js/pull/1056), + [#1057](https://github.com/validatorjs/validator.js/pull/1057)) #### 11.0.0 @@ -521,11 +536,11 @@ ([0277eb](https://github.com/validatorjs/validator.js/commit/0277eb00d245a3479af52adf7d927d4036895650)) - New and improved locales ([#999](https://github.com/validatorjs/validator.js/pull/999), - [#1010](https://github.com/validatorjs/validator.js/pull/1010), - [#1017](https://github.com/validatorjs/validator.js/pull/1017), - [#1022](https://github.com/validatorjs/validator.js/pull/1022), - [#1031](https://github.com/validatorjs/validator.js/pull/1031), - [#1032](https://github.com/validatorjs/validator.js/pull/1032)) + [#1010](https://github.com/validatorjs/validator.js/pull/1010), + [#1017](https://github.com/validatorjs/validator.js/pull/1017), + [#1022](https://github.com/validatorjs/validator.js/pull/1022), + [#1031](https://github.com/validatorjs/validator.js/pull/1031), + [#1032](https://github.com/validatorjs/validator.js/pull/1032)) #### 10.11.0 @@ -540,9 +555,9 @@ ([#932](https://github.com/validatorjs/validator.js/pull/932)) - New and improved locales ([#931](https://github.com/validatorjs/validator.js/pull/931), - [#933](https://github.com/validatorjs/validator.js/pull/933), - [#947](https://github.com/validatorjs/validator.js/pull/947), - [#950](https://github.com/validatorjs/validator.js/pull/950)) + [#933](https://github.com/validatorjs/validator.js/pull/933), + [#947](https://github.com/validatorjs/validator.js/pull/947), + [#950](https://github.com/validatorjs/validator.js/pull/950)) #### 10.9.0 @@ -554,11 +569,11 @@ ([#906](https://github.com/validatorjs/validator.js/pull/906)) - New and improved locales ([#899](https://github.com/validatorjs/validator.js/pull/899), - [#904](https://github.com/validatorjs/validator.js/pull/904), - [#913](https://github.com/validatorjs/validator.js/pull/913), - [#916](https://github.com/validatorjs/validator.js/pull/916), - [#925](https://github.com/validatorjs/validator.js/pull/925), - [#928](https://github.com/validatorjs/validator.js/pull/928)) + [#904](https://github.com/validatorjs/validator.js/pull/904), + [#913](https://github.com/validatorjs/validator.js/pull/913), + [#916](https://github.com/validatorjs/validator.js/pull/916), + [#925](https://github.com/validatorjs/validator.js/pull/925), + [#928](https://github.com/validatorjs/validator.js/pull/928)) #### 10.8.0 @@ -568,7 +583,7 @@ ([#895](https://github.com/validatorjs/validator.js/pull/895)) - Locales are now exported ([#890](https://github.com/validatorjs/validator.js/pull/890), - [#892](https://github.com/validatorjs/validator.js/pull/892)) + [#892](https://github.com/validatorjs/validator.js/pull/892)) - New locale ([#896](https://github.com/validatorjs/validator.js/pull/896)) @@ -594,7 +609,7 @@ ([#880](https://github.com/validatorjs/validator.js/pull/880)) - New and improved locales ([#878](https://github.com/validatorjs/validator.js/pull/878), - [#879](https://github.com/validatorjs/validator.js/pull/879)) + [#879](https://github.com/validatorjs/validator.js/pull/879)) #### 10.5.0 @@ -610,14 +625,14 @@ ([#860](https://github.com/validatorjs/validator.js/issues/860)) - New and improved locales ([#801](https://github.com/validatorjs/validator.js/pull/801), - [#856](https://github.com/validatorjs/validator.js/pull/856), - [#859](https://github.com/validatorjs/validator.js/issues/859), - [#861](https://github.com/validatorjs/validator.js/pull/861), - [#862](https://github.com/validatorjs/validator.js/pull/862), - [#863](https://github.com/validatorjs/validator.js/pull/863), - [#864](https://github.com/validatorjs/validator.js/pull/864), - [#870](https://github.com/validatorjs/validator.js/pull/870), - [#872](https://github.com/validatorjs/validator.js/pull/872)) + [#856](https://github.com/validatorjs/validator.js/pull/856), + [#859](https://github.com/validatorjs/validator.js/issues/859), + [#861](https://github.com/validatorjs/validator.js/pull/861), + [#862](https://github.com/validatorjs/validator.js/pull/862), + [#863](https://github.com/validatorjs/validator.js/pull/863), + [#864](https://github.com/validatorjs/validator.js/pull/864), + [#870](https://github.com/validatorjs/validator.js/pull/870), + [#872](https://github.com/validatorjs/validator.js/pull/872)) #### 10.4.0 @@ -634,8 +649,8 @@ ([#832](https://github.com/validatorjs/validator.js/pull/832)) - New locales ([#831](https://github.com/validatorjs/validator.js/pull/831), - [#835](https://github.com/validatorjs/validator.js/pull/835), - [#836](https://github.com/validatorjs/validator.js/pull/836)) + [#835](https://github.com/validatorjs/validator.js/pull/835), + [#836](https://github.com/validatorjs/validator.js/pull/836)) #### 10.2.0 @@ -683,10 +698,10 @@ - New and improved locales ([#763](https://github.com/validatorjs/validator.js/pull/763), - [#768](https://github.com/validatorjs/validator.js/pull/768), - [#774](https://github.com/validatorjs/validator.js/pull/774), - [#777](https://github.com/validatorjs/validator.js/pull/777), - [#779](https://github.com/validatorjs/validator.js/pull/779)) + [#768](https://github.com/validatorjs/validator.js/pull/768), + [#774](https://github.com/validatorjs/validator.js/pull/774), + [#777](https://github.com/validatorjs/validator.js/pull/777), + [#779](https://github.com/validatorjs/validator.js/pull/779)) #### 9.2.0 @@ -694,8 +709,8 @@ ([#760](https://github.com/validatorjs/validator.js/pull/760)) - New and improved locales ([#753](https://github.com/validatorjs/validator.js/pull/753), - [#755](https://github.com/validatorjs/validator.js/pull/755), - [#764](https://github.com/validatorjs/validator.js/pull/764)) + [#755](https://github.com/validatorjs/validator.js/pull/755), + [#764](https://github.com/validatorjs/validator.js/pull/764)) #### 9.1.2 @@ -706,7 +721,7 @@ - Locale fixes ([#738](https://github.com/validatorjs/validator.js/pull/738), - [#739](https://github.com/validatorjs/validator.js/pull/739)) + [#739](https://github.com/validatorjs/validator.js/pull/739)) #### 9.1.0 @@ -714,7 +729,7 @@ ([#734](https://github.com/validatorjs/validator.js/pull/734)) - New locales ([#735](https://github.com/validatorjs/validator.js/pull/735), - [#737](https://github.com/validatorjs/validator.js/pull/737)) + [#737](https://github.com/validatorjs/validator.js/pull/737)) #### 9.0.0 @@ -735,10 +750,10 @@ ([#713](https://github.com/validatorjs/validator.js/pull/713)) - New and improved locales ([#700](https://github.com/validatorjs/validator.js/pull/700), - [#701](https://github.com/validatorjs/validator.js/pull/701), - [#714](https://github.com/validatorjs/validator.js/pull/714), - [#715](https://github.com/validatorjs/validator.js/pull/715), - [#718](https://github.com/validatorjs/validator.js/pull/718)) + [#701](https://github.com/validatorjs/validator.js/pull/701), + [#714](https://github.com/validatorjs/validator.js/pull/714), + [#715](https://github.com/validatorjs/validator.js/pull/715), + [#718](https://github.com/validatorjs/validator.js/pull/718)) #### 8.1.0 @@ -774,7 +789,7 @@ ([#677](https://github.com/validatorjs/validator.js/pull/677)) - New locales ([#673](https://github.com/validatorjs/validator.js/pull/673), - [#676](https://github.com/validatorjs/validator.js/pull/676)) + [#676](https://github.com/validatorjs/validator.js/pull/676)) #### 7.1.0 @@ -787,9 +802,9 @@ ([#655](https://github.com/validatorjs/validator.js/issues/655)) - New locales ([#647](https://github.com/validatorjs/validator.js/pull/647), - [#667](https://github.com/validatorjs/validator.js/pull/667), - [#667](https://github.com/validatorjs/validator.js/pull/667), - [#671](https://github.com/validatorjs/validator.js/pull/671)) + [#667](https://github.com/validatorjs/validator.js/pull/667), + [#667](https://github.com/validatorjs/validator.js/pull/667), + [#671](https://github.com/validatorjs/validator.js/pull/671)) #### 7.0.0 @@ -801,9 +816,9 @@ ([#618](https://github.com/validatorjs/validator.js/issues/618)) - New locales ([#616](https://github.com/validatorjs/validator.js/pull/616), - [#622](https://github.com/validatorjs/validator.js/pull/622), - [#627](https://github.com/validatorjs/validator.js/pull/627), - [#630](https://github.com/validatorjs/validator.js/pull/630)) + [#622](https://github.com/validatorjs/validator.js/pull/622), + [#627](https://github.com/validatorjs/validator.js/pull/627), + [#630](https://github.com/validatorjs/validator.js/pull/630)) #### 6.2.1 @@ -855,7 +870,7 @@ ([#576](https://github.com/validatorjs/validator.js/pull/576)) - New locales ([#575](https://github.com/validatorjs/validator.js/pull/575), - [#552](https://github.com/validatorjs/validator.js/issues/552)) + [#552](https://github.com/validatorjs/validator.js/issues/552)) #### 5.6.0 @@ -997,7 +1012,7 @@ ([#471](https://github.com/validatorjs/validator.js/pull/471)) - Tweak Greek and Chinese mobile phone validation ([#467](https://github.com/validatorjs/validator.js/pull/467), - [#468](https://github.com/validatorjs/validator.js/pull/468)) + [#468](https://github.com/validatorjs/validator.js/pull/468)) - Fixed a bug in `isDate()` when validating ISO 8601 dates without a timezone ([#472](https://github.com/validatorjs/validator.js/issues/472)) diff --git a/README.md b/README.md index 2d9df463f..418c93530 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # validator.js + [![NPM version][npm-image]][npm-url] [![CI][ci-image]][ci-url] [![Coverage][codecov-image]][codecov-url] @@ -80,114 +81,114 @@ Thank you to the people who have already contributed: Here is a list of the validators currently available. -Validator | Description ---------------------------------------- | -------------------------------------- -**contains(str, seed [, options])** | check if the string contains the seed.

`options` is an object that defaults to `{ ignoreCase: false, minOccurrences: 1 }`.
Options:
`ignoreCase`: Ignore case when doing comparison, default false.
`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 [, options])** | check if the string is a date that is after the specified date.

`options` is an object that defaults to `{ comparisonDate: Date().toString() }`.
**Options:**
`comparisonDate`: Date to compare to. Defaults to `Date().toString()` (now). -**isAlpha(str [, locale, options])** | check if the string contains only letters (a-zA-Z).

`locale` is one of `['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'bg-BG', '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).

`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. -**isBase32(str [, options])** | check if the string is base32 encoded. `options` is optional and defaults to `{ crockford: false }`.
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 }`
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.
`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.

`options` is an object which defaults to `{ min: 0, max: undefined }`. -**isCreditCard(str [, options])** | check if the string is a credit card number.

`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.

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

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

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

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

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

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

`locale` 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']`.
**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.

`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 `. If `require_display_name` is set to true, the validator will reject strings without the format `Display Name `. 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.

`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.

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

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

`locale` 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).

`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. -**isHalfWidth(str)** | check if the string contains any half-width chars. -**isHash(str, algorithm)** | check if the string is a hash of type algorithm.

Algorithm is one of `['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][CSS Colors Level 4 Specification].

Comma-separated format supported. Space-separated format supported with the exception of a few edge cases (ex: `hsl(200grad+.1%62%/1)`). -**isIBAN(str, [, options])** | check if the string is an IBAN (International Bank Account Number).

`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.

`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.

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

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

`options` is an object which can contain the keys `min` and/or `max` to check the integer is within boundaries (e.g. `{ min: 10, max: 99 }`). `options` can also contain the key `allow_leading_zeroes`, which when set to false will disallow integer values with leading zeroes (e.g. `{ allow_leading_zeroes: false }`). Finally, `options` can contain the keys `gt` and/or `lt` which will enforce integers being greater than or less than, respectively, the value provided (e.g. `{gt: 1, lt: 4}` for a number between 1 and 4). -**isIP(str [, version])** | check if the string is an IP (version 4 or 6). -**isIPRange(str [, version])** | check if the string is an IP Range (version 4 or 6). -**isISBN(str [, options])** | check if the string is an [ISBN][ISBN].

`options` is an object that has no default.
**Options:**
`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). -**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. -**isISO8601(str [, options])** | check if the string is a valid [ISO 8601][ISO 8601] date.
`options` is an object which defaults to `{ strict: false, strictSeparator: false }`. If `strict` is true, date strings with invalid dates like `2009-02-29` will be invalid. If `strictSeparator` is true, date strings with date and time separated by anything other than a T will be invalid. -**isISO31661Alpha2(str)** | check if the string is a valid [ISO 3166-1 alpha-2][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].

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

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

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

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

`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. -**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.

`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]. -**isMailtoURI(str, [, options])** | check if the string is a [Magnet URI format][Mailto URI Format].

`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.

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,

`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-MW', '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).

`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.

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

`locale` 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.

`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', 'ZA']`. -**isPort(str)** | check if the string is a valid port number. -**isPostalCode(str, locale)** | check if the string is a postal code.

`locale` is one of `['AD', 'AT', 'AU', 'AZ', '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.

`includePercentValues` defaults to `true`. If you don't want to allow to set `rgb` or `rgba` values with percents, like `rgb(5%,5%,5%)`, or `rgba(90%,90%,90%,.3)`, then set it to false. -**isSemVer(str)** | check if the string is a Semantic Versioning Specification (SemVer). -**isSurrogatePair(str)** | check if the string contains any surrogate pairs chars. -**isUppercase(str)** | check if the string is uppercase. -**isSlug(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.
Default options:
`{ minLength: 8, minLowercase: 1, minUppercase: 1, minNumbers: 1, minSymbols: 1, returnScore: false, pointsPerUnique: 1, pointsPerRepeat: 0.5, pointsForContainingLower: 10, pointsForContainingUpper: 10, pointsForContainingNumber: 10, pointsForContainingSymbol: 10 }` -**isTime(str [, options])** | check if the string is a valid time e.g. [`23:01:59`, new Date().toLocaleTimeString()].

`options` is an object which can contain the keys `hourFormat` or `mode`.

`hourFormat` is a key and defaults to `'hour24'`.

`mode` is a key and defaults to `'default'`.

`hourFomat` can contain the values `'hour12'` or `'hour24'`, `'hour24'` will validate hours in 24 format and `'hour12'` will validate hours in 12 format.

`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`.

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

Supported locales: `[ 'bg-BG', 'cs-CZ', 'de-AT', 'de-DE', 'dk-DK', 'el-CY', 'el-GR', 'en-CA', 'en-GB', 'en-IE', 'en-US', 'es-AR', '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.

`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 }`.

`require_protocol` - if set to true isURL will return false if protocol is not present in the URL.
`require_valid_protocol` - isURL will check if the URL's protocol is present in the protocols option.
`protocols` - valid protocols can be modified with this option.
`require_host` - if set to false isURL will not check if host is present in the URL.
`require_port` - if set to true isURL will check if port is present in the URL.
`allow_protocol_relative_urls` - if set to true protocol relative URLs will be allowed.
`allow_fragments` - if set to false isURL will return false if fragments are present.
`allow_query_components` - if set to false isURL will return false if query components are present.
`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)** | 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].

`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.

Either `matches('foo', /foo/i)` or `matches('foo', 'foo', 'i')`. +| Validator | Description | +| --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **contains(str, seed [, options])** | check if the string contains the seed.

`options` is an object that defaults to `{ ignoreCase: false, minOccurrences: 1 }`.
Options:
`ignoreCase`: Ignore case when doing comparison, default false.
`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 [, options])** | check if the string is a date that is after the specified date.

`options` is an object that defaults to `{ comparisonDate: Date().toString() }`.
**Options:**
`comparisonDate`: Date to compare to. Defaults to `Date().toString()` (now). | +| **isAlpha(str [, locale, options])** | check if the string contains only letters (a-zA-Z).

`locale` is one of `['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'bg-BG', '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).

`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. | +| **isBase32(str [, options])** | check if the string is base32 encoded. `options` is optional and defaults to `{ crockford: false }`.
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 }`
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.
`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.

`options` is an object which defaults to `{ min: 0, max: undefined }`. | +| **isCreditCard(str [, options])** | check if the string is a credit card number.

`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.

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

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

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

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

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

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

`locale` 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']`.
**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.

`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 `. If `require_display_name` is set to true, the validator will reject strings without the format `Display Name `. 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.

`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.

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

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

`locale` 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).

`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. | +| **isHalfWidth(str)** | check if the string contains any half-width chars. | +| **isHash(str, algorithm)** | check if the string is a hash of type algorithm.

Algorithm is one of `['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][CSS Colors Level 4 Specification].

Comma-separated format supported. Space-separated format supported with the exception of a few edge cases (ex: `hsl(200grad+.1%62%/1)`). | +| **isIBAN(str, [, options])** | check if the string is an IBAN (International Bank Account Number).

`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.

`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.

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

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

`options` is an object which can contain the keys `min` and/or `max` to check the integer is within boundaries (e.g. `{ min: 10, max: 99 }`). `options` can also contain the key `allow_leading_zeroes`, which when set to false will disallow integer values with leading zeroes (e.g. `{ allow_leading_zeroes: false }`). Finally, `options` can contain the keys `gt` and/or `lt` which will enforce integers being greater than or less than, respectively, the value provided (e.g. `{gt: 1, lt: 4}` for a number between 1 and 4). | +| **isIP(str [, version])** | check if the string is an IP (version 4 or 6). | +| **isIPRange(str [, version])** | check if the string is an IP Range (version 4 or 6). | +| **isISBN(str [, options])** | check if the string is an [ISBN][ISBN].

`options` is an object that has no default.
**Options:**
`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). | +| **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. | +| **isISO8601(str [, options])** | check if the string is a valid [ISO 8601][ISO 8601] date.
`options` is an object which defaults to `{ strict: false, strictSeparator: false }`. If `strict` is true, date strings with invalid dates like `2009-02-29` will be invalid. If `strictSeparator` is true, date strings with date and time separated by anything other than a T will be invalid. | +| **isISO31661Alpha2(str)** | check if the string is a valid [ISO 3166-1 alpha-2][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].

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

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

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

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

`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. | +| **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.

`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]. | +| **isMailtoURI(str, [, options])** | check if the string is a [Magnet URI format][Mailto URI Format].

`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.

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,

`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-MW', '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).

`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.

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

`locale` 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.

`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', 'ZA']`. | +| **isPort(str)** | check if the string is a valid port number. | +| **isPostalCode(str, locale)** | check if the string is a postal code.

`locale` is one of `['AD', 'AT', 'AU', 'AZ', '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.

`includePercentValues` defaults to `true`. If you don't want to allow to set `rgb` or `rgba` values with percents, like `rgb(5%,5%,5%)`, or `rgba(90%,90%,90%,.3)`, then set it to false. | +| **isSemVer(str)** | check if the string is a Semantic Versioning Specification (SemVer). | +| **isSurrogatePair(str)** | check if the string contains any surrogate pairs chars. | +| **isUppercase(str)** | check if the string is uppercase. | +| **isSlug(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.
Default options:
`{ minLength: 8, minLowercase: 1, minUppercase: 1, minNumbers: 1, minSymbols: 1, returnScore: false, pointsPerUnique: 1, pointsPerRepeat: 0.5, pointsForContainingLower: 10, pointsForContainingUpper: 10, pointsForContainingNumber: 10, pointsForContainingSymbol: 10 }` | +| **isTime(str [, options])** | check if the string is a valid time e.g. [`23:01:59`, new Date().toLocaleTimeString()].

`options` is an object which can contain the keys `hourFormat` or `mode`.

`hourFormat` is a key and defaults to `'hour24'`.

`mode` is a key and defaults to `'default'`.

`hourFomat` can contain the values `'hour12'` or `'hour24'`, `'hour24'` will validate hours in 24 format and `'hour12'` will validate hours in 12 format.

`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`.

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

Supported locales: `[ 'bg-BG', 'cs-CZ', 'de-AT', 'de-DE', 'dk-DK', 'el-CY', 'el-GR', 'en-CA', 'en-GB', 'en-IE', 'en-US', 'es-AR', '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.

`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 }`.

`require_protocol` - if set to true isURL will return false if protocol is not present in the URL.
`require_valid_protocol` - isURL will check if the URL's protocol is present in the protocols option.
`protocols` - valid protocols can be modified with this option.
`require_host` - if set to false isURL will not check if host is present in the URL.
`require_port` - if set to true isURL will check if port is present in the URL.
`allow_protocol_relative_urls` - if set to true protocol relative URLs will be allowed.
`allow_fragments` - if set to false isURL will return false if fragments are present.
`allow_query_components` - if set to false isURL will return false if query components are present.
`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)** | 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].

`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.

Either `matches('foo', /foo/i)` or `matches('foo', 'foo', 'i')`. | ## Sanitizers Here is a list of the sanitizers currently available. -Sanitizer | Description --------------------------------------- | ------------------------------- -**blacklist(input, chars)** | remove characters that appear in the blacklist. The characters are used in a RegExp and so you will need to escape some chars, e.g. `blacklist(input, '\\[\\]')`. -**escape(input)** | replace `<`, `>`, `&`, `'`, `"` and `/` with HTML entities. -**ltrim(input [, chars])** | trim characters from the left-side of the input. -**normalizeEmail(email [, options])** | canonicalize an email address. (This doesn't validate that the input is an email, if you want to validate the email use isEmail beforehand).

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

`options` is an object with the following keys and default values:
  • _all_lowercase: true_ - Transforms the local part (before the @ symbol) of all email addresses to lowercase. Please note that this may violate RFC 5321, which gives providers the possibility to treat the local part of email addresses in a case sensitive way (although in practice most - yet not all - providers don't). The domain part of the email address is always lowercased, as it is case insensitive per RFC 1035.
  • _gmail_lowercase: true_ - Gmail addresses are known to be case-insensitive, so this switch allows lowercasing them even when _all_lowercase_ is set to false. Please note that when _all_lowercase_ is true, Gmail addresses are lowercased regardless of the value of this setting.
  • _gmail_remove_dots: true_: Removes dots from the local part of the email address, as Gmail ignores them (e.g. "john.doe" and "johndoe" are considered equal).
  • _gmail_remove_subaddress: true_: Normalizes addresses by removing "sub-addresses", which is the part following a "+" sign (e.g. "foo+bar@gmail.com" becomes "foo@gmail.com").
  • _gmail_convert_googlemaildotcom: true_: Converts addresses with domain @googlemail.com to @gmail.com, as they're equivalent.
  • _outlookdotcom_lowercase: true_ - Outlook.com addresses (including Windows Live and Hotmail) are known to be case-insensitive, so this switch allows lowercasing them even when _all_lowercase_ is set to false. Please note that when _all_lowercase_ is true, Outlook.com addresses are lowercased regardless of the value of this setting.
  • _outlookdotcom_remove_subaddress: true_: Normalizes addresses by removing "sub-addresses", which is the part following a "+" sign (e.g. "foo+bar@outlook.com" becomes "foo@outlook.com").
  • _yahoo_lowercase: true_ - Yahoo Mail addresses are known to be case-insensitive, so this switch allows lowercasing them even when _all_lowercase_ is set to false. Please note that when _all_lowercase_ is true, Yahoo Mail addresses are lowercased regardless of the value of this setting.
  • _yahoo_remove_subaddress: true_: Normalizes addresses by removing "sub-addresses", which is the part following a "-" sign (e.g. "foo-bar@yahoo.com" becomes "foo@yahoo.com").
  • _icloud_lowercase: true_ - iCloud addresses (including MobileMe) are known to be case-insensitive, so this switch allows lowercasing them even when _all_lowercase_ is set to false. Please note that when _all_lowercase_ is true, iCloud addresses are lowercased regardless of the value of this setting.
  • _icloud_remove_subaddress: true_: Normalizes addresses by removing "sub-addresses", which is the part following a "+" sign (e.g. "foo+bar@icloud.com" becomes "foo@icloud.com").
| +| **rtrim(input [, chars])** | trim characters from the right-side of the input. | +| **stripLow(input [, keep_new_lines])** | remove characters with a numerical value < 32 and 127, mostly control characters. If `keep_new_lines` is `true`, newline characters are preserved (`\n` and `\r`, hex `0xA` and `0xD`). Unicode-safe in JavaScript. | +| **toBoolean(input [, strict])** | convert the input string to a boolean. Everything except for `'0'`, `'false'` and `''` returns `true`. In strict mode only `'1'` and `'true'` return `true`. | +| **toDate(input)** | convert the input string to a date, or `null` if the input is not a date. | +| **toFloat(input)** | convert the input string to a float, or `NaN` if the input is not a float. | +| **toInt(input [, radix])** | convert the input string to an integer, or `NaN` if the input is not an integer. | +| **trim(input [, chars])** | trim characters (whitespace by default) from both sides of the input. | +| **unescape(input)** | 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, '\\[\\]')`. | ### XSS Sanitization @@ -202,12 +203,12 @@ In general, we follow the "fork-and-pull" Git workflow. 1. Fork the repo on GitHub 2. Clone the project to your own machine 3. Work on your fork - 1. Make your changes and additions - - Most of your changes should be focused on `src/` and `test/` folders and/or `README.md`. - - Files such as `validator.js`, `validator.min.js` and files in `lib/` folder are autogenerated when running tests (`npm test`) and need not to be changed **manually**. - 2. Change or add tests if needed - 3. Run tests and make sure they pass - 4. Add changes to README.md if needed + 1. Make your changes and additions + - Most of your changes should be focused on `src/` and `test/` folders and/or `README.md`. + - Files such as `validator.js`, `validator.min.js` and files in `lib/` folder are autogenerated when running tests (`npm test`) and need not to be changed **manually**. + 2. Change or add tests if needed + 3. Run tests and make sure they pass + 4. Add changes to README.md if needed 4. Commit changes to your own branch 5. **Make sure** you merge the latest from "upstream" and resolve conflicts if there is any 6. Repeat step 3(3) above @@ -259,24 +260,17 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` [downloads-image]: http://img.shields.io/npm/dm/validator.svg - [npm-url]: https://npmjs.org/package/validator [npm-image]: http://img.shields.io/npm/v/validator.svg - [codecov-url]: https://codecov.io/gh/validatorjs/validator.js [codecov-image]: https://codecov.io/gh/validatorjs/validator.js/branch/master/graph/badge.svg - [ci-url]: https://github.com/validatorjs/validator.js/actions?query=workflow%3ACI [ci-image]: https://github.com/validatorjs/validator.js/workflows/CI/badge.svg?branch=master - [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 - [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 diff --git a/SECURITY.md b/SECURITY.md index 72592f135..b4be59bad 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -8,4 +8,4 @@ In the case of a confirmed security issue, only the current version of validator **Please don't disclose security-related issues publicly.** -If you discover a vulnerability within validator, please use [huntr.dev disclosure form](https://huntr.dev/bounties/disclose/?target=https://github.com/validatorjs/validator.js). We will try to validate and respond to reports in a reasonable time. if the issue is confirmed, we will create a security advisory and a patch as soon as possible. \ No newline at end of file +If you discover a vulnerability within validator, please use [huntr.dev disclosure form](https://huntr.dev/bounties/disclose/?target=https://github.com/validatorjs/validator.js). We will try to validate and respond to reports in a reasonable time. if the issue is confirmed, we will create a security advisory and a patch as soon as possible. diff --git a/jsconfig.json b/jsconfig.json index 1376adb2c..98c933f5c 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -3,4 +3,4 @@ "module": "system", "target": "ES6" } -} \ No newline at end of file +} diff --git a/rollup.config.mjs b/rollup.config.mjs index 33cc1b407..0b42d5dff 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -4,25 +4,32 @@ import babel from '@rollup/plugin-babel'; import babelPresetEnv from '@babel/preset-env'; import terser from '@rollup/plugin-terser'; -const license = `/*!\n${String(fs.readFileSync('./LICENSE')).trim().split('\n').map((l) => (l ? ` * ${l}` : ' *')).join('\n')}\n */`; +const license = `/*!\n${String(fs.readFileSync('./LICENSE')) + .trim() + .split('\n') + .map((l) => (l ? ` * ${l}` : ' *')) + .join('\n')}\n */`; /** * @type {import('rollup').RollupOptions} */ const config = { input: 'src/index.js', - output: [{ - file: 'validator.js', - format: 'umd', - name: 'validator', - banner: license, - }, { - file: 'validator.min.js', - format: 'umd', - name: 'validator', - plugins: [terser()], - banner: license, - }], + output: [ + { + file: 'validator.js', + format: 'umd', + name: 'validator', + banner: license, + }, + { + file: 'validator.min.js', + format: 'umd', + name: 'validator', + plugins: [terser()], + banner: license, + }, + ], plugins: [ babel({ presets: [[babelPresetEnv, { modules: false }]], diff --git a/src/index.js b/src/index.js index 7815eadf9..c45d5f138 100644 --- a/src/index.js +++ b/src/index.js @@ -1,138 +1,138 @@ -import toDate from "./lib/toDate.js"; -import toFloat from "./lib/toFloat.js"; -import toInt from "./lib/toInt.js"; -import toBoolean from "./lib/toBoolean.js"; -import equals from "./lib/equals.js"; -import contains from "./lib/contains.js"; -import matches from "./lib/matches.js"; - -import isEmail from "./lib/isEmail.js"; -import isURL from "./lib/isURL.js"; -import isMACAddress from "./lib/isMACAddress.js"; -import isIP from "./lib/isIP.js"; -import isIPRange from "./lib/isIPRange.js"; -import isFQDN from "./lib/isFQDN.js"; -import isDate from "./lib/isDate.js"; -import isTime from "./lib/isTime.js"; - -import isBoolean from "./lib/isBoolean.js"; -import isLocale from "./lib/isLocale.js"; - -import isAlpha, { locales as isAlphaLocales } from "./lib/isAlpha.js"; +import toDate from './lib/toDate.js'; +import toFloat from './lib/toFloat.js'; +import toInt from './lib/toInt.js'; +import toBoolean from './lib/toBoolean.js'; +import equals from './lib/equals.js'; +import contains from './lib/contains.js'; +import matches from './lib/matches.js'; + +import isEmail from './lib/isEmail.js'; +import isURL from './lib/isURL.js'; +import isMACAddress from './lib/isMACAddress.js'; +import isIP from './lib/isIP.js'; +import isIPRange from './lib/isIPRange.js'; +import isFQDN from './lib/isFQDN.js'; +import isDate from './lib/isDate.js'; +import isTime from './lib/isTime.js'; + +import isBoolean from './lib/isBoolean.js'; +import isLocale from './lib/isLocale.js'; + +import isAlpha, { locales as isAlphaLocales } from './lib/isAlpha.js'; import isAlphanumeric, { locales as isAlphanumericLocales, -} from "./lib/isAlphanumeric.js"; -import isNumeric from "./lib/isNumeric.js"; -import isPassportNumber from "./lib/isPassportNumber.js"; -import isPort from "./lib/isPort.js"; -import isLowercase from "./lib/isLowercase.js"; -import isUppercase from "./lib/isUppercase.js"; +} from './lib/isAlphanumeric.js'; +import isNumeric from './lib/isNumeric.js'; +import isPassportNumber from './lib/isPassportNumber.js'; +import isPort from './lib/isPort.js'; +import isLowercase from './lib/isLowercase.js'; +import isUppercase from './lib/isUppercase.js'; -import isIMEI from "./lib/isIMEI.js"; +import isIMEI from './lib/isIMEI.js'; -import isAscii from "./lib/isAscii.js"; -import isFullWidth from "./lib/isFullWidth.js"; -import isHalfWidth from "./lib/isHalfWidth.js"; -import isVariableWidth from "./lib/isVariableWidth.js"; -import isMultibyte from "./lib/isMultibyte.js"; -import isSemVer from "./lib/isSemVer.js"; -import isSurrogatePair from "./lib/isSurrogatePair.js"; +import isAscii from './lib/isAscii.js'; +import isFullWidth from './lib/isFullWidth.js'; +import isHalfWidth from './lib/isHalfWidth.js'; +import isVariableWidth from './lib/isVariableWidth.js'; +import isMultibyte from './lib/isMultibyte.js'; +import isSemVer from './lib/isSemVer.js'; +import isSurrogatePair from './lib/isSurrogatePair.js'; -import isInt from "./lib/isInt.js"; -import isFloat, { locales as isFloatLocales } from "./lib/isFloat.js"; -import isDecimal from "./lib/isDecimal.js"; -import isHexadecimal from "./lib/isHexadecimal.js"; -import isOctal from "./lib/isOctal.js"; -import isDivisibleBy from "./lib/isDivisibleBy.js"; +import isInt from './lib/isInt.js'; +import isFloat, { locales as isFloatLocales } from './lib/isFloat.js'; +import isDecimal from './lib/isDecimal.js'; +import isHexadecimal from './lib/isHexadecimal.js'; +import isOctal from './lib/isOctal.js'; +import isDivisibleBy from './lib/isDivisibleBy.js'; -import isHexColor from "./lib/isHexColor.js"; -import isRgbColor from "./lib/isRgbColor.js"; -import isHSL from "./lib/isHSL.js"; +import isHexColor from './lib/isHexColor.js'; +import isRgbColor from './lib/isRgbColor.js'; +import isHSL from './lib/isHSL.js'; -import isISRC from "./lib/isISRC.js"; +import isISRC from './lib/isISRC.js'; -import isIBAN, { locales as ibanLocales } from "./lib/isIBAN.js"; -import isBIC from "./lib/isBIC.js"; +import isIBAN, { locales as ibanLocales } from './lib/isIBAN.js'; +import isBIC from './lib/isBIC.js'; -import isMD5 from "./lib/isMD5.js"; -import isHash from "./lib/isHash.js"; -import isJWT from "./lib/isJWT.js"; +import isMD5 from './lib/isMD5.js'; +import isHash from './lib/isHash.js'; +import isJWT from './lib/isJWT.js'; -import isJSON from "./lib/isJSON.js"; -import isEmpty from "./lib/isEmpty.js"; +import isJSON from './lib/isJSON.js'; +import isEmpty from './lib/isEmpty.js'; -import isLength from "./lib/isLength.js"; -import isByteLength from "./lib/isByteLength.js"; +import isLength from './lib/isLength.js'; +import isByteLength from './lib/isByteLength.js'; -import isUUID from "./lib/isUUID.js"; -import isMongoId from "./lib/isMongoId.js"; +import isUUID from './lib/isUUID.js'; +import isMongoId from './lib/isMongoId.js'; -import isAfter from "./lib/isAfter.js"; -import isBefore from "./lib/isBefore.js"; +import isAfter from './lib/isAfter.js'; +import isBefore from './lib/isBefore.js'; -import isIn from "./lib/isIn.js"; +import isIn from './lib/isIn.js'; -import isLuhnNumber from "./lib/isLuhnNumber.js"; -import isCreditCard from "./lib/isCreditCard.js"; -import isIdentityCard from "./lib/isIdentityCard.js"; +import isLuhnNumber from './lib/isLuhnNumber.js'; +import isCreditCard from './lib/isCreditCard.js'; +import isIdentityCard from './lib/isIdentityCard.js'; -import isEAN from "./lib/isEAN.js"; -import isISIN from "./lib/isISIN.js"; -import isISBN from "./lib/isISBN.js"; -import isISSN from "./lib/isISSN.js"; -import isTaxID from "./lib/isTaxID.js"; +import isEAN from './lib/isEAN.js'; +import isISIN from './lib/isISIN.js'; +import isISBN from './lib/isISBN.js'; +import isISSN from './lib/isISSN.js'; +import isTaxID from './lib/isTaxID.js'; import isMobilePhone, { locales as isMobilePhoneLocales, -} from "./lib/isMobilePhone.js"; +} from './lib/isMobilePhone.js'; -import isEthereumAddress from "./lib/isEthereumAddress.js"; +import isEthereumAddress from './lib/isEthereumAddress.js'; -import isCurrency from "./lib/isCurrency.js"; +import isCurrency from './lib/isCurrency.js'; -import isBtcAddress from "./lib/isBtcAddress.js"; +import isBtcAddress from './lib/isBtcAddress.js'; -import { isISO6346, isFreightContainerID } from "./lib/isISO6346.js"; -import isISO6391 from "./lib/isISO6391.js"; -import isISO8601 from "./lib/isISO8601.js"; -import isRFC3339 from "./lib/isRFC3339.js"; -import isISO31661Alpha2 from "./lib/isISO31661Alpha2.js"; -import isISO31661Alpha3 from "./lib/isISO31661Alpha3.js"; -import isISO4217 from "./lib/isISO4217.js"; +import { isISO6346, isFreightContainerID } from './lib/isISO6346.js'; +import isISO6391 from './lib/isISO6391.js'; +import isISO8601 from './lib/isISO8601.js'; +import isRFC3339 from './lib/isRFC3339.js'; +import isISO31661Alpha2 from './lib/isISO31661Alpha2.js'; +import isISO31661Alpha3 from './lib/isISO31661Alpha3.js'; +import isISO4217 from './lib/isISO4217.js'; -import isBase32 from "./lib/isBase32.js"; -import isBase58 from "./lib/isBase58.js"; -import isBase64 from "./lib/isBase64.js"; -import isDataURI from "./lib/isDataURI.js"; -import isMagnetURI from "./lib/isMagnetURI.js"; -import isMailtoURI from "./lib/isMailtoURI.js"; +import isBase32 from './lib/isBase32.js'; +import isBase58 from './lib/isBase58.js'; +import isBase64 from './lib/isBase64.js'; +import isDataURI from './lib/isDataURI.js'; +import isMagnetURI from './lib/isMagnetURI.js'; +import isMailtoURI from './lib/isMailtoURI.js'; -import isMimeType from "./lib/isMimeType.js"; +import isMimeType from './lib/isMimeType.js'; -import isLatLong from "./lib/isLatLong.js"; +import isLatLong from './lib/isLatLong.js'; import isPostalCode, { locales as isPostalCodeLocales, -} from "./lib/isPostalCode.js"; +} from './lib/isPostalCode.js'; -import ltrim from "./lib/ltrim.js"; -import rtrim from "./lib/rtrim.js"; -import trim from "./lib/trim.js"; -import escape from "./lib/escape.js"; -import unescape from "./lib/unescape.js"; -import stripLow from "./lib/stripLow.js"; -import whitelist from "./lib/whitelist.js"; -import blacklist from "./lib/blacklist.js"; -import isWhitelisted from "./lib/isWhitelisted.js"; +import ltrim from './lib/ltrim.js'; +import rtrim from './lib/rtrim.js'; +import trim from './lib/trim.js'; +import escape from './lib/escape.js'; +import unescape from './lib/unescape.js'; +import stripLow from './lib/stripLow.js'; +import whitelist from './lib/whitelist.js'; +import blacklist from './lib/blacklist.js'; +import isWhitelisted from './lib/isWhitelisted.js'; -import normalizeEmail from "./lib/normalizeEmail.js"; +import normalizeEmail from './lib/normalizeEmail.js'; -import isSlug from "./lib/isSlug.js"; -import isLicensePlate from "./lib/isLicensePlate.js"; -import isStrongPassword from "./lib/isStrongPassword.js"; +import isSlug from './lib/isSlug.js'; +import isLicensePlate from './lib/isLicensePlate.js'; +import isStrongPassword from './lib/isStrongPassword.js'; -import isVAT from "./lib/isVAT.js"; +import isVAT from './lib/isVAT.js'; -const version = "13.11.0"; +const version = '13.11.0'; const validator = { version, diff --git a/src/lib/alpha.js b/src/lib/alpha.js index b31d3360a..25d32f8a7 100644 --- a/src/lib/alpha.js +++ b/src/lib/alpha.js @@ -29,7 +29,8 @@ export const alpha = { 'th-TH': /^[ก-๐\s]+$/i, 'tr-TR': /^[A-ZÇĞİıÖŞÜ]+$/i, 'uk-UA': /^[А-ЩЬЮЯЄIЇҐі]+$/i, - 'vi-VN': /^[A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i, + 'vi-VN': + /^[A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i, 'ko-KR': /^[ㄱ-ㅎㅏ-ㅣ가-힣]*$/, 'ku-IQ': /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i, ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/, @@ -60,7 +61,8 @@ export const alphanumeric = { 'pl-PL': /^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i, 'pt-PT': /^[0-9A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i, 'ru-RU': /^[0-9А-ЯЁ]+$/i, - 'kk-KZ': /^[0-9А-ЯЁ\u04D8\u04B0\u0406\u04A2\u0492\u04AE\u049A\u04E8\u04BA]+$/i, + 'kk-KZ': + /^[0-9А-ЯЁ\u04D8\u04B0\u0406\u04A2\u0492\u04AE\u049A\u04E8\u04BA]+$/i, 'sl-SI': /^[0-9A-ZČĆĐŠŽ]+$/i, 'sk-SK': /^[0-9A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i, 'sr-RS@latin': /^[0-9A-ZČĆŽŠĐ]+$/i, @@ -71,7 +73,8 @@ export const alphanumeric = { 'uk-UA': /^[0-9А-ЩЬЮЯЄIЇҐі]+$/i, 'ko-KR': /^[0-9ㄱ-ㅎㅏ-ㅣ가-힣]*$/, 'ku-IQ': /^[٠١٢٣٤٥٦٧٨٩0-9ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i, - 'vi-VN': /^[0-9A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i, + 'vi-VN': + /^[0-9A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i, ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/, he: /^[0-9א-ת]+$/, fa: /^['0-9آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی۱۲۳۴۵۶۷۸۹۰']+$/i, @@ -95,8 +98,25 @@ for (let locale, i = 0; i < englishLocales.length; i++) { } // Source: http://www.localeplanet.com/java/ -export const arabicLocales = ['AE', 'BH', 'DZ', 'EG', 'IQ', 'JO', 'KW', 'LB', 'LY', - 'MA', 'QM', 'QA', 'SA', 'SD', 'SY', 'TN', 'YE']; +export const arabicLocales = [ + 'AE', + 'BH', + 'DZ', + 'EG', + 'IQ', + 'JO', + 'KW', + 'LB', + 'LY', + 'MA', + 'QM', + 'QA', + 'SA', + 'SD', + 'SY', + 'TN', + 'YE', +]; for (let locale, i = 0; i < arabicLocales.length; i++) { locale = `ar-${arabicLocales[i]}`; @@ -125,9 +145,35 @@ for (let locale, i = 0; i < bengaliLocales.length; i++) { // Source: https://en.wikipedia.org/wiki/Decimal_mark export const dotDecimal = ['ar-EG', 'ar-LB', 'ar-LY']; export const 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', + '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', ]; for (let i = 0; i < dotDecimal.length; i++) { diff --git a/src/lib/contains.js b/src/lib/contains.js index 1fd303d74..f2af203d1 100644 --- a/src/lib/contains.js +++ b/src/lib/contains.js @@ -12,7 +12,10 @@ export default function contains(str, elem, options) { options = merge(options, defaulContainsOptions); if (options.ignoreCase) { - return str.toLowerCase().split(toString(elem).toLowerCase()).length > options.minOccurrences; + return ( + str.toLowerCase().split(toString(elem).toLowerCase()).length > + options.minOccurrences + ); } return str.split(toString(elem)).length > options.minOccurrences; diff --git a/src/lib/escape.js b/src/lib/escape.js index 183d3407f..afc0be38e 100644 --- a/src/lib/escape.js +++ b/src/lib/escape.js @@ -2,12 +2,13 @@ import assertString from './util/assertString.js'; export default function escape(str) { assertString(str); - return (str.replace(/&/g, '&') + return str + .replace(/&/g, '&') .replace(/"/g, '"') .replace(/'/g, ''') .replace(//g, '>') .replace(/\//g, '/') .replace(/\\/g, '\') - .replace(/`/g, '`')); + .replace(/`/g, '`'); } diff --git a/src/lib/isAfter.js b/src/lib/isAfter.js index 2a8b77f90..b6fcc0f76 100644 --- a/src/lib/isAfter.js +++ b/src/lib/isAfter.js @@ -3,7 +3,8 @@ import toDate from './toDate.js'; export default function isAfter(date, options) { // For backwards compatibility: // isAfter(str [, date]), i.e. `options` could be used as argument for the legacy `date` - const comparisonDate = options?.comparisonDate || options || Date().toString(); + const comparisonDate = + options?.comparisonDate || options || Date().toString(); const comparison = toDate(comparisonDate); const original = toDate(date); diff --git a/src/lib/isAlpha.js b/src/lib/isAlpha.js index c9b6b7a86..40ef9f1f0 100644 --- a/src/lib/isAlpha.js +++ b/src/lib/isAlpha.js @@ -11,7 +11,13 @@ export default function isAlpha(_str, locale = 'en-US', options = {}) { if (ignore instanceof RegExp) { str = str.replace(ignore, ''); } else if (typeof ignore === 'string') { - str = str.replace(new RegExp(`[${ignore.replace(/[-[\]{}()*+?.,\\^$|#\\s]/g, '\\$&')}]`, 'g'), ''); // escape regex for ignore + str = str.replace( + new RegExp( + `[${ignore.replace(/[-[\]{}()*+?.,\\^$|#\\s]/g, '\\$&')}]`, + 'g', + ), + '', + ); // escape regex for ignore } else { throw new Error('ignore should be instance of a String or RegExp'); } diff --git a/src/lib/isAlphanumeric.js b/src/lib/isAlphanumeric.js index e08de7504..7e94420f9 100644 --- a/src/lib/isAlphanumeric.js +++ b/src/lib/isAlphanumeric.js @@ -11,7 +11,13 @@ export default function isAlphanumeric(_str, locale = 'en-US', options = {}) { if (ignore instanceof RegExp) { str = str.replace(ignore, ''); } else if (typeof ignore === 'string') { - str = str.replace(new RegExp(`[${ignore.replace(/[-[\]{}()*+?.,\\^$|#\\s]/g, '\\$&')}]`, 'g'), ''); // escape regex for ignore + str = str.replace( + new RegExp( + `[${ignore.replace(/[-[\]{}()*+?.,\\^$|#\\s]/g, '\\$&')}]`, + 'g', + ), + '', + ); // escape regex for ignore } else { throw new Error('ignore should be instance of a String or RegExp'); } diff --git a/src/lib/isBase64.js b/src/lib/isBase64.js index 0abe10529..085ec3501 100644 --- a/src/lib/isBase64.js +++ b/src/lib/isBase64.js @@ -22,7 +22,9 @@ export default function isBase64(str, options) { } const firstPaddingChar = str.indexOf('='); - return firstPaddingChar === -1 - || firstPaddingChar === len - 1 - || (firstPaddingChar === len - 2 && str[len - 1] === '='); + return ( + firstPaddingChar === -1 || + firstPaddingChar === len - 1 || + (firstPaddingChar === len - 2 && str[len - 1] === '=') + ); } diff --git a/src/lib/isByteLength.js b/src/lib/isByteLength.js index 16514d6f7..61b0e67d2 100644 --- a/src/lib/isByteLength.js +++ b/src/lib/isByteLength.js @@ -5,10 +5,11 @@ export default function isByteLength(str, options) { assertString(str); let min; let max; - if (typeof (options) === 'object') { + if (typeof options === 'object') { min = options.min || 0; max = options.max; - } else { // backwards compatibility: isByteLength(str, min [, max]) + } else { + // backwards compatibility: isByteLength(str, min [, max]) min = arguments[1]; max = arguments[2]; } diff --git a/src/lib/isCreditCard.js b/src/lib/isCreditCard.js index f031e2262..27de1ba24 100644 --- a/src/lib/isCreditCard.js +++ b/src/lib/isCreditCard.js @@ -1,5 +1,5 @@ -import assertString from "./util/assertString.js"; -import isLuhnValid from "./isLuhnNumber.js"; +import assertString from './util/assertString.js'; +import isLuhnValid from './isLuhnNumber.js'; const cards = { amex: /^3[47][0-9]{13}$/, @@ -26,7 +26,7 @@ const allCards = (() => { export default function isCreditCard(card, options = {}) { assertString(card); const { provider } = options; - const sanitized = card.replace(/[- ]+/g, ""); + const sanitized = card.replace(/[- ]+/g, ''); if (provider && provider.toLowerCase() in cards) { // specific provider in the list if (!cards[provider.toLowerCase()].test(sanitized)) { diff --git a/src/lib/isCurrency.js b/src/lib/isCurrency.js index 7a68bbafa..8adf832e5 100755 --- a/src/lib/isCurrency.js +++ b/src/lib/isCurrency.js @@ -3,17 +3,28 @@ import assertString from './util/assertString.js'; function currencyRegex(options) { let decimal_digits = `\\d{${options.digits_after_decimal[0]}}`; - options.digits_after_decimal.forEach((digit, index) => { if (index !== 0) decimal_digits = `${decimal_digits}|\\d{${digit}}`; }); + options.digits_after_decimal.forEach((digit, index) => { + if (index !== 0) decimal_digits = `${decimal_digits}|\\d{${digit}}`; + }); - const symbol = `(${options.symbol.replace(/\W/, (m) => `\\${m}`)})${(options.require_symbol ? '' : '?')}`, + const symbol = `(${options.symbol.replace(/\W/, (m) => `\\${m}`)})${ + options.require_symbol ? '' : '?' + }`, negative = '-?', whole_dollar_amount_without_sep = '[1-9]\\d*', whole_dollar_amount_with_sep = `[1-9]\\d{0,2}(\\${options.thousands_separator}\\d{3})*`, valid_whole_dollar_amounts = [ - '0', whole_dollar_amount_without_sep, whole_dollar_amount_with_sep], + '0', + whole_dollar_amount_without_sep, + whole_dollar_amount_with_sep, + ], whole_dollar_amount = `(${valid_whole_dollar_amounts.join('|')})?`, - decimal_amount = `(\\${options.decimal_separator}(${decimal_digits}))${options.require_decimal ? '' : '?'}`; - let pattern = whole_dollar_amount + (options.allow_decimal || options.require_decimal ? decimal_amount : ''); + decimal_amount = `(\\${options.decimal_separator}(${decimal_digits}))${ + options.require_decimal ? '' : '?' + }`; + let pattern = + whole_dollar_amount + + (options.allow_decimal || options.require_decimal ? decimal_amount : ''); // default is negative sign before symbol, but there are two other options (besides parens) if (options.allow_negatives && !options.parens_for_negatives) { @@ -42,7 +53,12 @@ function currencyRegex(options) { if (options.allow_negatives) { if (options.parens_for_negatives) { pattern = `(\\(${pattern}\\)|${pattern})`; - } else if (!(options.negative_sign_before_digits || options.negative_sign_after_digits)) { + } else if ( + !( + options.negative_sign_before_digits || + options.negative_sign_after_digits + ) + ) { pattern = negative + pattern; } } diff --git a/src/lib/isDataURI.js b/src/lib/isDataURI.js index 2c71c9673..f3e6ba07c 100644 --- a/src/lib/isDataURI.js +++ b/src/lib/isDataURI.js @@ -23,8 +23,10 @@ export default function isDataURI(str) { } for (let i = 0; i < attributes.length; i++) { if ( - !(i === attributes.length - 1 && attributes[i].toLowerCase() === 'base64') - && !validAttribute.test(attributes[i]) + !( + i === attributes.length - 1 && attributes[i].toLowerCase() === 'base64' + ) && + !validAttribute.test(attributes[i]) ) { return false; } diff --git a/src/lib/isDate.js b/src/lib/isDate.js index 598f41c32..462333810 100644 --- a/src/lib/isDate.js +++ b/src/lib/isDate.js @@ -7,7 +7,9 @@ const default_date_options = { }; function isValidFormat(format) { - return /(^(y{4}|y{2})[.\/-](m{1,2})[.\/-](d{1,2})$)|(^(m{1,2})[.\/-](d{1,2})[.\/-]((y{4}|y{2})$))|(^(d{1,2})[.\/-](m{1,2})[.\/-]((y{4}|y{2})$))/gi.test(format); + return /(^(y{4}|y{2})[.\/-](m{1,2})[.\/-](d{1,2})$)|(^(m{1,2})[.\/-](d{1,2})[.\/-]((y{4}|y{2})$))|(^(d{1,2})[.\/-](m{1,2})[.\/-]((y{4}|y{2})$))/gi.test( + format, + ); } function zip(date, format) { @@ -22,20 +24,22 @@ function zip(date, format) { } export default function isDate(input, options) { - if (typeof options === 'string') { // Allow backward compatbility for old format isDate(input [, format]) + if (typeof options === 'string') { + // Allow backward compatbility for old format isDate(input [, format]) options = merge({ format: options }, default_date_options); } else { options = merge(options, default_date_options); } if (typeof input === 'string' && isValidFormat(options.format)) { - const formatDelimiter = options.delimiters - .find((delimiter) => options.format.indexOf(delimiter) !== -1); + const formatDelimiter = options.delimiters.find( + (delimiter) => options.format.indexOf(delimiter) !== -1, + ); const dateDelimiter = options.strictMode ? formatDelimiter : options.delimiters.find((delimiter) => input.indexOf(delimiter) !== -1); const dateAndFormat = zip( input.split(dateDelimiter), - options.format.toLowerCase().split(formatDelimiter) + options.format.toLowerCase().split(formatDelimiter), ); const dateObj = {}; @@ -77,11 +81,17 @@ export default function isDate(input, options) { day = `0${dateObj.d}`; } - return new Date(`${fullYear}-${month}-${day}T00:00:00.000Z`).getUTCDate() === +dateObj.d; + return ( + new Date(`${fullYear}-${month}-${day}T00:00:00.000Z`).getUTCDate() === + +dateObj.d + ); } if (!options.strictMode) { - return Object.prototype.toString.call(input) === '[object Date]' && isFinite(input); + return ( + Object.prototype.toString.call(input) === '[object Date]' && + isFinite(input) + ); } return false; diff --git a/src/lib/isDecimal.js b/src/lib/isDecimal.js index 4d3b54595..e1536882e 100644 --- a/src/lib/isDecimal.js +++ b/src/lib/isDecimal.js @@ -4,7 +4,11 @@ import includes from './util/includes.js'; import { decimal } from './alpha.js'; function decimalRegExp(options) { - const regExp = new RegExp(`^[-+]?([0-9]+)?(\\${decimal[options.locale]}[0-9]{${options.decimal_digits}})${options.force_decimal ? '' : '?'}$`); + const regExp = new RegExp( + `^[-+]?([0-9]+)?(\\${decimal[options.locale]}[0-9]{${ + options.decimal_digits + }})${options.force_decimal ? '' : '?'}$`, + ); return regExp; } @@ -20,7 +24,10 @@ export default function isDecimal(str, options) { assertString(str); options = merge(options, default_decimal_options); if (options.locale in decimal) { - return !includes(blacklist, str.replace(/ /g, '')) && decimalRegExp(options).test(str); + return ( + !includes(blacklist, str.replace(/ /g, '')) && + decimalRegExp(options).test(str) + ); } throw new Error(`Invalid locale '${options.locale}'`); } diff --git a/src/lib/isEAN.js b/src/lib/isEAN.js index 7843171b7..c3bbe4e7d 100644 --- a/src/lib/isEAN.js +++ b/src/lib/isEAN.js @@ -33,10 +33,10 @@ const validEanRegex = /^(\d{8}|\d{13}|\d{14})$/; */ function getPositionWeightThroughLengthAndIndex(length, index) { if (length === LENGTH_EAN_8 || length === LENGTH_EAN_14) { - return (index % 2 === 0) ? 3 : 1; + return index % 2 === 0 ? 3 : 1; } - return (index % 2 === 0) ? 1 : 3; + return index % 2 === 0 ? 1 : 3; } /** @@ -50,7 +50,11 @@ function calculateCheckDigit(ean) { const checksum = ean .slice(0, -1) .split('') - .map((char, index) => Number(char) * getPositionWeightThroughLengthAndIndex(ean.length, index)) + .map( + (char, index) => + Number(char) * + getPositionWeightThroughLengthAndIndex(ean.length, index), + ) .reduce((acc, partialSum) => acc + partialSum, 0); const remainder = 10 - (checksum % 10); @@ -70,5 +74,7 @@ export default function isEAN(str) { assertString(str); const actualCheckDigit = Number(str.slice(-1)); - return validEanRegex.test(str) && actualCheckDigit === calculateCheckDigit(str); + return ( + validEanRegex.test(str) && actualCheckDigit === calculateCheckDigit(str) + ); } diff --git a/src/lib/isEmail.js b/src/lib/isEmail.js index cdc69f272..4aceb4f92 100644 --- a/src/lib/isEmail.js +++ b/src/lib/isEmail.js @@ -1,9 +1,9 @@ -import assertString from "./util/assertString.js"; +import assertString from './util/assertString.js'; -import isByteLength from "./isByteLength.js"; -import isFQDN from "./isFQDN.js"; -import isIP from "./isIP.js"; -import merge from "./util/merge.js"; +import isByteLength from './isByteLength.js'; +import isFQDN from './isFQDN.js'; +import isIP from './isIP.js'; +import merge from './util/merge.js'; const default_email_options = { allow_display_name: false, @@ -11,7 +11,7 @@ const default_email_options = { require_display_name: false, allow_utf8_local_part: true, require_tld: true, - blacklisted_chars: "", + blacklisted_chars: '', ignore_max_length: false, host_blacklist: [], host_whitelist: [], @@ -37,7 +37,7 @@ const defaultMaxEmailLength = 254; * @param {String} display_name */ function validateDisplayName(display_name) { - const display_name_without_quotes = display_name.replace(/^"(.+)"$/, "$1"); + const display_name_without_quotes = display_name.replace(/^"(.+)"$/, '$1'); // display name with only spaces is not valid if (!display_name_without_quotes.trim()) { return false; @@ -75,13 +75,13 @@ export default function isEmail(str, options) { // Remove display name and angle brackets to get email address // Can be done in the regex but will introduce a ReDOS (See #1597 for more info) - str = str.replace(display_name, "").replace(/(^<|>$)/g, ""); + str = str.replace(display_name, '').replace(/(^<|>$)/g, ''); // sometimes need to trim the last space to get the display name // because there may be a space between display name and email address // eg. myname // the display name is `myname` instead of `myname `, so need to trim the last space - if (display_name.endsWith(" ")) { + if (display_name.endsWith(' ')) { display_name = display_name.slice(0, -1); } @@ -96,7 +96,7 @@ export default function isEmail(str, options) { return false; } - const parts = str.split("@"); + const parts = str.split('@'); const domain = parts.pop(); const lower_domain = domain.toLowerCase(); @@ -111,11 +111,11 @@ export default function isEmail(str, options) { return false; } - let user = parts.join("@"); + let user = parts.join('@'); if ( options.domain_specific_validation && - (lower_domain === "gmail.com" || lower_domain === "googlemail.com") + (lower_domain === 'gmail.com' || lower_domain === 'googlemail.com') ) { /* Previously we removed dots for gmail addresses before validating. @@ -127,14 +127,14 @@ export default function isEmail(str, options) { user = user.toLowerCase(); // Removing sub-address from username before gmail validation - const username = user.split("+")[0]; + const username = user.split('+')[0]; // Dots are not included in gmail length restriction - if (!isByteLength(username.replace(/\./g, ""), { min: 6, max: 30 })) { + if (!isByteLength(username.replace(/\./g, ''), { min: 6, max: 30 })) { return false; } - const user_parts = username.split("."); + const user_parts = username.split('.'); for (let i = 0; i < user_parts.length; i++) { if (!gmailUserPart.test(user_parts[i])) { return false; @@ -161,7 +161,7 @@ export default function isEmail(str, options) { } if (!isIP(domain)) { - if (!domain.startsWith("[") || !domain.endsWith("]")) { + if (!domain.startsWith('[') || !domain.endsWith(']')) { return false; } @@ -184,14 +184,14 @@ export default function isEmail(str, options) { ? emailUserUtf8Part : emailUserPart; - const user_parts = user.split("."); + const user_parts = user.split('.'); for (let i = 0; i < user_parts.length; i++) { if (!pattern.test(user_parts[i])) { return false; } } if (options.blacklisted_chars) { - if (user.search(new RegExp(`[${options.blacklisted_chars}]+`, "g")) !== -1) + if (user.search(new RegExp(`[${options.blacklisted_chars}]+`, 'g')) !== -1) return false; } diff --git a/src/lib/isFQDN.js b/src/lib/isFQDN.js index d55d879cb..7bce4be12 100644 --- a/src/lib/isFQDN.js +++ b/src/lib/isFQDN.js @@ -33,7 +33,12 @@ export default function isFQDN(str, options) { return false; } - if (!options.allow_numeric_tld && !/^([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; } diff --git a/src/lib/isFloat.js b/src/lib/isFloat.js index 2aeb44e09..7466d3016 100644 --- a/src/lib/isFloat.js +++ b/src/lib/isFloat.js @@ -4,16 +4,22 @@ import { decimal } from './alpha.js'; export default function isFloat(str, options) { assertString(str); options = options || {}; - const float = new RegExp(`^(?:[-+])?(?:[0-9]+)?(?:\\${options.locale ? decimal[options.locale] : '.'}[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$`); + const float = new RegExp( + `^(?:[-+])?(?:[0-9]+)?(?:\\${ + options.locale ? decimal[options.locale] : '.' + }[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$`, + ); if (str === '' || str === '.' || str === ',' || str === '-' || str === '+') { return false; } const value = parseFloat(str.replace(',', '.')); - return float.test(str) - && (!options.hasOwnProperty('min') || value >= options.min) - && (!options.hasOwnProperty('max') || value <= options.max) - && (!options.hasOwnProperty('lt') || value < options.lt) - && (!options.hasOwnProperty('gt') || value > options.gt); + return ( + float.test(str) && + (!options.hasOwnProperty('min') || value >= options.min) && + (!options.hasOwnProperty('max') || value <= options.max) && + (!options.hasOwnProperty('lt') || value < options.lt) && + (!options.hasOwnProperty('gt') || value > options.gt) + ); } export const locales = Object.keys(decimal); diff --git a/src/lib/isFullWidth.js b/src/lib/isFullWidth.js index 9820a126c..2610889bb 100644 --- a/src/lib/isFullWidth.js +++ b/src/lib/isFullWidth.js @@ -1,6 +1,7 @@ import assertString from './util/assertString.js'; -export const fullWidth = /[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/; +export const fullWidth = + /[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/; export default function isFullWidth(str) { assertString(str); diff --git a/src/lib/isHSL.js b/src/lib/isHSL.js index 96bd7cfdc..99107059e 100644 --- a/src/lib/isHSL.js +++ b/src/lib/isHSL.js @@ -1,13 +1,17 @@ import assertString from './util/assertString.js'; -const hslComma = /^hsla?\(((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?))(deg|grad|rad|turn)?(,(\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%){2}(,((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%?))?\)$/i; -const hslSpace = /^hsla?\(((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?))(deg|grad|rad|turn)?(\s(\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%){2}\s?(\/\s((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%?)\s?)?\)$/i; +const hslComma = + /^hsla?\(((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?))(deg|grad|rad|turn)?(,(\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%){2}(,((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%?))?\)$/i; +const hslSpace = + /^hsla?\(((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?))(deg|grad|rad|turn)?(\s(\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%){2}\s?(\/\s((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%?)\s?)?\)$/i; export default function isHSL(str) { assertString(str); // Strip duplicate spaces before calling the validation regex (See #1598 for more info) - const strippedStr = str.replace(/\s+/g, ' ').replace(/\s?(hsla?\(|\)|,)\s?/ig, '$1'); + const strippedStr = str + .replace(/\s+/g, ' ') + .replace(/\s?(hsla?\(|\)|,)\s?/gi, '$1'); if (strippedStr.indexOf(',') !== -1) { return hslComma.test(strippedStr); diff --git a/src/lib/isHalfWidth.js b/src/lib/isHalfWidth.js index d02bd0c7c..55da08488 100644 --- a/src/lib/isHalfWidth.js +++ b/src/lib/isHalfWidth.js @@ -1,6 +1,7 @@ import assertString from './util/assertString.js'; -export const halfWidth = /[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/; +export const halfWidth = + /[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/; export default function isHalfWidth(str) { assertString(str); diff --git a/src/lib/isIBAN.js b/src/lib/isIBAN.js index edf799e6d..2d13b313b 100644 --- a/src/lib/isIBAN.js +++ b/src/lib/isIBAN.js @@ -1,4 +1,4 @@ -import assertString from "./util/assertString.js"; +import assertString from './util/assertString.js'; /** * List of country codes with @@ -97,7 +97,7 @@ const ibanRegexThroughCountryCode = { function hasOnlyValidCountryCodes(countryCodeArray) { const countryCodeArrayFilteredWithObjectIbanCode = countryCodeArray.filter( - (countryCode) => !(countryCode in ibanRegexThroughCountryCode) + (countryCode) => !(countryCode in ibanRegexThroughCountryCode), ); if (countryCodeArrayFilteredWithObjectIbanCode.length > 0) { @@ -121,7 +121,7 @@ function hasOnlyValidCountryCodes(countryCodeArray) { */ function hasValidIbanFormat(str, options) { // Strip white spaces and hyphens - const strippedStr = str.replace(/[\s\-]+/gi, "").toUpperCase(); + const strippedStr = str.replace(/[\s\-]+/gi, '').toUpperCase(); const isoCountryCode = strippedStr.slice(0, 2).toUpperCase(); const isoCountryCodeInIbanRegexCodeObject = @@ -169,16 +169,16 @@ function hasValidIbanFormat(str, options) { * @return {boolean} */ function hasValidIbanChecksum(str) { - const strippedStr = str.replace(/[^A-Z0-9]+/gi, "").toUpperCase(); // Keep only digits and A-Z latin alphabetic + const strippedStr = str.replace(/[^A-Z0-9]+/gi, '').toUpperCase(); // Keep only digits and A-Z latin alphabetic const rearranged = strippedStr.slice(4) + strippedStr.slice(0, 4); const alphaCapsReplacedWithDigits = rearranged.replace( /[A-Z]/g, - (char) => char.charCodeAt(0) - 55 + (char) => char.charCodeAt(0) - 55, ); const remainder = alphaCapsReplacedWithDigits .match(/\d{1,7}/g) - .reduce((acc, value) => Number(acc + value) % 97, ""); + .reduce((acc, value) => Number(acc + value) % 97, ''); return remainder === 1; } diff --git a/src/lib/isIMEI.js b/src/lib/isIMEI.js index c428bb93b..04385795a 100644 --- a/src/lib/isIMEI.js +++ b/src/lib/isIMEI.js @@ -39,7 +39,7 @@ export default function isIMEI(str, options) { mul -= 1; } } - const chk = ((10 - (sum % 10)) % 10); + const chk = (10 - (sum % 10)) % 10; if (chk !== parseInt(str.substring(14, 15), 10)) { return false; } diff --git a/src/lib/isIP.js b/src/lib/isIP.js index e1b96148a..f60f085da 100644 --- a/src/lib/isIP.js +++ b/src/lib/isIP.js @@ -28,21 +28,24 @@ import assertString from './util/assertString.js'; where the interface "ne0" belongs to the 1st link, "pvc1.3" belongs to the 5th link, and "interface10" belongs to the 10th organization. * * */ -const IPv4SegmentFormat = '(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'; +const IPv4SegmentFormat = + '(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'; const IPv4AddressFormat = `(${IPv4SegmentFormat}[.]){3}${IPv4SegmentFormat}`; const IPv4AddressRegExp = new RegExp(`^${IPv4AddressFormat}$`); const IPv6SegmentFormat = '(?:[0-9a-fA-F]{1,4})'; -const IPv6AddressRegExp = new RegExp('^(' - + `(?:${IPv6SegmentFormat}:){7}(?:${IPv6SegmentFormat}|:)|` - + `(?:${IPv6SegmentFormat}:){6}(?:${IPv4AddressFormat}|:${IPv6SegmentFormat}|:)|` - + `(?:${IPv6SegmentFormat}:){5}(?::${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,2}|:)|` - + `(?:${IPv6SegmentFormat}:){4}(?:(:${IPv6SegmentFormat}){0,1}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,3}|:)|` - + `(?:${IPv6SegmentFormat}:){3}(?:(:${IPv6SegmentFormat}){0,2}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,4}|:)|` - + `(?:${IPv6SegmentFormat}:){2}(?:(:${IPv6SegmentFormat}){0,3}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,5}|:)|` - + `(?:${IPv6SegmentFormat}:){1}(?:(:${IPv6SegmentFormat}){0,4}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,6}|:)|` - + `(?::((?::${IPv6SegmentFormat}){0,5}:${IPv4AddressFormat}|(?::${IPv6SegmentFormat}){1,7}|:))` - + ')(%[0-9a-zA-Z-.:]{1,})?$'); +const IPv6AddressRegExp = new RegExp( + '^(' + + `(?:${IPv6SegmentFormat}:){7}(?:${IPv6SegmentFormat}|:)|` + + `(?:${IPv6SegmentFormat}:){6}(?:${IPv4AddressFormat}|:${IPv6SegmentFormat}|:)|` + + `(?:${IPv6SegmentFormat}:){5}(?::${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,2}|:)|` + + `(?:${IPv6SegmentFormat}:){4}(?:(:${IPv6SegmentFormat}){0,1}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,3}|:)|` + + `(?:${IPv6SegmentFormat}:){3}(?:(:${IPv6SegmentFormat}){0,2}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,4}|:)|` + + `(?:${IPv6SegmentFormat}:){2}(?:(:${IPv6SegmentFormat}){0,3}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,5}|:)|` + + `(?:${IPv6SegmentFormat}:){1}(?:(:${IPv6SegmentFormat}){0,4}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,6}|:)|` + + `(?::((?::${IPv6SegmentFormat}){0,5}:${IPv4AddressFormat}|(?::${IPv6SegmentFormat}){1,7}|:))` + + ')(%[0-9a-zA-Z-.:]{1,})?$', +); export default function isIP(str, version = '') { assertString(str); diff --git a/src/lib/isISBN.js b/src/lib/isISBN.js index f226363f1..dac00d5fa 100644 --- a/src/lib/isISBN.js +++ b/src/lib/isISBN.js @@ -34,7 +34,7 @@ export default function isISBN(isbn, options) { checksum += 10 * sanitizedIsbn.charAt(9); } - if ((checksum % 11) === 0) { + if (checksum % 11 === 0) { return true; } } else if (version === '13') { diff --git a/src/lib/isISIN.js b/src/lib/isISIN.js index 2507b8fdd..b2fede37b 100644 --- a/src/lib/isISIN.js +++ b/src/lib/isISIN.js @@ -28,7 +28,7 @@ export default function isISIN(str) { for (const digit of [lo, hi]) { if (double) { if (digit >= 5) { - sum += 1 + ((digit - 5) * 2); + sum += 1 + (digit - 5) * 2; } else { sum += digit * 2; } @@ -41,7 +41,7 @@ export default function isISIN(str) { const digit = str[i].charCodeAt(0) - '0'.charCodeAt(0); if (double) { if (digit >= 5) { - sum += 1 + ((digit - 5) * 2); + sum += 1 + (digit - 5) * 2; } else { sum += digit * 2; } @@ -52,7 +52,7 @@ export default function isISIN(str) { } } - const check = (Math.trunc(((sum + 9) / 10)) * 10) - sum; + const check = Math.trunc((sum + 9) / 10) * 10 - sum; return +str[str.length - 1] === check; } diff --git a/src/lib/isISO31661Alpha2.js b/src/lib/isISO31661Alpha2.js index df25cda45..05f0d3adc 100644 --- a/src/lib/isISO31661Alpha2.js +++ b/src/lib/isISO31661Alpha2.js @@ -2,31 +2,255 @@ import assertString from './util/assertString.js'; // from https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 const validISO31661Alpha2CountriesCodes = new Set([ - 'AD', 'AE', 'AF', 'AG', 'AI', 'AL', 'AM', 'AO', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AW', 'AX', 'AZ', - 'BA', 'BB', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BL', 'BM', 'BN', 'BO', 'BQ', 'BR', 'BS', 'BT', 'BV', 'BW', 'BY', 'BZ', - 'CA', 'CC', 'CD', 'CF', 'CG', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN', 'CO', 'CR', 'CU', 'CV', 'CW', 'CX', 'CY', 'CZ', - 'DE', 'DJ', 'DK', 'DM', 'DO', 'DZ', - 'EC', 'EE', 'EG', 'EH', 'ER', 'ES', 'ET', - 'FI', 'FJ', 'FK', 'FM', 'FO', 'FR', - 'GA', 'GB', 'GD', 'GE', 'GF', 'GG', 'GH', 'GI', 'GL', 'GM', 'GN', 'GP', 'GQ', 'GR', 'GS', 'GT', 'GU', 'GW', 'GY', - 'HK', 'HM', 'HN', 'HR', 'HT', 'HU', - 'ID', 'IE', 'IL', 'IM', 'IN', 'IO', 'IQ', 'IR', 'IS', 'IT', - 'JE', 'JM', 'JO', 'JP', - 'KE', 'KG', 'KH', 'KI', 'KM', 'KN', 'KP', 'KR', 'KW', 'KY', 'KZ', - 'LA', 'LB', 'LC', 'LI', 'LK', 'LR', 'LS', 'LT', 'LU', 'LV', 'LY', - 'MA', 'MC', 'MD', 'ME', 'MF', 'MG', 'MH', 'MK', 'ML', 'MM', 'MN', 'MO', 'MP', 'MQ', 'MR', 'MS', 'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', - 'NA', 'NC', 'NE', 'NF', 'NG', 'NI', 'NL', 'NO', 'NP', 'NR', 'NU', 'NZ', + 'AD', + 'AE', + 'AF', + 'AG', + 'AI', + 'AL', + 'AM', + 'AO', + 'AQ', + 'AR', + 'AS', + 'AT', + 'AU', + 'AW', + 'AX', + 'AZ', + 'BA', + 'BB', + 'BD', + 'BE', + 'BF', + 'BG', + 'BH', + 'BI', + 'BJ', + 'BL', + 'BM', + 'BN', + 'BO', + 'BQ', + 'BR', + 'BS', + 'BT', + 'BV', + 'BW', + 'BY', + 'BZ', + 'CA', + 'CC', + 'CD', + 'CF', + 'CG', + 'CH', + 'CI', + 'CK', + 'CL', + 'CM', + 'CN', + 'CO', + 'CR', + 'CU', + 'CV', + 'CW', + 'CX', + 'CY', + 'CZ', + 'DE', + 'DJ', + 'DK', + 'DM', + 'DO', + 'DZ', + 'EC', + 'EE', + 'EG', + 'EH', + 'ER', + 'ES', + 'ET', + 'FI', + 'FJ', + 'FK', + 'FM', + 'FO', + 'FR', + 'GA', + 'GB', + 'GD', + 'GE', + 'GF', + 'GG', + 'GH', + 'GI', + 'GL', + 'GM', + 'GN', + 'GP', + 'GQ', + 'GR', + 'GS', + 'GT', + 'GU', + 'GW', + 'GY', + 'HK', + 'HM', + 'HN', + 'HR', + 'HT', + 'HU', + 'ID', + 'IE', + 'IL', + 'IM', + 'IN', + 'IO', + 'IQ', + 'IR', + 'IS', + 'IT', + 'JE', + 'JM', + 'JO', + 'JP', + 'KE', + 'KG', + 'KH', + 'KI', + 'KM', + 'KN', + 'KP', + 'KR', + 'KW', + 'KY', + 'KZ', + 'LA', + 'LB', + 'LC', + 'LI', + 'LK', + 'LR', + 'LS', + 'LT', + 'LU', + 'LV', + 'LY', + 'MA', + 'MC', + 'MD', + 'ME', + 'MF', + 'MG', + 'MH', + 'MK', + 'ML', + 'MM', + 'MN', + 'MO', + 'MP', + 'MQ', + 'MR', + 'MS', + 'MT', + 'MU', + 'MV', + 'MW', + 'MX', + 'MY', + 'MZ', + 'NA', + 'NC', + 'NE', + 'NF', + 'NG', + 'NI', + 'NL', + 'NO', + 'NP', + 'NR', + 'NU', + 'NZ', 'OM', - 'PA', 'PE', 'PF', 'PG', 'PH', 'PK', 'PL', 'PM', 'PN', 'PR', 'PS', 'PT', 'PW', 'PY', + 'PA', + 'PE', + 'PF', + 'PG', + 'PH', + 'PK', + 'PL', + 'PM', + 'PN', + 'PR', + 'PS', + 'PT', + 'PW', + 'PY', 'QA', - 'RE', 'RO', 'RS', 'RU', 'RW', - 'SA', 'SB', 'SC', 'SD', 'SE', 'SG', 'SH', 'SI', 'SJ', 'SK', 'SL', 'SM', 'SN', 'SO', 'SR', 'SS', 'ST', 'SV', 'SX', 'SY', 'SZ', - 'TC', 'TD', 'TF', 'TG', 'TH', 'TJ', 'TK', 'TL', 'TM', 'TN', 'TO', 'TR', 'TT', 'TV', 'TW', 'TZ', - 'UA', 'UG', 'UM', 'US', 'UY', 'UZ', - 'VA', 'VC', 'VE', 'VG', 'VI', 'VN', 'VU', - 'WF', 'WS', - 'YE', 'YT', - 'ZA', 'ZM', 'ZW', + 'RE', + 'RO', + 'RS', + 'RU', + 'RW', + 'SA', + 'SB', + 'SC', + 'SD', + 'SE', + 'SG', + 'SH', + 'SI', + 'SJ', + 'SK', + 'SL', + 'SM', + 'SN', + 'SO', + 'SR', + 'SS', + 'ST', + 'SV', + 'SX', + 'SY', + 'SZ', + 'TC', + 'TD', + 'TF', + 'TG', + 'TH', + 'TJ', + 'TK', + 'TL', + 'TM', + 'TN', + 'TO', + 'TR', + 'TT', + 'TV', + 'TW', + 'TZ', + 'UA', + 'UG', + 'UM', + 'US', + 'UY', + 'UZ', + 'VA', + 'VC', + 'VE', + 'VG', + 'VI', + 'VN', + 'VU', + 'WF', + 'WS', + 'YE', + 'YT', + 'ZA', + 'ZM', + 'ZW', ]); export default function isISO31661Alpha2(str) { diff --git a/src/lib/isISO31661Alpha3.js b/src/lib/isISO31661Alpha3.js index ad27151d4..36bc8d282 100644 --- a/src/lib/isISO31661Alpha3.js +++ b/src/lib/isISO31661Alpha3.js @@ -2,22 +2,255 @@ import assertString from './util/assertString.js'; // from https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3 const validISO31661Alpha3CountriesCodes = new Set([ - 'AFG', 'ALA', 'ALB', 'DZA', 'ASM', 'AND', 'AGO', 'AIA', 'ATA', 'ATG', 'ARG', 'ARM', 'ABW', 'AUS', 'AUT', 'AZE', - 'BHS', 'BHR', 'BGD', 'BRB', 'BLR', 'BEL', 'BLZ', 'BEN', 'BMU', 'BTN', 'BOL', 'BES', 'BIH', 'BWA', 'BVT', 'BRA', - 'IOT', 'BRN', 'BGR', 'BFA', 'BDI', 'KHM', 'CMR', 'CAN', 'CPV', 'CYM', 'CAF', 'TCD', 'CHL', 'CHN', 'CXR', 'CCK', - 'COL', 'COM', 'COG', 'COD', 'COK', 'CRI', 'CIV', 'HRV', 'CUB', 'CUW', 'CYP', 'CZE', 'DNK', 'DJI', 'DMA', 'DOM', - 'ECU', 'EGY', 'SLV', 'GNQ', 'ERI', 'EST', 'ETH', 'FLK', 'FRO', 'FJI', 'FIN', 'FRA', 'GUF', 'PYF', 'ATF', 'GAB', - 'GMB', 'GEO', 'DEU', 'GHA', 'GIB', 'GRC', 'GRL', 'GRD', 'GLP', 'GUM', 'GTM', 'GGY', 'GIN', 'GNB', 'GUY', 'HTI', - 'HMD', 'VAT', 'HND', 'HKG', 'HUN', 'ISL', 'IND', 'IDN', 'IRN', 'IRQ', 'IRL', 'IMN', 'ISR', 'ITA', 'JAM', 'JPN', - 'JEY', 'JOR', 'KAZ', 'KEN', 'KIR', 'PRK', 'KOR', 'KWT', 'KGZ', 'LAO', 'LVA', 'LBN', 'LSO', 'LBR', 'LBY', 'LIE', - 'LTU', 'LUX', 'MAC', 'MKD', 'MDG', 'MWI', 'MYS', 'MDV', 'MLI', 'MLT', 'MHL', 'MTQ', 'MRT', 'MUS', 'MYT', 'MEX', - 'FSM', 'MDA', 'MCO', 'MNG', 'MNE', 'MSR', 'MAR', 'MOZ', 'MMR', 'NAM', 'NRU', 'NPL', 'NLD', 'NCL', 'NZL', 'NIC', - 'NER', 'NGA', 'NIU', 'NFK', 'MNP', 'NOR', 'OMN', 'PAK', 'PLW', 'PSE', 'PAN', 'PNG', 'PRY', 'PER', 'PHL', 'PCN', - 'POL', 'PRT', 'PRI', 'QAT', 'REU', 'ROU', 'RUS', 'RWA', 'BLM', 'SHN', 'KNA', 'LCA', 'MAF', 'SPM', 'VCT', 'WSM', - 'SMR', 'STP', 'SAU', 'SEN', 'SRB', 'SYC', 'SLE', 'SGP', 'SXM', 'SVK', 'SVN', 'SLB', 'SOM', 'ZAF', 'SGS', 'SSD', - 'ESP', 'LKA', 'SDN', 'SUR', 'SJM', 'SWZ', 'SWE', 'CHE', 'SYR', 'TWN', 'TJK', 'TZA', 'THA', 'TLS', 'TGO', 'TKL', - 'TON', 'TTO', 'TUN', 'TUR', 'TKM', 'TCA', 'TUV', 'UGA', 'UKR', 'ARE', 'GBR', 'USA', 'UMI', 'URY', 'UZB', 'VUT', - 'VEN', 'VNM', 'VGB', 'VIR', 'WLF', 'ESH', 'YEM', 'ZMB', 'ZWE', + 'AFG', + 'ALA', + 'ALB', + 'DZA', + 'ASM', + 'AND', + 'AGO', + 'AIA', + 'ATA', + 'ATG', + 'ARG', + 'ARM', + 'ABW', + 'AUS', + 'AUT', + 'AZE', + 'BHS', + 'BHR', + 'BGD', + 'BRB', + 'BLR', + 'BEL', + 'BLZ', + 'BEN', + 'BMU', + 'BTN', + 'BOL', + 'BES', + 'BIH', + 'BWA', + 'BVT', + 'BRA', + 'IOT', + 'BRN', + 'BGR', + 'BFA', + 'BDI', + 'KHM', + 'CMR', + 'CAN', + 'CPV', + 'CYM', + 'CAF', + 'TCD', + 'CHL', + 'CHN', + 'CXR', + 'CCK', + 'COL', + 'COM', + 'COG', + 'COD', + 'COK', + 'CRI', + 'CIV', + 'HRV', + 'CUB', + 'CUW', + 'CYP', + 'CZE', + 'DNK', + 'DJI', + 'DMA', + 'DOM', + 'ECU', + 'EGY', + 'SLV', + 'GNQ', + 'ERI', + 'EST', + 'ETH', + 'FLK', + 'FRO', + 'FJI', + 'FIN', + 'FRA', + 'GUF', + 'PYF', + 'ATF', + 'GAB', + 'GMB', + 'GEO', + 'DEU', + 'GHA', + 'GIB', + 'GRC', + 'GRL', + 'GRD', + 'GLP', + 'GUM', + 'GTM', + 'GGY', + 'GIN', + 'GNB', + 'GUY', + 'HTI', + 'HMD', + 'VAT', + 'HND', + 'HKG', + 'HUN', + 'ISL', + 'IND', + 'IDN', + 'IRN', + 'IRQ', + 'IRL', + 'IMN', + 'ISR', + 'ITA', + 'JAM', + 'JPN', + 'JEY', + 'JOR', + 'KAZ', + 'KEN', + 'KIR', + 'PRK', + 'KOR', + 'KWT', + 'KGZ', + 'LAO', + 'LVA', + 'LBN', + 'LSO', + 'LBR', + 'LBY', + 'LIE', + 'LTU', + 'LUX', + 'MAC', + 'MKD', + 'MDG', + 'MWI', + 'MYS', + 'MDV', + 'MLI', + 'MLT', + 'MHL', + 'MTQ', + 'MRT', + 'MUS', + 'MYT', + 'MEX', + 'FSM', + 'MDA', + 'MCO', + 'MNG', + 'MNE', + 'MSR', + 'MAR', + 'MOZ', + 'MMR', + 'NAM', + 'NRU', + 'NPL', + 'NLD', + 'NCL', + 'NZL', + 'NIC', + 'NER', + 'NGA', + 'NIU', + 'NFK', + 'MNP', + 'NOR', + 'OMN', + 'PAK', + 'PLW', + 'PSE', + 'PAN', + 'PNG', + 'PRY', + 'PER', + 'PHL', + 'PCN', + 'POL', + 'PRT', + 'PRI', + 'QAT', + 'REU', + 'ROU', + 'RUS', + 'RWA', + 'BLM', + 'SHN', + 'KNA', + 'LCA', + 'MAF', + 'SPM', + 'VCT', + 'WSM', + 'SMR', + 'STP', + 'SAU', + 'SEN', + 'SRB', + 'SYC', + 'SLE', + 'SGP', + 'SXM', + 'SVK', + 'SVN', + 'SLB', + 'SOM', + 'ZAF', + 'SGS', + 'SSD', + 'ESP', + 'LKA', + 'SDN', + 'SUR', + 'SJM', + 'SWZ', + 'SWE', + 'CHE', + 'SYR', + 'TWN', + 'TJK', + 'TZA', + 'THA', + 'TLS', + 'TGO', + 'TKL', + 'TON', + 'TTO', + 'TUN', + 'TUR', + 'TKM', + 'TCA', + 'TUV', + 'UGA', + 'UKR', + 'ARE', + 'GBR', + 'USA', + 'UMI', + 'URY', + 'UZB', + 'VUT', + 'VEN', + 'VNM', + 'VGB', + 'VIR', + 'WLF', + 'ESH', + 'YEM', + 'ZMB', + 'ZWE', ]); export default function isISO31661Alpha3(str) { diff --git a/src/lib/isISO4217.js b/src/lib/isISO4217.js index 4b0b546a1..3bc581dfe 100644 --- a/src/lib/isISO4217.js +++ b/src/lib/isISO4217.js @@ -2,32 +2,185 @@ import assertString from './util/assertString.js'; // from https://en.wikipedia.org/wiki/ISO_4217 const validISO4217CurrencyCodes = new Set([ - 'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AWG', 'AZN', - 'BAM', 'BBD', 'BDT', 'BGN', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BOV', 'BRL', 'BSD', 'BTN', 'BWP', 'BYN', 'BZD', - 'CAD', 'CDF', 'CHE', 'CHF', 'CHW', 'CLF', 'CLP', 'CNY', 'COP', 'COU', 'CRC', 'CUC', 'CUP', 'CVE', 'CZK', - 'DJF', 'DKK', 'DOP', 'DZD', - 'EGP', 'ERN', 'ETB', 'EUR', - 'FJD', 'FKP', - 'GBP', 'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GTQ', 'GYD', - 'HKD', 'HNL', 'HRK', 'HTG', 'HUF', - 'IDR', 'ILS', 'INR', 'IQD', 'IRR', 'ISK', - 'JMD', 'JOD', 'JPY', - 'KES', 'KGS', 'KHR', 'KMF', 'KPW', 'KRW', 'KWD', 'KYD', 'KZT', - 'LAK', 'LBP', 'LKR', 'LRD', 'LSL', 'LYD', - 'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP', 'MRU', 'MUR', 'MVR', 'MWK', 'MXN', 'MXV', 'MYR', 'MZN', - 'NAD', 'NGN', 'NIO', 'NOK', 'NPR', 'NZD', + 'AED', + 'AFN', + 'ALL', + 'AMD', + 'ANG', + 'AOA', + 'ARS', + 'AUD', + 'AWG', + 'AZN', + 'BAM', + 'BBD', + 'BDT', + 'BGN', + 'BHD', + 'BIF', + 'BMD', + 'BND', + 'BOB', + 'BOV', + 'BRL', + 'BSD', + 'BTN', + 'BWP', + 'BYN', + 'BZD', + 'CAD', + 'CDF', + 'CHE', + 'CHF', + 'CHW', + 'CLF', + 'CLP', + 'CNY', + 'COP', + 'COU', + 'CRC', + 'CUC', + 'CUP', + 'CVE', + 'CZK', + 'DJF', + 'DKK', + 'DOP', + 'DZD', + 'EGP', + 'ERN', + 'ETB', + 'EUR', + 'FJD', + 'FKP', + 'GBP', + 'GEL', + 'GHS', + 'GIP', + 'GMD', + 'GNF', + 'GTQ', + 'GYD', + 'HKD', + 'HNL', + 'HRK', + 'HTG', + 'HUF', + 'IDR', + 'ILS', + 'INR', + 'IQD', + 'IRR', + 'ISK', + 'JMD', + 'JOD', + 'JPY', + 'KES', + 'KGS', + 'KHR', + 'KMF', + 'KPW', + 'KRW', + 'KWD', + 'KYD', + 'KZT', + 'LAK', + 'LBP', + 'LKR', + 'LRD', + 'LSL', + 'LYD', + 'MAD', + 'MDL', + 'MGA', + 'MKD', + 'MMK', + 'MNT', + 'MOP', + 'MRU', + 'MUR', + 'MVR', + 'MWK', + 'MXN', + 'MXV', + 'MYR', + 'MZN', + 'NAD', + 'NGN', + 'NIO', + 'NOK', + 'NPR', + 'NZD', 'OMR', - 'PAB', 'PEN', 'PGK', 'PHP', 'PKR', 'PLN', 'PYG', + 'PAB', + 'PEN', + 'PGK', + 'PHP', + 'PKR', + 'PLN', + 'PYG', 'QAR', - 'RON', 'RSD', 'RUB', 'RWF', - 'SAR', 'SBD', 'SCR', 'SDG', 'SEK', 'SGD', 'SHP', 'SLL', 'SOS', 'SRD', 'SSP', 'STN', 'SVC', 'SYP', 'SZL', - 'THB', 'TJS', 'TMT', 'TND', 'TOP', 'TRY', 'TTD', 'TWD', 'TZS', - 'UAH', 'UGX', 'USD', 'USN', 'UYI', 'UYU', 'UYW', 'UZS', - 'VES', 'VND', 'VUV', + 'RON', + 'RSD', + 'RUB', + 'RWF', + 'SAR', + 'SBD', + 'SCR', + 'SDG', + 'SEK', + 'SGD', + 'SHP', + 'SLL', + 'SOS', + 'SRD', + 'SSP', + 'STN', + 'SVC', + 'SYP', + 'SZL', + 'THB', + 'TJS', + 'TMT', + 'TND', + 'TOP', + 'TRY', + 'TTD', + 'TWD', + 'TZS', + 'UAH', + 'UGX', + 'USD', + 'USN', + 'UYI', + 'UYU', + 'UYW', + 'UZS', + 'VES', + 'VND', + 'VUV', 'WST', - 'XAF', 'XAG', 'XAU', 'XBA', 'XBB', 'XBC', 'XBD', 'XCD', 'XDR', 'XOF', 'XPD', 'XPF', 'XPT', 'XSU', 'XTS', 'XUA', 'XXX', + 'XAF', + 'XAG', + 'XAU', + 'XBA', + 'XBB', + 'XBC', + 'XBD', + 'XCD', + 'XDR', + 'XOF', + 'XPD', + 'XPF', + 'XPT', + 'XSU', + 'XTS', + 'XUA', + 'XXX', 'YER', - 'ZAR', 'ZMW', 'ZWL', + 'ZAR', + 'ZMW', + 'ZWL', ]); export default function isISO4217(str) { diff --git a/src/lib/isISO6346.js b/src/lib/isISO6346.js index e9e9e9730..9779a288c 100644 --- a/src/lib/isISO6346.js +++ b/src/lib/isISO6346.js @@ -20,11 +20,13 @@ export function isISO6346(str) { let convertedCode; const letterCode = str.charCodeAt(i) - 55; if (letterCode < 11) convertedCode = letterCode; - else if (letterCode >= 11 && letterCode <= 20) convertedCode = 12 + (letterCode % 11); - else if (letterCode >= 21 && letterCode <= 30) convertedCode = 23 + (letterCode % 21); + else if (letterCode >= 11 && letterCode <= 20) + convertedCode = 12 + (letterCode % 11); + else if (letterCode >= 21 && letterCode <= 30) + convertedCode = 23 + (letterCode % 21); else convertedCode = 34 + (letterCode % 31); - sum += convertedCode * (2 ** i); - } else sum += str[i] * (2 ** i); + sum += convertedCode * 2 ** i; + } else sum += str[i] * 2 ** i; } const checkSumDigit = sum % 11; diff --git a/src/lib/isISO6391.js b/src/lib/isISO6391.js index eab0ffb13..29bfe782e 100644 --- a/src/lib/isISO6391.js +++ b/src/lib/isISO6391.js @@ -1,32 +1,191 @@ import assertString from './util/assertString.js'; const isISO6391Set = new Set([ - 'aa', 'ab', 'ae', 'af', 'ak', 'am', 'an', 'ar', 'as', 'av', 'ay', 'az', 'az', - 'ba', 'be', 'bg', 'bh', 'bi', 'bm', 'bn', 'bo', 'br', 'bs', - 'ca', 'ce', 'ch', 'co', 'cr', 'cs', 'cu', 'cv', 'cy', - 'da', 'de', 'dv', 'dz', - 'ee', 'el', 'en', 'eo', 'es', 'et', 'eu', - 'fa', 'ff', 'fi', 'fj', 'fo', 'fr', 'fy', - 'ga', 'gd', 'gl', 'gn', 'gu', 'gv', - 'ha', 'he', 'hi', 'ho', 'hr', 'ht', 'hu', 'hy', 'hz', - 'ia', 'id', 'ie', 'ig', 'ii', 'ik', 'io', 'is', 'it', 'iu', - 'ja', 'jv', - 'ka', 'kg', 'ki', 'kj', 'kk', 'kl', 'km', 'kn', 'ko', 'kr', 'ks', 'ku', 'kv', 'kw', 'ky', - 'la', 'lb', 'lg', 'li', 'ln', 'lo', 'lt', 'lu', 'lv', - 'mg', 'mh', 'mi', 'mk', 'ml', 'mn', 'mr', 'ms', 'mt', 'my', - 'na', 'nb', 'nd', 'ne', 'ng', 'nl', 'nn', 'no', 'nr', 'nv', 'ny', - 'oc', 'oj', 'om', 'or', 'os', - 'pa', 'pi', 'pl', 'ps', 'pt', + 'aa', + 'ab', + 'ae', + 'af', + 'ak', + 'am', + 'an', + 'ar', + 'as', + 'av', + 'ay', + 'az', + 'az', + 'ba', + 'be', + 'bg', + 'bh', + 'bi', + 'bm', + 'bn', + 'bo', + 'br', + 'bs', + 'ca', + 'ce', + 'ch', + 'co', + 'cr', + 'cs', + 'cu', + 'cv', + 'cy', + 'da', + 'de', + 'dv', + 'dz', + 'ee', + 'el', + 'en', + 'eo', + 'es', + 'et', + 'eu', + 'fa', + 'ff', + 'fi', + 'fj', + 'fo', + 'fr', + 'fy', + 'ga', + 'gd', + 'gl', + 'gn', + 'gu', + 'gv', + 'ha', + 'he', + 'hi', + 'ho', + 'hr', + 'ht', + 'hu', + 'hy', + 'hz', + 'ia', + 'id', + 'ie', + 'ig', + 'ii', + 'ik', + 'io', + 'is', + 'it', + 'iu', + 'ja', + 'jv', + 'ka', + 'kg', + 'ki', + 'kj', + 'kk', + 'kl', + 'km', + 'kn', + 'ko', + 'kr', + 'ks', + 'ku', + 'kv', + 'kw', + 'ky', + 'la', + 'lb', + 'lg', + 'li', + 'ln', + 'lo', + 'lt', + 'lu', + 'lv', + 'mg', + 'mh', + 'mi', + 'mk', + 'ml', + 'mn', + 'mr', + 'ms', + 'mt', + 'my', + 'na', + 'nb', + 'nd', + 'ne', + 'ng', + 'nl', + 'nn', + 'no', + 'nr', + 'nv', + 'ny', + 'oc', + 'oj', + 'om', + 'or', + 'os', + 'pa', + 'pi', + 'pl', + 'ps', + 'pt', 'qu', - 'rm', 'rn', 'ro', 'ru', 'rw', - 'sa', 'sc', 'sd', 'se', 'sg', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sq', 'sr', 'ss', 'st', 'su', 'sv', 'sw', - 'ta', 'te', 'tg', 'th', 'ti', 'tk', 'tl', 'tn', 'to', 'tr', 'ts', 'tt', 'tw', 'ty', - 'ug', 'uk', 'ur', 'uz', - 've', 'vi', 'vo', - 'wa', 'wo', + 'rm', + 'rn', + 'ro', + 'ru', + 'rw', + 'sa', + 'sc', + 'sd', + 'se', + 'sg', + 'si', + 'sk', + 'sl', + 'sm', + 'sn', + 'so', + 'sq', + 'sr', + 'ss', + 'st', + 'su', + 'sv', + 'sw', + 'ta', + 'te', + 'tg', + 'th', + 'ti', + 'tk', + 'tl', + 'tn', + 'to', + 'tr', + 'ts', + 'tt', + 'tw', + 'ty', + 'ug', + 'uk', + 'ur', + 'uz', + 've', + 'vi', + 'vo', + 'wa', + 'wo', 'xh', - 'yi', 'yo', - 'za', 'zh', 'zu', + 'yi', + 'yo', + 'za', + 'zh', + 'zu', ]); export default function isISO6391(str) { diff --git a/src/lib/isISO8601.js b/src/lib/isISO8601.js index 4955d99df..5d1d3d79e 100644 --- a/src/lib/isISO8601.js +++ b/src/lib/isISO8601.js @@ -2,9 +2,11 @@ import assertString from './util/assertString.js'; /* eslint-disable max-len */ // from http://goo.gl/0ejHHW -const iso8601 = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/; +const iso8601 = + /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/; // same as above, except with a strict 'T' separator between date and time -const iso8601StrictSeparator = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/; +const iso8601StrictSeparator = + /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/; /* eslint-enable max-len */ const isValidDate = (str) => { // str must have passed the ISO8601 check @@ -16,7 +18,8 @@ const isValidDate = (str) => { const oYear = Number(ordinalMatch[1]); const oDay = Number(ordinalMatch[2]); // if is leap year - if ((oYear % 4 === 0 && oYear % 100 !== 0) || oYear % 400 === 0) return oDay <= 366; + if ((oYear % 4 === 0 && oYear % 100 !== 0) || oYear % 400 === 0) + return oDay <= 366; return oDay <= 365; } const match = str.match(/(\d{4})-?(\d{0,2})-?(\d*)/).map(Number); @@ -29,16 +32,20 @@ const isValidDate = (str) => { // create a date object and compare const d = new Date(`${year}-${monthString || '01'}-${dayString || '01'}`); if (month && day) { - return d.getUTCFullYear() === year - && (d.getUTCMonth() + 1) === month - && d.getUTCDate() === day; + return ( + d.getUTCFullYear() === year && + d.getUTCMonth() + 1 === month && + d.getUTCDate() === day + ); } return true; }; export default function isISO8601(str, options = {}) { assertString(str); - const check = options.strictSeparator ? iso8601StrictSeparator.test(str) : iso8601.test(str); + const check = options.strictSeparator + ? iso8601StrictSeparator.test(str) + : iso8601.test(str); if (check && options.strict) return isValidDate(str); return check; } diff --git a/src/lib/isISSN.js b/src/lib/isISSN.js index 436bbb471..6557a1b99 100644 --- a/src/lib/isISSN.js +++ b/src/lib/isISSN.js @@ -6,7 +6,9 @@ export default function isISSN(str, options = {}) { assertString(str); let testIssn = issn; testIssn = options.require_hyphen ? testIssn.replace('?', '') : testIssn; - testIssn = options.case_sensitive ? new RegExp(testIssn) : new RegExp(testIssn, 'i'); + testIssn = options.case_sensitive + ? new RegExp(testIssn) + : new RegExp(testIssn, 'i'); if (!testIssn.test(str)) { return false; } diff --git a/src/lib/isIdentityCard.js b/src/lib/isIdentityCard.js index 94a580492..e0c48a910 100644 --- a/src/lib/isIdentityCard.js +++ b/src/lib/isIdentityCard.js @@ -20,9 +20,16 @@ const validators = { 11: 0, }; - if (str != null && str.length === 11 && isInt(str, { allow_leading_zeroes: true })) { + if ( + str != null && + str.length === 11 && + isInt(str, { allow_leading_zeroes: true }) + ) { const digits = str.split('').slice(0, -1); - const sum = digits.reduce((acc, digit, index) => acc + (Number(digit) * weightOfDigits[index + 1]), 0); + const sum = digits.reduce( + (acc, digit, index) => acc + Number(digit) * weightOfDigits[index + 1], + 0, + ); const modulo = sum % 10; const lastDigit = Number(str.charAt(str.length - 1)); @@ -46,8 +53,29 @@ const validators = { }; const controlDigits = [ - 'T', 'R', 'W', 'A', 'G', 'M', 'Y', 'F', 'P', 'D', 'X', 'B', - 'N', 'J', 'Z', 'S', 'Q', 'V', 'H', 'L', 'C', 'K', 'E', + 'T', + 'R', + 'W', + 'A', + 'G', + 'M', + 'Y', + 'F', + 'P', + 'D', + 'X', + 'B', + 'N', + 'J', + 'Z', + 'S', + 'Q', + 'V', + 'H', + 'L', + 'C', + 'K', + 'E', ]; // sanitize user input @@ -59,7 +87,9 @@ const validators = { } // validate the control digit - const number = sanitized.slice(0, -1).replace(/[X,Y,Z]/g, (char) => charsValue[char]); + const number = sanitized + .slice(0, -1) + .replace(/[X,Y,Z]/g, (char) => charsValue[char]); return sanitized.endsWith(controlDigits[number % 23]); }, @@ -77,7 +107,8 @@ const validators = { const checkDigits = '0123456789ABCDEFHJKLMNPRSTUVWXY'; - const idAsNumber = (parseInt(str.slice(0, 6), 10) * 1000) + parseInt(str.slice(7, 10), 10); + const idAsNumber = + parseInt(str.slice(0, 6), 10) * 1000 + parseInt(str.slice(7, 10), 10); const remainder = idAsNumber % 31; const checkDigit = checkDigits[remainder]; @@ -120,17 +151,21 @@ const validators = { return false; } let c = 0; - let invertedArray = sanitized.replace(/\s/g, '').split('').map(Number).reverse(); + let invertedArray = sanitized + .replace(/\s/g, '') + .split('') + .map(Number) + .reverse(); invertedArray.forEach((val, i) => { - c = d[c][p[(i % 8)][val]]; + c = d[c][p[i % 8][val]]; }); return c === 0; }, IR: (str) => { if (!str.match(/^\d{10}$/)) return false; - str = (`0000${str}`).slice(str.length - 6); + str = `0000${str}`.slice(str.length - 6); if (parseInt(str.slice(3, 9), 10) === 0) return false; @@ -160,12 +195,33 @@ const validators = { // https://no.wikipedia.org/wiki/F%C3%B8dselsnummer const f = sanitized.split('').map(Number); - let k1 = (11 - (((3 * f[0]) + (7 * f[1]) + (6 * f[2]) - + (1 * f[3]) + (8 * f[4]) + (9 * f[5]) + (4 * f[6]) - + (5 * f[7]) + (2 * f[8])) % 11)) % 11; - let k2 = (11 - (((5 * f[0]) + (4 * f[1]) + (3 * f[2]) - + (2 * f[3]) + (7 * f[4]) + (6 * f[5]) + (5 * f[6]) - + (4 * f[7]) + (3 * f[8]) + (2 * k1)) % 11)) % 11; + let k1 = + (11 - + ((3 * f[0] + + 7 * f[1] + + 6 * f[2] + + 1 * f[3] + + 8 * f[4] + + 9 * f[5] + + 4 * f[6] + + 5 * f[7] + + 2 * f[8]) % + 11)) % + 11; + let k2 = + (11 - + ((5 * f[0] + + 4 * f[1] + + 3 * f[2] + + 2 * f[3] + + 7 * f[4] + + 6 * f[5] + + 5 * f[6] + + 4 * f[7] + + 3 * f[8] + + 2 * k1) % + 11)) % + 11; if (k1 !== f[9] || k2 !== f[10]) return false; return true; @@ -273,11 +329,30 @@ const validators = { '91', // 国外 ]; - const powers = ['7', '9', '10', '5', '8', '4', '2', '1', '6', '3', '7', '9', '10', '5', '8', '4', '2']; + const powers = [ + '7', + '9', + '10', + '5', + '8', + '4', + '2', + '1', + '6', + '3', + '7', + '9', + '10', + '5', + '8', + '4', + '2', + ]; const parityBit = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2']; - const checkAddressCode = (addressCode) => provincesAndCities.includes(addressCode); + const checkAddressCode = (addressCode) => + provincesAndCities.includes(addressCode); const checkBirthDayCode = (birDayCode) => { const yyyy = parseInt(birDayCode.substring(0, 4), 10); @@ -287,7 +362,12 @@ const validators = { if (xdata > new Date()) { return false; // eslint-disable-next-line max-len - } if ((xdata.getFullYear() === yyyy) && (xdata.getMonth() === mm - 1) && (xdata.getDate() === dd)) { + } + if ( + xdata.getFullYear() === yyyy && + xdata.getMonth() === mm - 1 && + xdata.getDate() === dd + ) { return true; } return false; @@ -305,10 +385,14 @@ const validators = { return parityBit[mod]; }; - const checkParityBit = (idCardNo) => getParityBit(idCardNo) === idCardNo.charAt(17).toUpperCase(); + const checkParityBit = (idCardNo) => + getParityBit(idCardNo) === idCardNo.charAt(17).toUpperCase(); const check15IdCardNo = (idCardNo) => { - let check = /^[1-9]\d{7}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}$/.test(idCardNo); + let check = + /^[1-9]\d{7}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}$/.test( + idCardNo, + ); if (!check) return false; let addressCode = idCardNo.substring(0, 2); check = checkAddressCode(addressCode); @@ -320,7 +404,10 @@ const validators = { }; const check18IdCardNo = (idCardNo) => { - let check = /^[1-9]\d{5}[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}(\d|x|X)$/.test(idCardNo); + let check = + /^[1-9]\d{5}[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}(\d|x|X)$/.test( + idCardNo, + ); if (!check) return false; let addressCode = idCardNo.substring(0, 2); check = checkAddressCode(addressCode); @@ -347,7 +434,8 @@ const validators = { // HKID number starts with 1 or 2 letters, followed by 6 digits, // then a checksum contained in square / round brackets or nothing - const regexHKID = /^[A-Z]{1,2}[0-9]{6}((\([0-9A]\))|(\[[0-9A]\])|([0-9A]))$/; + const regexHKID = + /^[A-Z]{1,2}[0-9]{6}((\([0-9A]\))|(\[[0-9A]\])|([0-9A]))$/; const regexIsDigit = /^[0-9]$/; // convert the user input to all uppercase and apply regex @@ -359,9 +447,10 @@ const validators = { let checkSumVal = 0; for (let i = 0; i <= 7; i++) { let convertedChar; - if (!regexIsDigit.test(str[i])) convertedChar = (str[i].charCodeAt(0) - 55) % 11; + if (!regexIsDigit.test(str[i])) + convertedChar = (str[i].charCodeAt(0) - 55) % 11; else convertedChar = str[i]; - checkSumVal += (convertedChar * (9 - i)); + checkSumVal += convertedChar * (9 - i); } checkSumVal %= 11; @@ -410,14 +499,14 @@ const validators = { if (index === 0) { const code = ALPHABET_CODES[number]; - return ((code % 10) * 9) + Math.floor(code / 10); + return (code % 10) * 9 + Math.floor(code / 10); } if (index === 9) { - return ((10 - (sum % 10)) - Number(number)) % 10 === 0; + return (10 - (sum % 10) - Number(number)) % 10 === 0; } - return sum + (Number(number) * (9 - index)); + return sum + Number(number) * (9 - index); }, 0); }, }; @@ -426,7 +515,8 @@ export default function isIdentityCard(str, locale) { assertString(str); if (locale in validators) { return validators[locale](str); - } if (locale === 'any') { + } + if (locale === 'any') { for (const key in validators) { // https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes // istanbul ignore else diff --git a/src/lib/isIn.js b/src/lib/isIn.js index 396cc2830..1a206c54a 100644 --- a/src/lib/isIn.js +++ b/src/lib/isIn.js @@ -14,9 +14,11 @@ export default function isIn(str, options) { } } return array.indexOf(str) >= 0; - } if (typeof options === 'object') { + } + if (typeof options === 'object') { return options.hasOwnProperty(str); - } if (options && typeof options.indexOf === 'function') { + } + if (options && typeof options.indexOf === 'function') { return options.indexOf(str) >= 0; } return false; diff --git a/src/lib/isInt.js b/src/lib/isInt.js index 93b22bd51..e79b5dbfc 100644 --- a/src/lib/isInt.js +++ b/src/lib/isInt.js @@ -9,16 +9,23 @@ export default function isInt(str, options) { // Get the regex to use for testing, based on whether // leading zeroes are allowed or not. - let regex = ( - options.hasOwnProperty('allow_leading_zeroes') && !options.allow_leading_zeroes - ? int : intLeadingZeroes - ); + let regex = + options.hasOwnProperty('allow_leading_zeroes') && + !options.allow_leading_zeroes + ? int + : intLeadingZeroes; // Check min/max/lt/gt - let minCheckPassed = (!options.hasOwnProperty('min') || str >= options.min); - let maxCheckPassed = (!options.hasOwnProperty('max') || str <= options.max); - let ltCheckPassed = (!options.hasOwnProperty('lt') || str < options.lt); - let gtCheckPassed = (!options.hasOwnProperty('gt') || str > options.gt); + let minCheckPassed = !options.hasOwnProperty('min') || str >= options.min; + let maxCheckPassed = !options.hasOwnProperty('max') || str <= options.max; + let ltCheckPassed = !options.hasOwnProperty('lt') || str < options.lt; + let gtCheckPassed = !options.hasOwnProperty('gt') || str > options.gt; - return regex.test(str) && minCheckPassed && maxCheckPassed && ltCheckPassed && gtCheckPassed; + return ( + regex.test(str) && + minCheckPassed && + maxCheckPassed && + ltCheckPassed && + gtCheckPassed + ); } diff --git a/src/lib/isJSON.js b/src/lib/isJSON.js index d8efb3d2e..d4612f333 100644 --- a/src/lib/isJSON.js +++ b/src/lib/isJSON.js @@ -16,6 +16,8 @@ export default function isJSON(str, options) { const obj = JSON.parse(str); return primitives.includes(obj) || (!!obj && typeof obj === 'object'); - } catch (e) { /* ignore */ } + } catch (e) { + /* ignore */ + } return false; } diff --git a/src/lib/isJWT.js b/src/lib/isJWT.js index ced911545..039428e88 100644 --- a/src/lib/isJWT.js +++ b/src/lib/isJWT.js @@ -11,5 +11,8 @@ export default function isJWT(str) { return false; } - return dotSplit.reduce((acc, currElem) => acc && isBase64(currElem, { urlSafe: true }), true); + return dotSplit.reduce( + (acc, currElem) => acc && isBase64(currElem, { urlSafe: true }), + true, + ); } diff --git a/src/lib/isLatLong.js b/src/lib/isLatLong.js index 33462a9c2..fe3591e0d 100644 --- a/src/lib/isLatLong.js +++ b/src/lib/isLatLong.js @@ -4,8 +4,10 @@ import merge from './util/merge.js'; const lat = /^\(?[+-]?(90(\.0+)?|[1-8]?\d(\.\d+)?)$/; const long = /^\s?[+-]?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)\)?$/; -const latDMS = /^(([1-8]?\d)\D+([1-5]?\d|60)\D+([1-5]?\d|60)(\.\d+)?|90\D+0\D+0)\D+[NSns]?$/i; -const longDMS = /^\s*([1-7]?\d{1,2}\D+([1-5]?\d|60)\D+([1-5]?\d|60)(\.\d+)?|180\D+0\D+0)\D+[EWew]?$/i; +const latDMS = + /^(([1-8]?\d)\D+([1-5]?\d|60)\D+([1-5]?\d|60)(\.\d+)?|90\D+0\D+0)\D+[NSns]?$/i; +const longDMS = + /^\s*([1-7]?\d{1,2}\D+([1-5]?\d|60)\D+([1-5]?\d|60)(\.\d+)?|180\D+0\D+0)\D+[EWew]?$/i; const defaultLatLongOptions = { checkDMS: false, @@ -17,8 +19,11 @@ export default function isLatLong(str, options) { if (!str.includes(',')) return false; const pair = str.split(','); - if ((pair[0].startsWith('(') && !pair[1].endsWith(')')) - || (pair[1].endsWith(')') && !pair[0].startsWith('('))) return false; + if ( + (pair[0].startsWith('(') && !pair[1].endsWith(')')) || + (pair[1].endsWith(')') && !pair[0].startsWith('(')) + ) + return false; if (options.checkDMS) { return latDMS.test(pair[0]) && longDMS.test(pair[1]); diff --git a/src/lib/isLength.js b/src/lib/isLength.js index 7b473a6e9..67cc45430 100644 --- a/src/lib/isLength.js +++ b/src/lib/isLength.js @@ -5,10 +5,11 @@ export default function isLength(str, options) { assertString(str); let min; let max; - if (typeof (options) === 'object') { + if (typeof options === 'object') { min = options.min || 0; max = options.max; - } else { // backwards compatibility: isLength(str, min [, max]) + } else { + // backwards compatibility: isLength(str, min [, max]) min = arguments[1] || 0; max = arguments[2]; } diff --git a/src/lib/isLicensePlate.js b/src/lib/isLicensePlate.js index 03e26b837..737ccd084 100644 --- a/src/lib/isLicensePlate.js +++ b/src/lib/isLicensePlate.js @@ -4,34 +4,34 @@ const validators = { 'cs-CZ': (str) => /^(([ABCDEFHIJKLMNPRSTUVXYZ]|[0-9])-?){5,8}$/.test(str), 'de-DE': (str) => /^((A|AA|AB|AC|AE|AH|AK|AM|AN|AÖ|AP|AS|AT|AU|AW|AZ|B|BA|BB|BC|BE|BF|BH|BI|BK|BL|BM|BN|BO|BÖ|BS|BT|BZ|C|CA|CB|CE|CO|CR|CW|D|DA|DD|DE|DH|DI|DL|DM|DN|DO|DU|DW|DZ|E|EA|EB|ED|EE|EF|EG|EH|EI|EL|EM|EN|ER|ES|EU|EW|F|FB|FD|FF|FG|FI|FL|FN|FO|FR|FS|FT|FÜ|FW|FZ|G|GA|GC|GD|GE|GF|GG|GI|GK|GL|GM|GN|GÖ|GP|GR|GS|GT|GÜ|GV|GW|GZ|H|HA|HB|HC|HD|HE|HF|HG|HH|HI|HK|HL|HM|HN|HO|HP|HR|HS|HU|HV|HX|HY|HZ|IK|IL|IN|IZ|J|JE|JL|K|KA|KB|KC|KE|KF|KG|KH|KI|KK|KL|KM|KN|KO|KR|KS|KT|KU|KW|KY|L|LA|LB|LC|LD|LF|LG|LH|LI|LL|LM|LN|LÖ|LP|LR|LU|M|MA|MB|MC|MD|ME|MG|MH|MI|MK|ML|MM|MN|MO|MQ|MR|MS|MÜ|MW|MY|MZ|N|NB|ND|NE|NF|NH|NI|NK|NM|NÖ|NP|NR|NT|NU|NW|NY|NZ|OA|OB|OC|OD|OE|OF|OG|OH|OK|OL|OP|OS|OZ|P|PA|PB|PE|PF|PI|PL|PM|PN|PR|PS|PW|PZ|R|RA|RC|RD|RE|RG|RH|RI|RL|RM|RN|RO|RP|RS|RT|RU|RV|RW|RZ|S|SB|SC|SE|SG|SI|SK|SL|SM|SN|SO|SP|SR|ST|SU|SW|SY|SZ|TE|TF|TG|TO|TP|TR|TS|TT|TÜ|ÜB|UE|UH|UL|UM|UN|V|VB|VG|VK|VR|VS|W|WA|WB|WE|WF|WI|WK|WL|WM|WN|WO|WR|WS|WT|WÜ|WW|WZ|Z|ZE|ZI|ZP|ZR|ZW|ZZ)[- ]?[A-Z]{1,2}[- ]?\d{1,4}|(ABG|ABI|AIB|AIC|ALF|ALZ|ANA|ANG|ANK|APD|ARN|ART|ASL|ASZ|AUR|AZE|BAD|BAR|BBG|BCH|BED|BER|BGD|BGL|BID|BIN|BIR|BIT|BIW|BKS|BLB|BLK|BNA|BOG|BOH|BOR|BOT|BRA|BRB|BRG|BRK|BRL|BRV|BSB|BSK|BTF|BÜD|BUL|BÜR|BÜS|BÜZ|CAS|CHA|CLP|CLZ|COC|COE|CUX|DAH|DAN|DAU|DBR|DEG|DEL|DGF|DIL|DIN|DIZ|DKB|DLG|DON|DUD|DÜW|EBE|EBN|EBS|ECK|EIC|EIL|EIN|EIS|EMD|EMS|ERB|ERH|ERK|ERZ|ESB|ESW|FDB|FDS|FEU|FFB|FKB|FLÖ|FOR|FRG|FRI|FRW|FTL|FÜS|GAN|GAP|GDB|GEL|GEO|GER|GHA|GHC|GLA|GMN|GNT|GOA|GOH|GRA|GRH|GRI|GRM|GRZ|GTH|GUB|GUN|GVM|HAB|HAL|HAM|HAS|HBN|HBS|HCH|HDH|HDL|HEB|HEF|HEI|HER|HET|HGN|HGW|HHM|HIG|HIP|HMÜ|HOG|HOH|HOL|HOM|HOR|HÖS|HOT|HRO|HSK|HST|HVL|HWI|IGB|ILL|JÜL|KEH|KEL|KEM|KIB|KLE|KLZ|KÖN|KÖT|KÖZ|KRU|KÜN|KUS|KYF|LAN|LAU|LBS|LBZ|LDK|LDS|LEO|LER|LEV|LIB|LIF|LIP|LÖB|LOS|LRO|LSZ|LÜN|LUP|LWL|MAB|MAI|MAK|MAL|MED|MEG|MEI|MEK|MEL|MER|MET|MGH|MGN|MHL|MIL|MKK|MOD|MOL|MON|MOS|MSE|MSH|MSP|MST|MTK|MTL|MÜB|MÜR|MYK|MZG|NAB|NAI|NAU|NDH|NEA|NEB|NEC|NEN|NES|NEW|NMB|NMS|NOH|NOL|NOM|NOR|NVP|NWM|OAL|OBB|OBG|OCH|OHA|ÖHR|OHV|OHZ|OPR|OSL|OVI|OVL|OVP|PAF|PAN|PAR|PCH|PEG|PIR|PLÖ|PRÜ|QFT|QLB|RDG|REG|REH|REI|RID|RIE|ROD|ROF|ROK|ROL|ROS|ROT|ROW|RSL|RÜD|RÜG|SAB|SAD|SAN|SAW|SBG|SBK|SCZ|SDH|SDL|SDT|SEB|SEE|SEF|SEL|SFB|SFT|SGH|SHA|SHG|SHK|SHL|SIG|SIM|SLE|SLF|SLK|SLN|SLS|SLÜ|SLZ|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 + str, ), 'de-LI': (str) => /^FL[- ]?\d{1,5}[UZ]?$/.test(str), 'en-IN': (str) => /^[A-Z]{2}[ -]?[0-9]{1,2}(?:[ -]?[A-Z])(?:[ -]?[A-Z]*)?[ -]?[0-9]{4}$/.test( - str + str, ), 'es-AR': (str) => /^(([A-Z]{2} ?[0-9]{3} ?[A-Z]{2})|([A-Z]{3} ?[0-9]{3}))$/.test(str), 'fi-FI': (str) => /^(?=.{4,7})(([A-Z]{1,3}|[0-9]{1,3})[\s-]?([A-Z]{1,3}|[0-9]{1,5}))$/.test( - str + str, ), 'hu-HU': (str) => /^((((?!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 + str, ), 'pt-BR': (str) => /^[A-Z]{3}[ -]?[0-9][A-Z][0-9]{2}|[A-Z]{3}[ -]?[0-9]{4}$/.test(str), 'pt-PT': (str) => /^([A-Z]{2}|[0-9]{2})[ -·]?([A-Z]{2}|[0-9]{2})[ -·]?([A-Z]{2}|[0-9]{2})$/.test( - str + str, ), 'sq-AL': (str) => /^[A-Z]{2}[- ]?((\d{3}[- ]?(([A-Z]{2})|T))|(R[- ]?\d{3}))$/.test(str), 'sv-SE': (str) => /^[A-HJ-PR-UW-Z]{3} ?[\d]{2}[A-HJ-PR-UW-Z1-9]$|(^[A-ZÅÄÖ ]{2,7}$)/.test( - str.trim() + str.trim(), ), }; diff --git a/src/lib/isLocale.js b/src/lib/isLocale.js index b1ef72000..621c2f73b 100644 --- a/src/lib/isLocale.js +++ b/src/lib/isLocale.js @@ -57,17 +57,19 @@ const privateuse = '(x(-[A-Za-z0-9]{1,8})+)'; // otherwise be considered 'well-formed'. These tags are all valid, but // most are deprecated in favor of more modern subtags or subtag combination -const 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))'; +const 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 -const regular = '((art-lojban)|(cel-gaulish)|(no-bok)|(no-nyn)|(zh-guoyu)|' + - '(zh-hakka)|(zh-min)|(zh-min-nan)|(zh-xiang))'; +const 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 @@ -103,7 +105,9 @@ const langtag = `${language}(${delimiter}${script})?(${delimiter}${region})?(${d Tags for Identifying Languages https://www.rfc-editor.org/rfc/rfc5646.html */ -const languageTagRegex = new RegExp(`(^${privateuse}$)|(^${grandfathered}$)|(^${langtag}$)`); +const languageTagRegex = new RegExp( + `(^${privateuse}$)|(^${grandfathered}$)|(^${langtag}$)`, +); export default function isLocale(str) { assertString(str); diff --git a/src/lib/isLuhnNumber.js b/src/lib/isLuhnNumber.js index 258ce20e3..deaa40da1 100644 --- a/src/lib/isLuhnNumber.js +++ b/src/lib/isLuhnNumber.js @@ -8,12 +8,12 @@ export default function isLuhnNumber(str) { let tmpNum; let shouldDouble; for (let i = sanitized.length - 1; i >= 0; i--) { - digit = sanitized.substring(i, (i + 1)); + digit = sanitized.substring(i, i + 1); tmpNum = parseInt(digit, 10); if (shouldDouble) { tmpNum *= 2; if (tmpNum >= 10) { - sum += ((tmpNum % 10) + 1); + sum += (tmpNum % 10) + 1; } else { sum += tmpNum; } @@ -22,5 +22,5 @@ export default function isLuhnNumber(str) { } shouldDouble = !shouldDouble; } - return !!((sum % 10) === 0 ? sanitized : false); + return !!(sum % 10 === 0 ? sanitized : false); } diff --git a/src/lib/isMACAddress.js b/src/lib/isMACAddress.js index e14cf808a..6227368c2 100644 --- a/src/lib/isMACAddress.js +++ b/src/lib/isMACAddress.js @@ -1,9 +1,11 @@ import assertString from './util/assertString.js'; -const macAddress48 = /^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){4}([0-9a-fA-F]{2})$/; +const macAddress48 = + /^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){4}([0-9a-fA-F]{2})$/; const macAddress48NoSeparators = /^([0-9a-fA-F]){12}$/; const macAddress48WithDots = /^([0-9a-fA-F]{4}\.){2}([0-9a-fA-F]{4})$/; -const macAddress64 = /^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){6}([0-9a-fA-F]{2})$/; +const macAddress64 = + /^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){6}([0-9a-fA-F]{2})$/; const macAddress64NoSeparators = /^([0-9a-fA-F]){16}$/; const macAddress64WithDots = /^([0-9a-fA-F]{4}\.){3}([0-9a-fA-F]{4})$/; @@ -14,7 +16,7 @@ export default function isMACAddress(str, options) { } /** * @deprecated `no_colons` TODO: remove it in the next major - */ + */ if (options?.no_colons || options?.no_separators) { if (options.eui === '48') { return macAddress48NoSeparators.test(str); @@ -22,7 +24,9 @@ export default function isMACAddress(str, options) { if (options.eui === '64') { return macAddress64NoSeparators.test(str); } - return macAddress48NoSeparators.test(str) || macAddress64NoSeparators.test(str); + return ( + macAddress48NoSeparators.test(str) || macAddress64NoSeparators.test(str) + ); } if (options?.eui === '48') { return macAddress48.test(str) || macAddress48WithDots.test(str); diff --git a/src/lib/isMagnetURI.js b/src/lib/isMagnetURI.js index 9008ac021..479b14c32 100644 --- a/src/lib/isMagnetURI.js +++ b/src/lib/isMagnetURI.js @@ -1,6 +1,7 @@ import assertString from './util/assertString.js'; -const 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; +const 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); diff --git a/src/lib/isMailtoURI.js b/src/lib/isMailtoURI.js index 1b1f0b568..5b07f5d65 100644 --- a/src/lib/isMailtoURI.js +++ b/src/lib/isMailtoURI.js @@ -53,15 +53,13 @@ export default function isMailtoURI(url, options) { return false; } - return `${to},${query.cc},${query.bcc}` - .split(',') - .every((email) => { - email = trim(email, ' '); + return `${to},${query.cc},${query.bcc}`.split(',').every((email) => { + email = trim(email, ' '); - if (email) { - return isEmail(email, options); - } + if (email) { + return isEmail(email, options); + } - return true; - }); + return true; + }); } diff --git a/src/lib/isMimeType.js b/src/lib/isMimeType.js index e4e47add6..1d915209a 100644 --- a/src/lib/isMimeType.js +++ b/src/lib/isMimeType.js @@ -26,15 +26,22 @@ import assertString from './util/assertString.js'; // NB : // Subtype length must not exceed 100 characters. // This rule does not comply to the RFC specs (what is the max length ?). -const mimeTypeSimple = /^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+_]{1,100}$/i; // eslint-disable-line max-len +const 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/*" -const mimeTypeText = /^text\/[a-zA-Z0-9\.\-\+]{1,100};\s?charset=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?$/i; // eslint-disable-line max-len +const mimeTypeText = + /^text\/[a-zA-Z0-9\.\-\+]{1,100};\s?charset=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?$/i; // eslint-disable-line max-len // Handle "boundary" in "multipart/*" -const mimeTypeMultipart = /^multipart\/[a-zA-Z0-9\.\-\+]{1,100}(;\s?(boundary|charset)=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?){0,2}$/i; // eslint-disable-line max-len +const mimeTypeMultipart = + /^multipart\/[a-zA-Z0-9\.\-\+]{1,100}(;\s?(boundary|charset)=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?){0,2}$/i; // eslint-disable-line max-len export default function isMimeType(str) { assertString(str); - return mimeTypeSimple.test(str) || mimeTypeText.test(str) || mimeTypeMultipart.test(str); + return ( + mimeTypeSimple.test(str) || + mimeTypeText.test(str) || + mimeTypeMultipart.test(str) + ); } diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index f3476d843..8ba40291b 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -34,7 +34,8 @@ const phones = { '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-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-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}$))/, @@ -56,7 +57,8 @@ const phones = { '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}$/, 'en-MU': /^(\+?230|0)?\d{8}$/, - 'en-MW': /^(\+?265|0)(((77|88|31|99|98|21)\d{7})|(((111)|1)\d{6})|(32000\d{4}))$/, + 'en-MW': + /^(\+?265|0)(((77|88|31|99|98|21)\d{7})|(((111)|1)\d{6})|(32000\d{4}))$/, 'en-NA': /^(\+?264|0)(6|8)\d{7}$/, 'en-NG': /^(\+?234|0)?[789]\d{9}$/, 'en-NZ': /^(\+?64|0)[28]\d{7,9}$/, @@ -68,7 +70,8 @@ const phones = { 'en-SL': /^(\+?232|0)\d{8}$/, 'en-TZ': /^(\+?255|0)?[67]\d{8}$/, 'en-UG': /^(\+?256|0)?[7]\d{8}$/, - 'en-US': /^((\+1|1)?( |-)?)?(\([2-9][0-9]{2}\)|[2-9][0-9]{2})( |-)?([2-9][0-9]{2}( |-)?[0-9]{4})$/, + 'en-US': + /^((\+1|1)?( |-)?)?(\([2-9][0-9]{2}\)|[2-9][0-9]{2})( |-)?([2-9][0-9]{2}( |-)?[0-9]{4})$/, 'en-ZA': /^(\+?27|0)\d{9}$/, 'en-ZM': /^(\+?26)?09[567]\d{7}$/, 'en-ZW': /^(\+263)[0-9]{9}$/, @@ -109,7 +112,8 @@ const phones = { 'fr-WF': /^(\+681)?\d{6}$/, 'he-IL': /^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/, 'hu-HU': /^(\+?36|06)(20|30|31|50|70)\d{7}$/, - 'id-ID': /^(\+?62|0)8(1[123456789]|2[1238]|3[1238]|5[12356789]|7[78]|9[56789]|8[123456789])([\s?|\d]{5,11})$/, + '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}$/, @@ -133,14 +137,16 @@ const phones = { 'nl-AW': /^(\+)?297(56|59|64|73|74|99)\d{5}$/, 'nn-NO': /^(\+?47)?[49]\d{7}$/, '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}))$/, + '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-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}$/, 'si-LK': /^(?:0|94|\+94)?(7(0|1|2|4|5|6|7|8)( |-)?)\d{7}$/, - 'sl-SI': /^(\+386\s?|0)(\d{1}\s?\d{3}\s?\d{2}\s?\d{2}|\d{2}\s?\d{3}\s?\d{3})$/, + 'sl-SI': + /^(\+386\s?|0)(\d{1}\s?\d{3}\s?\d{2}\s?\d{2}|\d{2}\s?\d{3}\s?\d{3})$/, '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}$/, @@ -152,7 +158,8 @@ const phones = { 'tk-TM': /^(\+993|993|8)\d{8}$/, 'uk-UA': /^(\+?38|8)?0\d{9}$/, 'uz-UZ': /^(\+?998)?(6[125-79]|7[1-69]|88|9\d)\d{7}$/, - 'vi-VN': /^((\+?84)|0)((3([2-9]))|(5([25689]))|(7([0|6-9]))|(8([1-9]))|(9([0-9])))([0-9]{7})$/, + 'vi-VN': + /^((\+?84)|0)((3([2-9]))|(5([25689]))|(7([0|6-9]))|(8([1-9]))|(9([0-9])))([0-9]{7})$/, 'zh-CN': /^((\+|00)86)?(1[3-9]|9[28])\d{9}$/, 'zh-TW': /^(\+?886\-?|0)?9\d{8}$/, 'dz-BT': /^(\+?975|0)?(17|16|77|02)\d{6}$/, @@ -189,10 +196,12 @@ export default function isMobilePhone(str, locale, options) { } return false; }); - } if (locale in phones) { + } + if (locale in phones) { return phones[locale].test(str); // alias falsey locale as 'any' - } if (!locale || locale === 'any') { + } + if (!locale || locale === 'any') { for (const key in phones) { // istanbul ignore else if (phones.hasOwnProperty(key)) { diff --git a/src/lib/isNumeric.js b/src/lib/isNumeric.js index 8b31c75be..37200ea52 100644 --- a/src/lib/isNumeric.js +++ b/src/lib/isNumeric.js @@ -8,5 +8,9 @@ export default function isNumeric(str, options) { if (options && options.no_symbols) { return numericNoSymbols.test(str); } - return (new RegExp(`^[+-]?([0-9]*[${(options || {}).locale ? decimal[options.locale] : '.'}])?[0-9]+$`)).test(str); + return new RegExp( + `^[+-]?([0-9]*[${ + (options || {}).locale ? decimal[options.locale] : '.' + }])?[0-9]+$`, + ).test(str); } diff --git a/src/lib/isPassportNumber.js b/src/lib/isPassportNumber.js index 55f6b8fd1..63aeaab6f 100644 --- a/src/lib/isPassportNumber.js +++ b/src/lib/isPassportNumber.js @@ -82,6 +82,8 @@ export default function isPassportNumber(str, countryCode) { /** Remove All Whitespaces, Convert to UPPERCASE */ const normalizedStr = str.replace(/\s/g, '').toUpperCase(); - return (countryCode.toUpperCase() in passportRegexByCountryCode) - && passportRegexByCountryCode[countryCode].test(normalizedStr); + return ( + countryCode.toUpperCase() in passportRegexByCountryCode && + passportRegexByCountryCode[countryCode].test(normalizedStr) + ); } diff --git a/src/lib/isPostalCode.js b/src/lib/isPostalCode.js index 4f945fcf5..24aed2cdd 100644 --- a/src/lib/isPostalCode.js +++ b/src/lib/isPostalCode.js @@ -81,7 +81,8 @@ export default function isPostalCode(str, locale) { assertString(str); if (locale in patterns) { return patterns[locale].test(str); - } if (locale === 'any') { + } + if (locale === 'any') { for (const key in patterns) { // https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes // istanbul ignore else diff --git a/src/lib/isRFC3339.js b/src/lib/isRFC3339.js index d21ad9509..eec46ce2c 100644 --- a/src/lib/isRFC3339.js +++ b/src/lib/isRFC3339.js @@ -14,9 +14,13 @@ const timeSecFrac = /(\.[0-9]+)?/; const timeNumOffset = new RegExp(`[-+]${timeHour.source}:${timeMinute.source}`); const timeOffset = new RegExp(`([zZ]|${timeNumOffset.source})`); -const partialTime = new RegExp(`${timeHour.source}:${timeMinute.source}:${timeSecond.source}${timeSecFrac.source}`); +const partialTime = new RegExp( + `${timeHour.source}:${timeMinute.source}:${timeSecond.source}${timeSecFrac.source}`, +); -const fullDate = new RegExp(`${dateFullYear.source}-${dateMonth.source}-${dateMDay.source}`); +const fullDate = new RegExp( + `${dateFullYear.source}-${dateMonth.source}-${dateMDay.source}`, +); const fullTime = new RegExp(`${partialTime.source}${timeOffset.source}`); const rfc3339 = new RegExp(`^${fullDate.source}[ tT]${fullTime.source}$`); diff --git a/src/lib/isRgbColor.js b/src/lib/isRgbColor.js index 18bef7835..21cdded6c 100644 --- a/src/lib/isRgbColor.js +++ b/src/lib/isRgbColor.js @@ -1,9 +1,13 @@ import assertString from './util/assertString.js'; -const 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])\)$/; -const 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)?)\)$/; -const rgbColorPercent = /^rgb\((([0-9]%|[1-9][0-9]%|100%),){2}([0-9]%|[1-9][0-9]%|100%)\)$/; -const rgbaColorPercent = /^rgba\((([0-9]%|[1-9][0-9]%|100%),){3}(0?\.\d|1(\.0)?|0(\.0)?)\)$/; +const 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])\)$/; +const 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)?)\)$/; +const rgbColorPercent = + /^rgb\((([0-9]%|[1-9][0-9]%|100%),){2}([0-9]%|[1-9][0-9]%|100%)\)$/; +const rgbaColorPercent = + /^rgba\((([0-9]%|[1-9][0-9]%|100%),){3}(0?\.\d|1(\.0)?|0(\.0)?)\)$/; export default function isRgbColor(str, includePercentValues = true) { assertString(str); @@ -12,8 +16,10 @@ export default function isRgbColor(str, includePercentValues = true) { return rgbColor.test(str) || rgbaColor.test(str); } - return rgbColor.test(str) - || rgbaColor.test(str) - || rgbColorPercent.test(str) - || rgbaColorPercent.test(str); + return ( + rgbColor.test(str) || + rgbaColor.test(str) || + rgbColorPercent.test(str) || + rgbaColorPercent.test(str) + ); } diff --git a/src/lib/isSemVer.js b/src/lib/isSemVer.js index 22889034d..115905c80 100644 --- a/src/lib/isSemVer.js +++ b/src/lib/isSemVer.js @@ -7,11 +7,14 @@ import multilineRegexp from './util/multilineRegex.js'; * built from multi-line, multi-parts regexp * Reference: https://semver.org/ */ -const semanticVersioningRegex = multilineRegexp([ - '^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)', - '(?:-((?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*))*))', - '?(?:\\+([0-9a-z-]+(?:\\.[0-9a-z-]+)*))?$', -], 'i'); +const semanticVersioningRegex = multilineRegexp( + [ + '^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)', + '(?:-((?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*))*))', + '?(?:\\+([0-9a-z-]+(?:\\.[0-9a-z-]+)*))?$', + ], + 'i', +); export default function isSemVer(str) { assertString(str); diff --git a/src/lib/isSlug.js b/src/lib/isSlug.js index 8fa4694c6..88e9786a1 100644 --- a/src/lib/isSlug.js +++ b/src/lib/isSlug.js @@ -4,5 +4,5 @@ let charsetRegex = /^[^\s-_](?!.*?[-_]{2,})[a-z0-9-\\][^\s]*[^-_\s]$/; export default function isSlug(str) { assertString(str); - return (charsetRegex.test(str)); + return charsetRegex.test(str); } diff --git a/src/lib/isStrongPassword.js b/src/lib/isStrongPassword.js index cd82d80f1..31c54dd52 100644 --- a/src/lib/isStrongPassword.js +++ b/src/lib/isStrongPassword.js @@ -23,7 +23,7 @@ const defaultOptions = { /* Counts number of occurrences of each char in a string * could be moved to util/ ? -*/ + */ function countChars(str) { let result = {}; Array.from(str).forEach((char) => { @@ -66,7 +66,8 @@ function analyzePassword(password) { function scorePassword(analysis, scoringOptions) { let points = 0; points += analysis.uniqueChars * scoringOptions.pointsPerUnique; - points += (analysis.length - analysis.uniqueChars) * scoringOptions.pointsPerRepeat; + points += + (analysis.length - analysis.uniqueChars) * scoringOptions.pointsPerRepeat; if (analysis.lowercaseCount > 0) { points += scoringOptions.pointsForContainingLower; } @@ -89,9 +90,11 @@ export default function isStrongPassword(str, options = null) { if (options.returnScore) { return scorePassword(analysis, options); } - return analysis.length >= options.minLength - && analysis.lowercaseCount >= options.minLowercase - && analysis.uppercaseCount >= options.minUppercase - && analysis.numberCount >= options.minNumbers - && analysis.symbolCount >= options.minSymbols; + return ( + analysis.length >= options.minLength && + analysis.lowercaseCount >= options.minLowercase && + analysis.uppercaseCount >= options.minUppercase && + analysis.numberCount >= options.minNumbers && + analysis.symbolCount >= options.minSymbols + ); } diff --git a/src/lib/isTaxID.js b/src/lib/isTaxID.js index a812ab2d7..3b57a681e 100644 --- a/src/lib/isTaxID.js +++ b/src/lib/isTaxID.js @@ -43,9 +43,13 @@ function bgBgCheck(tin) { } else { century_year = `19${century_year}`; } - if (month < 10) { month = `0${month}`; } + if (month < 10) { + month = `0${month}`; + } const date = `${century_year}/${month}/${tin.slice(4, 6)}`; - if (!isDate(date, 'YYYY/MM/DD')) { return false; } + if (!isDate(date, 'YYYY/MM/DD')) { + return false; + } // split digits into an array for further processing const digits = tin.split('').map((a) => parseInt(a, 10)); @@ -87,7 +91,7 @@ function isCanadianSIN(input) { .map((i) => Number(i)) .reduce((acc, cur) => acc + cur); - return (total % 10 === 0); + return total % 10 === 0; } /* @@ -110,7 +114,9 @@ function csCzCheck(tin) { full_year = `19${full_year}`; } } else { - if (tin.slice(6) === '000') { return false; } // Three-zero serial not assigned before 1954 + if (tin.slice(6) === '000') { + return false; + } // Three-zero serial not assigned before 1954 if (full_year < 54) { full_year = `19${full_year}`; } else { @@ -129,14 +135,20 @@ function csCzCheck(tin) { } if (month > 20) { // Month-plus-twenty was only introduced in 2004 - if (parseInt(full_year, 10) < 2004) { return false; } + if (parseInt(full_year, 10) < 2004) { + return false; + } month -= 20; } - if (month < 10) { month = `0${month}`; } + if (month < 10) { + month = `0${month}`; + } // Check date validity const date = `${full_year}/${month}/${tin.slice(4, 6)}`; - if (!isDate(date, 'YYYY/MM/DD')) { return false; } + if (!isDate(date, 'YYYY/MM/DD')) { + return false; + } // Verify divisibility by 11 if (tin.length === 10) { @@ -145,7 +157,9 @@ function csCzCheck(tin) { // check (last) digit equals 0 and modulo of first 9 digits equals 10 const checkdigit = parseInt(tin.slice(0, 9), 10) % 11; if (parseInt(full_year, 10) < 1986 && checkdigit === 10) { - if (parseInt(tin.slice(9), 10) !== 0) { return false; } + if (parseInt(tin.slice(9), 10) !== 0) { + return false; + } } else { return false; } @@ -186,7 +200,9 @@ function deDeCheck(tin) { // Remove digits with one occurence and test for only one duplicate/triplicate occurences = occurences.filter((a) => a.length > 1); - if (occurences.length !== 2 && occurences.length !== 3) { return false; } + if (occurences.length !== 2 && occurences.length !== 3) { + return false; + } // In case of triplicate value only two digits are allowed next to each other if (occurences[0].length === 3) { @@ -247,7 +263,9 @@ function dkDkCheck(tin) { } // Check date validity const date = `${year}/${tin.slice(2, 4)}/${tin.slice(0, 2)}`; - if (!isDate(date, 'YYYY/MM/DD')) { return false; } + if (!isDate(date, 'YYYY/MM/DD')) { + return false; + } // Split digits into an array for further processing const digits = tin.split('').map((a) => parseInt(a, 10)); @@ -262,7 +280,9 @@ function dkDkCheck(tin) { } } checksum %= 11; - if (checksum === 1) { return false; } + if (checksum === 1) { + return false; + } return checksum === 0 ? digits[9] === 0 : digits[9] === 11 - checksum; } @@ -273,7 +293,10 @@ function dkDkCheck(tin) { */ function elCyCheck(tin) { // split digits into an array for further processing - const digits = tin.slice(0, 8).split('').map((a) => parseInt(a, 10)); + const digits = tin + .slice(0, 8) + .split('') + .map((a) => parseInt(a, 10)); let checksum = 0; // add digits in even places @@ -286,7 +309,7 @@ function elCyCheck(tin) { if (digits[i] < 2) { checksum += 1 - digits[i]; } else { - checksum += (2 * (digits[i] - 2)) + 5; + checksum += 2 * (digits[i] - 2) + 5; if (digits[i] > 4) { checksum += 2; } @@ -308,9 +331,9 @@ function elGrCheck(tin) { let checksum = 0; for (let i = 0; i < 8; i++) { - checksum += digits[i] * (2 ** (8 - i)); + checksum += digits[i] * 2 ** (8 - i); } - return ((checksum % 11) % 10) === digits[8]; + return (checksum % 11) % 10 === digits[8]; } /* @@ -325,7 +348,13 @@ function elGrCheck(tin) { * Verify TIN validity by calculating check (second to last) character */ function enIeCheck(tin) { - let checksum = algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 7).map((a) => parseInt(a, 10)), 8); + let checksum = algorithms.reverseMultiplyAndSum( + tin + .split('') + .slice(0, 7) + .map((a) => parseInt(a, 10)), + 8, + ); if (tin.length === 9 && tin[8] !== 'W') { checksum += (tin[8].charCodeAt(0) - 64) * 9; } @@ -342,14 +371,72 @@ const enUsCampusPrefix = { andover: ['10', '12'], atlanta: ['60', '67'], austin: ['50', '53'], - brookhaven: ['01', '02', '03', '04', '05', '06', '11', '13', '14', '16', '21', '22', '23', '25', '34', '51', '52', '54', '55', '56', '57', '58', '59', '65'], + brookhaven: [ + '01', + '02', + '03', + '04', + '05', + '06', + '11', + '13', + '14', + '16', + '21', + '22', + '23', + '25', + '34', + '51', + '52', + '54', + '55', + '56', + '57', + '58', + '59', + '65', + ], cincinnati: ['30', '32', '35', '36', '37', '38', '61'], fresno: ['15', '24'], internet: ['20', '26', '27', '45', '46', '47'], kansas: ['40', '44'], memphis: ['94', '95'], ogden: ['80', '90'], - philadelphia: ['33', '39', '41', '42', '43', '46', '48', '62', '63', '64', '66', '68', '71', '72', '73', '74', '75', '76', '77', '81', '82', '83', '84', '85', '86', '87', '88', '91', '92', '93', '98', '99'], + philadelphia: [ + '33', + '39', + '41', + '42', + '43', + '46', + '48', + '62', + '63', + '64', + '66', + '68', + '71', + '72', + '73', + '74', + '75', + '76', + '77', + '81', + '82', + '83', + '84', + '85', + '86', + '87', + '88', + '91', + '92', + '93', + '98', + '99', + ], sba: ['31'], }; @@ -423,7 +510,7 @@ function esEsCheck(tin) { default: } chars.splice(0, 1, lead_replace); - // Fill with zeros if smaller than proper + // Fill with zeros if smaller than proper } else { while (chars.length < 9) { chars.unshift(0); @@ -431,9 +518,33 @@ function esEsCheck(tin) { } // Calculate checksum and check according to lookup - const lookup = ['T', 'R', 'W', 'A', 'G', 'M', 'Y', 'F', 'P', 'D', 'X', 'B', 'N', 'J', 'Z', 'S', 'Q', 'V', 'H', 'L', 'C', 'K', 'E']; + const lookup = [ + 'T', + 'R', + 'W', + 'A', + 'G', + 'M', + 'Y', + 'F', + 'P', + 'D', + 'X', + 'B', + 'N', + 'J', + 'Z', + 'S', + 'Q', + 'V', + 'H', + 'L', + 'C', + 'K', + 'E', + ]; chars = chars.join(''); - let checksum = (parseInt(chars.slice(0, 8), 10) % 23); + let checksum = parseInt(chars.slice(0, 8), 10) % 23; return chars[8] === lookup[checksum]; } @@ -463,7 +574,9 @@ function etEeCheck(tin) { } // Check date validity const date = `${full_year}/${tin.slice(3, 5)}/${tin.slice(5, 7)}`; - if (!isDate(date, 'YYYY/MM/DD')) { return false; } + if (!isDate(date, 'YYYY/MM/DD')) { + return false; + } // Split digits into an array for further processing const digits = tin.split('').map((a) => parseInt(a, 10)); @@ -488,7 +601,9 @@ function etEeCheck(tin) { weight = 1; } } - if (checksum % 11 === 10) { return digits[10] === 0; } + if (checksum % 11 === 10) { + return digits[10] === 0; + } } return checksum % 11 === digits[10]; @@ -517,14 +632,40 @@ function fiFiCheck(tin) { } // Check date validity const date = `${full_year}/${tin.slice(2, 4)}/${tin.slice(0, 2)}`; - if (!isDate(date, 'YYYY/MM/DD')) { return false; } + if (!isDate(date, 'YYYY/MM/DD')) { + return false; + } // Calculate check character - let checksum = parseInt((tin.slice(0, 6) + tin.slice(7, 10)), 10) % 31; - if (checksum < 10) { return checksum === parseInt(tin.slice(10), 10); } + let checksum = parseInt(tin.slice(0, 6) + tin.slice(7, 10), 10) % 31; + if (checksum < 10) { + return checksum === parseInt(tin.slice(10), 10); + } checksum -= 10; - const letters_lookup = ['A', 'B', 'C', 'D', 'E', 'F', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y']; + const letters_lookup = [ + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'H', + 'J', + 'K', + 'L', + 'M', + 'N', + 'P', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + ]; return letters_lookup[checksum] === tin.slice(10); } @@ -538,7 +679,9 @@ function frBeCheck(tin) { if (tin.slice(2, 4) !== '00' || tin.slice(4, 6) !== '00') { // Extract date from first six digits of TIN const date = `${tin.slice(0, 2)}/${tin.slice(2, 4)}/${tin.slice(4, 6)}`; - if (!isDate(date, 'YY/MM/DD')) { return false; } + if (!isDate(date, 'YY/MM/DD')) { + return false; + } } let checksum = 97 - (parseInt(tin.slice(0, 9), 10) % 97); @@ -572,10 +715,14 @@ function frFrCheck(tin) { function frLuCheck(tin) { // Extract date and check validity const date = `${tin.slice(0, 4)}/${tin.slice(4, 6)}/${tin.slice(6, 8)}`; - if (!isDate(date, 'YYYY/MM/DD')) { return false; } + if (!isDate(date, 'YYYY/MM/DD')) { + return false; + } // Run Luhn check - if (!algorithms.luhnCheck(tin.slice(0, 12))) { return false; } + if (!algorithms.luhnCheck(tin.slice(0, 12))) { + return false; + } // Remove Luhn check digit and run Verhoeff check return algorithms.verhoeffCheck(`${tin.slice(0, 11)}${tin[12]}`); } @@ -631,14 +778,18 @@ function itItNameCheck(name) { for (let i = 0; i < 3; i++) { if (!vowelflag && /[AEIOU]/.test(name[i])) { vowelflag = true; - } else if (!xflag && vowelflag && (name[i] === 'X')) { + } else if (!xflag && vowelflag && name[i] === 'X') { xflag = true; } else if (i > 0) { if (vowelflag && !xflag) { - if (!/[AEIOU]/.test(name[i])) { return false; } + if (!/[AEIOU]/.test(name[i])) { + return false; + } } if (xflag) { - if (!/X/.test(name[i])) { return false; } + if (!/X/.test(name[i])) { + return false; + } } } } @@ -658,8 +809,12 @@ function itItCheck(tin) { const chars = tin.toUpperCase().split(''); // Check first and last name validity calling itItNameCheck() - if (!itItNameCheck(chars.slice(0, 3))) { return false; } - if (!itItNameCheck(chars.slice(3, 6))) { return false; } + if (!itItNameCheck(chars.slice(0, 3))) { + return false; + } + if (!itItNameCheck(chars.slice(3, 6))) { + return false; + } // Convert letters in number spaces back to numbers if any const number_locations = [6, 7, 9, 10, 12, 13, 14]; @@ -699,11 +854,17 @@ function itItCheck(tin) { let month = month_replace[chars[8]]; let day = parseInt(chars[9] + chars[10], 10); - if (day > 40) { day -= 40; } - if (day < 10) { day = `0${day}`; } + if (day > 40) { + day -= 40; + } + if (day < 10) { + day = `0${day}`; + } const date = `${chars[6]}${chars[7]}/${month}/${day}`; - if (!isDate(date, 'YY/MM/DD')) { return false; } + if (!isDate(date, 'YY/MM/DD')) { + return false; + } // Calculate check character by adding up even and odd characters as numbers let checksum = 0; @@ -715,7 +876,8 @@ function itItCheck(tin) { checksum += char_to_int; } - const odd_convert = { // Maps of characters at odd places + const odd_convert = { + // Maps of characters at odd places A: 1, B: 0, C: 5, @@ -751,7 +913,7 @@ function itItCheck(tin) { char_to_int = odd_convert[chars[i]]; } else { let multiplier = parseInt(chars[i], 10); - char_to_int = (2 * multiplier) + 1; + char_to_int = 2 * multiplier + 1; if (multiplier > 4) { char_to_int += 2; } @@ -759,7 +921,9 @@ function itItCheck(tin) { checksum += char_to_int; } - if (String.fromCharCode(65 + (checksum % 26)) !== chars[15]) { return false; } + if (String.fromCharCode(65 + (checksum % 26)) !== chars[15]) { + return false; + } return true; } @@ -775,9 +939,11 @@ function lvLvCheck(tin) { tin = tin.replace(/\W/, ''); // Extract date from TIN const day = tin.slice(0, 2); - if (day !== '32') { // No date/checksum check if new format + if (day !== '32') { + // No date/checksum check if new format const month = tin.slice(2, 4); - if (month !== '00') { // No date check if unknown month + if (month !== '00') { + // No date check if unknown month let full_year = tin.slice(4, 6); switch (tin[6]) { case '0': @@ -792,7 +958,9 @@ function lvLvCheck(tin) { } // Check date validity const date = `${full_year}/${tin.slice(2, 4)}/${day}`; - if (!isDate(date, 'YYYY/MM/DD')) { return false; } + if (!isDate(date, 'YYYY/MM/DD')) { + return false; + } } // Calculate check digit @@ -801,7 +969,7 @@ function lvLvCheck(tin) { for (let i = 0; i < tin.length - 1; i++) { checksum -= parseInt(tin[i], 10) * multip_lookup[i]; } - return (parseInt(tin[10], 10) === checksum % 11); + return parseInt(tin[10], 10) === checksum % 11; } return true; } @@ -812,7 +980,8 @@ function lvLvCheck(tin) { * Verify Identity Card Number structure (no other tests found) */ function mtMtCheck(tin) { - if (tin.length !== 9) { // No tests for UTR + if (tin.length !== 9) { + // No tests for UTR let chars = tin.toUpperCase().split(''); // Fill with zeros if smaller than proper while (chars.length < 8) { @@ -822,13 +991,19 @@ function mtMtCheck(tin) { switch (tin[7]) { case 'A': case 'P': - if (parseInt(chars[6], 10) === 0) { return false; } + if (parseInt(chars[6], 10) === 0) { + return false; + } break; default: { const first_part = parseInt(chars.join('').slice(0, 5), 10); - if (first_part > 32000) { return false; } + if (first_part > 32000) { + return false; + } const second_part = parseInt(chars.join('').slice(5, 7), 10); - if (first_part === second_part) { return false; } + if (first_part === second_part) { + return false; + } } } } @@ -842,7 +1017,17 @@ function mtMtCheck(tin) { * Verify TIN validity by calculating check (last) digit (variant of MOD 11) */ function nlNlCheck(tin) { - return algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 8).map((a) => parseInt(a, 10)), 9) % 11 === parseInt(tin[8], 10); + return ( + algorithms.reverseMultiplyAndSum( + tin + .split('') + .slice(0, 8) + .map((a) => parseInt(a, 10)), + 9, + ) % + 11 === + parseInt(tin[8], 10) + ); } /* @@ -861,8 +1046,10 @@ function plPlCheck(tin) { checksum += parseInt(tin[i], 10) * lookup[i]; } checksum %= 11; - if (checksum === 10) { return false; } - return (checksum === parseInt(tin[9], 10)); + if (checksum === 10) { + return false; + } + return checksum === parseInt(tin[9], 10); } // PESEL @@ -885,10 +1072,14 @@ function plPlCheck(tin) { full_year = `19${full_year}`; } // Add leading zero to month if needed - if (month < 10) { month = `0${month}`; } + if (month < 10) { + month = `0${month}`; + } // Check date validity const date = `${full_year}/${month}/${tin.slice(4, 6)}`; - if (!isDate(date, 'YYYY/MM/DD')) { return false; } + if (!isDate(date, 'YYYY/MM/DD')) { + return false; + } // Calculate last digit by mulitplying with odd one-digit numbers except 5 let checksum = 0; @@ -907,11 +1098,11 @@ function plPlCheck(tin) { } /* -* pt-BR validation function -* (Cadastro de Pessoas Físicas (CPF, persons) -* Cadastro Nacional de Pessoas Jurídicas (CNPJ, entities) -* Both inputs will be validated -*/ + * pt-BR validation function + * (Cadastro de Pessoas Físicas (CPF, persons) + * Cadastro Nacional de Pessoas Jurídicas (CNPJ, entities) + * Both inputs will be validated + */ function ptBrCheck(tin) { if (tin.length === 11) { @@ -919,26 +1110,30 @@ function ptBrCheck(tin) { let remainder; sum = 0; - if ( // Reject known invalid CPFs - tin === '11111111111' - || tin === '22222222222' - || tin === '33333333333' - || tin === '44444444444' - || tin === '55555555555' - || tin === '66666666666' - || tin === '77777777777' - || tin === '88888888888' - || tin === '99999999999' - || tin === '00000000000' - ) return false; - - for (let i = 1; i <= 9; i++) sum += parseInt(tin.substring(i - 1, i), 10) * (11 - i); + if ( + // Reject known invalid CPFs + tin === '11111111111' || + tin === '22222222222' || + tin === '33333333333' || + tin === '44444444444' || + tin === '55555555555' || + tin === '66666666666' || + tin === '77777777777' || + tin === '88888888888' || + tin === '99999999999' || + tin === '00000000000' + ) + return false; + + for (let i = 1; i <= 9; i++) + sum += parseInt(tin.substring(i - 1, i), 10) * (11 - i); remainder = (sum * 10) % 11; if (remainder === 10) remainder = 0; if (remainder !== parseInt(tin.substring(9, 10), 10)) return false; sum = 0; - for (let i = 1; i <= 10; i++) sum += parseInt(tin.substring(i - 1, i), 10) * (12 - i); + for (let i = 1; i <= 10; i++) + sum += parseInt(tin.substring(i - 1, i), 10) * (12 - i); remainder = (sum * 10) % 11; if (remainder === 10) remainder = 0; if (remainder !== parseInt(tin.substring(10, 11), 10)) return false; @@ -946,17 +1141,21 @@ function ptBrCheck(tin) { return true; } - if ( // Reject know invalid CNPJs - tin === '00000000000000' - || tin === '11111111111111' - || tin === '22222222222222' - || tin === '33333333333333' - || tin === '44444444444444' - || tin === '55555555555555' - || tin === '66666666666666' - || tin === '77777777777777' - || tin === '88888888888888' - || tin === '99999999999999') { return false; } + if ( + // Reject know invalid CNPJs + tin === '00000000000000' || + tin === '11111111111111' || + tin === '22222222222222' || + tin === '33333333333333' || + tin === '44444444444444' || + tin === '55555555555555' || + tin === '66666666666666' || + tin === '77777777777777' || + tin === '88888888888888' || + tin === '99999999999999' + ) { + return false; + } let length = tin.length - 2; let identifiers = tin.substring(0, length); @@ -967,10 +1166,14 @@ function ptBrCheck(tin) { for (let i = length; i >= 1; i--) { sum += identifiers.charAt(length - i) * pos; pos -= 1; - if (pos < 2) { pos = 9; } + if (pos < 2) { + pos = 9; + } } let result = sum % 11 < 2 ? 0 : 11 - (sum % 11); - if (result !== parseInt(verificators.charAt(0), 10)) { return false; } + if (result !== parseInt(verificators.charAt(0), 10)) { + return false; + } length += 1; identifiers = tin.substring(0, length); @@ -979,10 +1182,14 @@ function ptBrCheck(tin) { for (let i = length; i >= 1; i--) { sum += identifiers.charAt(length - i) * pos; pos -= 1; - if (pos < 2) { pos = 9; } + if (pos < 2) { + pos = 9; + } } result = sum % 11 < 2 ? 0 : 11 - (sum % 11); - if (result !== parseInt(verificators.charAt(1), 10)) { return false; } + if (result !== parseInt(verificators.charAt(1), 10)) { + return false; + } return true; } @@ -993,8 +1200,19 @@ function ptBrCheck(tin) { * Verify TIN validity by calculating check (last) digit (variant of MOD 11) */ function ptPtCheck(tin) { - let checksum = 11 - (algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 8).map((a) => parseInt(a, 10)), 9) % 11); - if (checksum > 9) { return parseInt(tin[8], 10) === 0; } + let checksum = + 11 - + (algorithms.reverseMultiplyAndSum( + tin + .split('') + .slice(0, 8) + .map((a) => parseInt(a, 10)), + 9, + ) % + 11); + if (checksum > 9) { + return parseInt(tin[8], 10) === 0; + } return checksum === parseInt(tin[8], 10); } @@ -1007,7 +1225,8 @@ function ptPtCheck(tin) { * `https://en.wikipedia.org/wiki/National_identification_number#Romania` */ function roRoCheck(tin) { - if (tin.slice(0, 4) !== '9000') { // No test found for this format + if (tin.slice(0, 4) !== '9000') { + // No test found for this format // Extract full year using century digit if possible let full_year = tin.slice(1, 3); switch (tin[0]) { @@ -1029,8 +1248,12 @@ function roRoCheck(tin) { // Check date validity const date = `${full_year}/${tin.slice(3, 5)}/${tin.slice(5, 7)}`; if (date.length === 8) { - if (!isDate(date, 'YY/MM/DD')) { return false; } - } else if (!isDate(date, 'YYYY/MM/DD')) { return false; } + if (!isDate(date, 'YY/MM/DD')) { + return false; + } + } else if (!isDate(date, 'YYYY/MM/DD')) { + return false; + } // Calculate check digit const digits = tin.split('').map((a) => parseInt(a, 10)); @@ -1039,7 +1262,9 @@ function roRoCheck(tin) { for (let i = 0; i < multipliers.length; i++) { checksum += digits[i] * multipliers[i]; } - if (checksum % 11 === 10) { return digits[12] === 1; } + if (checksum % 11 === 10) { + return digits[12] === 1; + } return digits[12] === checksum % 11; } return true; @@ -1055,11 +1280,15 @@ function roRoCheck(tin) { function skSkCheck(tin) { if (tin.length === 9) { tin = tin.replace(/\W/, ''); - if (tin.slice(6) === '000') { return false; } // Three-zero serial not assigned before 1954 + if (tin.slice(6) === '000') { + return false; + } // Three-zero serial not assigned before 1954 // Extract full year from TIN length let full_year = parseInt(tin.slice(0, 2), 10); - if (full_year > 53) { return false; } + if (full_year > 53) { + return false; + } if (full_year < 10) { full_year = `190${full_year}`; } else { @@ -1071,11 +1300,15 @@ function skSkCheck(tin) { if (month > 50) { month -= 50; } - if (month < 10) { month = `0${month}`; } + if (month < 10) { + month = `0${month}`; + } // Check date validity const date = `${full_year}/${month}/${tin.slice(4, 6)}`; - if (!isDate(date, 'YYYY/MM/DD')) { return false; } + if (!isDate(date, 'YYYY/MM/DD')) { + return false; + } } return true; } @@ -1086,8 +1319,19 @@ function skSkCheck(tin) { * Verify TIN validity by calculating check (last) digit (variant of MOD 11) */ function slSiCheck(tin) { - let checksum = 11 - (algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 7).map((a) => parseInt(a, 10)), 8) % 11); - if (checksum === 10) { return parseInt(tin[7], 10) === 0; } + let checksum = + 11 - + (algorithms.reverseMultiplyAndSum( + tin + .split('') + .slice(0, 7) + .map((a) => parseInt(a, 10)), + 8, + ) % + 11); + if (checksum === 10) { + return parseInt(tin[7], 10) === 0; + } return checksum === parseInt(tin[7], 10); } @@ -1125,18 +1369,28 @@ function svSeCheck(tin) { } } else { full_year = `${current_century - 1}${full_year}`; - if (current_year - parseInt(full_year, 10) < 100) { return false; } + if (current_year - parseInt(full_year, 10) < 100) { + return false; + } } } } // Normalize day and check date validity - if (day > 60) { day -= 60; } - if (day < 10) { day = `0${day}`; } + if (day > 60) { + day -= 60; + } + if (day < 10) { + day = `0${day}`; + } const date = `${full_year}/${month}/${day}`; if (date.length === 8) { - if (!isDate(date, 'YY/MM/DD')) { return false; } - } else if (!isDate(date, 'YYYY/MM/DD')) { return false; } + if (!isDate(date, 'YY/MM/DD')) { + return false; + } + } else if (!isDate(date, 'YYYY/MM/DD')) { + return false; + } return algorithms.luhnCheck(tin.replace(/\W/, '')); } @@ -1158,7 +1412,8 @@ const taxIdFormat = { 'el-CY': /^[09]\d{7}[A-Z]$/, '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, + 'en-GB': + /^\d{10}$|^(?!GB|NK|TN|ZZ)(?![DFIQUV])[A-Z](?![DFIQUVO])[A-Z]\d{6}[ABCD ]$/i, 'en-IE': /^\d{7}[A-W][A-IW]{0,1}$/i, 'en-US': /^\d{2}[- ]{0,1}\d{7}$/, 'es-AR': /(20|23|24|27|30|33|34)[0-9]{8}[0-9]/, @@ -1170,7 +1425,8 @@ const taxIdFormat = { 'fr-LU': /^\d{13}$/, 'hr-HR': /^\d{11}$/, 'hu-HU': /^8\d{9}$/, - 'it-IT': /^[A-Z]{6}[L-NP-V0-9]{2}[A-EHLMPRST][L-NP-V0-9]{2}[A-ILMZ][L-NP-V0-9]{3}[A-Z]$/i, + 'it-IT': + /^[A-Z]{6}[L-NP-V0-9]{2}[A-EHLMPRST][L-NP-V0-9]{2}[A-ILMZ][L-NP-V0-9]{3}[A-Z]$/i, 'lv-LV': /^\d{6}-{0,1}\d{5}$/, // Conforms both to DG TAXUD spec and original research 'mt-MT': /^\d{3,7}[APMGLHBZ]$|^([1-8])\1\d{7}$/i, 'nl-NL': /^\d{9}$/, diff --git a/src/lib/isURL.js b/src/lib/isURL.js index 2fe9bf344..05a50c542 100644 --- a/src/lib/isURL.js +++ b/src/lib/isURL.js @@ -66,7 +66,10 @@ export default function isURL(url, options) { return false; } - if (!options.allow_query_components && (url.includes('?') || url.includes('&'))) { + if ( + !options.allow_query_components && + (url.includes('?') || url.includes('&')) + ) { return false; } @@ -81,7 +84,10 @@ export default function isURL(url, options) { split = url.split('://'); if (split.length > 1) { protocol = split.shift().toLowerCase(); - if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) { + if ( + options.require_valid_protocol && + options.protocols.indexOf(protocol) === -1 + ) { return false; } } else if (options.require_protocol) { diff --git a/src/lib/isVAT.js b/src/lib/isVAT.js index f0a1a057a..640044340 100644 --- a/src/lib/isVAT.js +++ b/src/lib/isVAT.js @@ -1,5 +1,5 @@ -import assertString from "./util/assertString.js"; -import * as algorithms from "./util/algorithms.js"; +import assertString from './util/assertString.js'; +import * as algorithms from './util/algorithms.js'; const CH = (str) => { // @see {@link https://www.ech.ch/de/ech/ech-0097/5.2.0} @@ -17,7 +17,7 @@ const CH = (str) => { // @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 + str, ) && hasValidCheckNumber(str.match(/\d/g).map((el) => +el)) ); }; @@ -34,10 +34,10 @@ const PT = (str) => { 11 - (algorithms.reverseMultiplyAndSum( tin - .split("") + .split('') .slice(0, 8) .map((a) => parseInt(a, 10)), - 9 + 9, ) % 11); if (checksum > 9) { @@ -72,7 +72,7 @@ export const vatMatchers = { NL: (str) => /^(NL)?\d{9}B\d{2}$/.test(str), PL: (str) => /^(PL)?(\d{10}|(\d{3}-\d{3}-\d{2}-\d{2})|(\d{3}-\d{2}-\d{2}-\d{3}))$/.test( - str + str, ), PT, RO: (str) => /^(RO)?\d{2,10}$/.test(str), @@ -108,7 +108,7 @@ export const vatMatchers = { UA: (str) => /^(UA)?\d{12}$/.test(str), GB: (str) => /^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 + str, ), UZ: (str) => /^(UZ)?\d{9}$/.test(str), @@ -119,7 +119,7 @@ export const vatMatchers = { BO: (str) => /^(BO)?\d{7}$/.test(str), BR: (str) => /^(BR)?((\d{2}.\d{3}.\d{3}\/\d{4}-\d{2})|(\d{3}.\d{3}.\d{3}-\d{2}))$/.test( - str + str, ), CL: (str) => /^(CL)?\d{8}-\d{1}$/.test(str), CO: (str) => /^(CO)?\d{10}$/.test(str), @@ -135,7 +135,7 @@ export const vatMatchers = { PE: (str) => /^(PE)?\d{11}$/.test(str), DO: (str) => /^(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 + str, ), UY: (str) => /^(UY)?\d{12}$/.test(str), VE: (str) => /^(VE)?[J,G,V,E]{1}-(\d{9}|(\d{8}-\d{1}))$/.test(str), diff --git a/src/lib/ltrim.js b/src/lib/ltrim.js index ea2de0975..e13391002 100644 --- a/src/lib/ltrim.js +++ b/src/lib/ltrim.js @@ -3,6 +3,8 @@ import assertString from './util/assertString.js'; export default function ltrim(str, chars) { assertString(str); // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Escaping - const pattern = chars ? new RegExp(`^[${chars.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}]+`, 'g') : /^\s+/g; + const pattern = chars + ? new RegExp(`^[${chars.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}]+`, 'g') + : /^\s+/g; return str.replace(pattern, ''); } diff --git a/src/lib/normalizeEmail.js b/src/lib/normalizeEmail.js index e7cd094a9..129162582 100644 --- a/src/lib/normalizeEmail.js +++ b/src/lib/normalizeEmail.js @@ -41,10 +41,7 @@ const default_normalize_email_options = { }; // List of domains used by iCloud -const icloud_domains = [ - 'icloud.com', - 'me.com', -]; +const icloud_domains = ['icloud.com', 'me.com']; // List of domains used by Outlook.com and its predecessors // This list is likely incomplete. @@ -220,7 +217,10 @@ export default function normalizeEmail(email, options) { // Address is Yahoo if (options.yahoo_remove_subaddress) { let components = parts[0].split('-'); - parts[0] = (components.length > 1) ? components.slice(0, -1).join('-') : components[0]; + parts[0] = + components.length > 1 + ? components.slice(0, -1).join('-') + : components[0]; } if (!parts[0].length) { return false; diff --git a/src/lib/rtrim.js b/src/lib/rtrim.js index d66b0d641..bace9516d 100644 --- a/src/lib/rtrim.js +++ b/src/lib/rtrim.js @@ -4,7 +4,10 @@ export default function rtrim(str, chars) { assertString(str); if (chars) { // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Escaping - const pattern = new RegExp(`[${chars.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}]+$`, 'g'); + const pattern = new RegExp( + `[${chars.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}]+$`, + 'g', + ); return str.replace(pattern, ''); } // Use a faster and more safe than regex trim method https://blog.stevenlevithan.com/archives/faster-trim-javascript diff --git a/src/lib/stripLow.js b/src/lib/stripLow.js index 34024ff32..6e07f9e11 100644 --- a/src/lib/stripLow.js +++ b/src/lib/stripLow.js @@ -4,6 +4,8 @@ import blacklist from './blacklist.js'; export default function stripLow(str, keep_new_lines) { assertString(str); - const chars = keep_new_lines ? '\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F' : '\\x00-\\x1F\\x7F'; + const chars = keep_new_lines + ? '\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F' + : '\\x00-\\x1F\\x7F'; return blacklist(str, chars); } diff --git a/src/lib/unescape.js b/src/lib/unescape.js index 0c166e5e9..b9275626a 100644 --- a/src/lib/unescape.js +++ b/src/lib/unescape.js @@ -2,14 +2,15 @@ import assertString from './util/assertString.js'; export default function unescape(str) { assertString(str); - return (str.replace(/"/g, '"') + return str + .replace(/"/g, '"') .replace(/'/g, "'") .replace(/</g, '<') .replace(/>/g, '>') .replace(///g, '/') .replace(/\/g, '\\') .replace(/`/g, '`') - .replace(/&/g, '&')); + .replace(/&/g, '&'); // & replacement has to be the last one to prevent // bugs with intermediate strings containing escape sequences // See: https://github.com/validatorjs/validator.js/issues/1827 diff --git a/src/lib/util/algorithms.js b/src/lib/util/algorithms.js index d5eee6390..a8fb361a6 100644 --- a/src/lib/util/algorithms.js +++ b/src/lib/util/algorithms.js @@ -11,8 +11,10 @@ export function iso7064Check(str) { let checkvalue = 10; for (let i = 0; i < str.length - 1; i++) { - checkvalue = (parseInt(str[i], 10) + checkvalue) % 10 === 0 ? (10 * 2) % 11 - : (((parseInt(str[i], 10) + checkvalue) % 10) * 2) % 11; + checkvalue = + (parseInt(str[i], 10) + checkvalue) % 10 === 0 + ? (10 * 2) % 11 + : (((parseInt(str[i], 10) + checkvalue) % 10) * 2) % 11; } checkvalue = checkvalue === 1 ? 0 : 11 - checkvalue; return checkvalue === parseInt(str[10], 10); @@ -31,7 +33,11 @@ export function luhnCheck(str) { const product = parseInt(str[i], 10) * 2; if (product > 9) { // sum digits of product and add to checksum - checksum += product.toString().split('').map((a) => parseInt(a, 10)).reduce((a, b) => a + b, 0); + checksum += product + .toString() + .split('') + .map((a) => parseInt(a, 10)) + .reduce((a, b) => a + b, 0); } else { checksum += product; } diff --git a/src/lib/util/merge.js b/src/lib/util/merge.js index 2f03bc203..1abfb5656 100644 --- a/src/lib/util/merge.js +++ b/src/lib/util/merge.js @@ -1,5 +1,5 @@ // eslint-disable-next-line default-param-last -export default function merge(obj = { }, defaults) { +export default function merge(obj = {}, defaults) { for (const key in defaults) { if (typeof obj[key] === 'undefined') { obj[key] = defaults[key]; diff --git a/src/lib/util/toString.js b/src/lib/util/toString.js index fe4563b35..439030173 100644 --- a/src/lib/util/toString.js +++ b/src/lib/util/toString.js @@ -5,7 +5,11 @@ export default function toString(input) { } else { input = '[object Object]'; } - } else if (input === null || typeof input === 'undefined' || (isNaN(input) && !input.length)) { + } else if ( + input === null || + typeof input === 'undefined' || + (isNaN(input) && !input.length) + ) { input = ''; } return String(input); diff --git a/test/clientSide.test.js b/test/clientSide.test.js index a98fe3251..17d6de2d5 100644 --- a/test/clientSide.test.js +++ b/test/clientSide.test.js @@ -1,36 +1,36 @@ /* eslint-disable import/no-extraneous-dependencies */ -import assert from "assert"; -import { describe, it } from "vitest"; -import validator from "../validator.js"; -import min from "../validator.min.js"; +import assert from 'assert'; +import { describe, it } from 'vitest'; +import validator from '../validator.js'; +import min from '../validator.min.js'; -describe("Minified version", () => { - it("should export the same things as the server-side version", () => { +describe('Minified version', () => { + it('should export the same things as the server-side version', () => { for (let key in validator) { if ({}.hasOwnProperty.call(validator, key)) { assert.strictEqual( typeof validator[key], typeof min[key], - `Minified version did not export ${key}` + `Minified version did not export ${key}`, ); } } }); - it("should be up to date", () => { + it('should be up to date', () => { assert.strictEqual( min.version, validator.version, - "Minified version mismatch. Run `make min`" + 'Minified version mismatch. Run `make min`', ); }); - it("should validate strings", () => { - assert.strictEqual(min.isEmail("foo@bar.com"), true); - assert.strictEqual(min.isEmail("foo"), false); + it('should validate strings', () => { + assert.strictEqual(min.isEmail('foo@bar.com'), true); + assert.strictEqual(min.isEmail('foo'), false); }); - it("should sanitize strings", () => { - assert.strictEqual(min.toBoolean("1"), true); + it('should sanitize strings', () => { + assert.strictEqual(min.toBoolean('1'), true); }); }); diff --git a/test/exports.test.js b/test/exports.test.js index cba278ee9..832920a5a 100644 --- a/test/exports.test.js +++ b/test/exports.test.js @@ -28,32 +28,32 @@ describe('Exports', () => { assert.strictEqual( validator.version, require('../package.json').version, - 'Version number mismatch in "package.json" vs. "validator.js"' + 'Version number mismatch in "package.json" vs. "validator.js"', ); /* eslint-enable global-require */ }); - it('should export isPostalCode\'s supported locales', () => { + it("should export isPostalCode's supported locales", () => { assert.ok(isPostalCodeLocales instanceof Array); assert.ok(validator.isPostalCodeLocales instanceof Array); }); - it('should export isAlpha\'s supported locales', () => { + it("should export isAlpha's supported locales", () => { assert.ok(isAlphaLocales instanceof Array); assert.ok(validator.isAlphaLocales instanceof Array); }); - it('should export isAlphanumeric\'s supported locales', () => { + it("should export isAlphanumeric's supported locales", () => { assert.ok(isAlphanumericLocales instanceof Array); assert.ok(validator.isAlphanumericLocales instanceof Array); }); - it('should export isMobilePhone\'s supported locales', () => { + it("should export isMobilePhone's supported locales", () => { assert.ok(isMobilePhoneLocales instanceof Array); assert.ok(validator.isMobilePhoneLocales instanceof Array); }); - it('should export isFloat\'s supported locales', () => { + it("should export isFloat's supported locales", () => { assert.ok(isFloatLocales instanceof Array); assert.ok(validator.isFloatLocales instanceof Array); }); diff --git a/test/sanitizers.test.js b/test/sanitizers.test.js index eeeae44ee..9d00e504d 100644 --- a/test/sanitizers.test.js +++ b/test/sanitizers.test.js @@ -22,7 +22,7 @@ function test(options) { options.sanitizer, args.join(', '), result, - expected + expected, ); throw new Error(warning); @@ -162,16 +162,14 @@ describe('Sanitizers', () => { sanitizer: 'escape', expect: { '': - '<script> alert("xss&fun"); </script>', + '<script> alert("xss&fun"); </script>', "": - '<script> alert('xss&fun'); </script>', + '<script> alert('xss&fun'); </script>', - 'Backtick: `': - 'Backtick: `', + 'Backtick: `': 'Backtick: `', - 'Backslash: \\': - 'Backslash: \', + 'Backslash: \\': 'Backslash: \', }, }); }); @@ -181,16 +179,14 @@ describe('Sanitizers', () => { sanitizer: 'unescape', expect: { '<script> alert("xss&fun"); </script>': - '', + '', '<script> alert('xss&fun'); </script>': - "", + "", - 'Backtick: `': - 'Backtick: `', + 'Backtick: `': 'Backtick: `', - 'Escaped string: &lt;': - 'Escaped string: <', + 'Escaped string: &lt;': 'Escaped string: <', }, }); }); @@ -256,15 +252,17 @@ describe('Sanitizers', () => { it('should score passwords', () => { test({ sanitizer: 'isStrongPassword', - args: [{ - returnScore: true, - pointsPerUnique: 1, - pointsPerRepeat: 0.5, - pointsForContainingLower: 10, - pointsForContainingUpper: 10, - pointsForContainingNumber: 10, - pointsForContainingSymbol: 10, - }], + args: [ + { + returnScore: true, + pointsPerUnique: 1, + pointsPerRepeat: 0.5, + pointsForContainingLower: 10, + pointsForContainingUpper: 10, + pointsForContainingNumber: 10, + pointsForContainingSymbol: 10, + }, + ], expect: { abc: 13, abcc: 13.5, @@ -298,13 +296,18 @@ describe('Sanitizers', () => { 'some.name@googleMail.com': 'somename@gmail.com', 'some.name+extension@gmail.com': 'somename@gmail.com', 'some.Name+extension@GoogleMail.com': 'somename@gmail.com', - 'some.name.middleName+extension@gmail.com': 'somenamemiddlename@gmail.com', - 'some.name.middleName+extension@GoogleMail.com': 'somenamemiddlename@gmail.com', - 'some.name.midd.leNa.me.+extension@gmail.com': 'somenamemiddlename@gmail.com', - 'some.name.midd.leNa.me.+extension@GoogleMail.com': 'somenamemiddlename@gmail.com', + 'some.name.middleName+extension@gmail.com': + 'somenamemiddlename@gmail.com', + 'some.name.middleName+extension@GoogleMail.com': + 'somenamemiddlename@gmail.com', + 'some.name.midd.leNa.me.+extension@gmail.com': + 'somenamemiddlename@gmail.com', + 'some.name.midd.leNa.me.+extension@GoogleMail.com': + 'somenamemiddlename@gmail.com', 'some.name+extension@unknown.com': 'some.name+extension@unknown.com', 'hans@m端ller.com': 'hans@m端ller.com', - 'some.name.midd..leNa...me...+extension@GoogleMail.com': 'somenamemidd..lena...me...@gmail.com', + 'some.name.midd..leNa...me...+extension@GoogleMail.com': + 'somenamemidd..lena...me...@gmail.com', 'matthew..example@gmail.com': 'matthew..example@gmail.com', '"foo@bar"@baz.com': '"foo@bar"@baz.com', 'test@ya.ru': 'test@yandex.ru', @@ -333,8 +336,10 @@ describe('Sanitizers', () => { 'TEST@me.com': 'test@me.com', 'TEST@ME.COM': 'test@me.com', 'SOME.name@GMAIL.com': 'somename@gmail.com', - 'SOME.name.middleName+extension@GoogleMail.com': 'somenamemiddlename@gmail.com', - 'SOME.name.midd.leNa.me.+extension@gmail.com': 'somenamemiddlename@gmail.com', + 'SOME.name.middleName+extension@GoogleMail.com': + 'somenamemiddlename@gmail.com', + 'SOME.name.midd.leNa.me.+extension@gmail.com': + 'somenamemiddlename@gmail.com', 'SOME.name@gmail.com': 'somename@gmail.com', 'SOME.name@yahoo.ca': 'some.name@yahoo.ca', 'SOME.name@outlook.ie': 'some.name@outlook.ie', @@ -346,14 +351,16 @@ describe('Sanitizers', () => { // Testing *_lowercase test({ sanitizer: 'normalizeEmail', - args: [{ - all_lowercase: false, - gmail_lowercase: false, - icloud_lowercase: false, - outlookdotcom_lowercase: false, - yahoo_lowercase: false, - yandex_lowercase: false, - }], + args: [ + { + all_lowercase: false, + gmail_lowercase: false, + icloud_lowercase: false, + outlookdotcom_lowercase: false, + yahoo_lowercase: false, + yandex_lowercase: false, + }, + ], expect: { 'TEST@FOO.COM': 'TEST@foo.com', // all_lowercase 'ME@gMAil.com': 'ME@gmail.com', // gmail_lowercase @@ -370,13 +377,15 @@ describe('Sanitizers', () => { // Should overwrite all the *_lowercase options test({ sanitizer: 'normalizeEmail', - args: [{ - all_lowercase: true, - gmail_lowercase: false, // Overruled - icloud_lowercase: false, // Overruled - outlookdotcom_lowercase: false, // Overruled - yahoo_lowercase: false, // Overruled - }], + args: [ + { + all_lowercase: true, + gmail_lowercase: false, // Overruled + icloud_lowercase: false, // Overruled + outlookdotcom_lowercase: false, // Overruled + yahoo_lowercase: false, // Overruled + }, + ], expect: { 'TEST@FOO.COM': 'test@foo.com', // all_lowercase 'ME@gMAil.com': 'me@gmail.com', // gmail_lowercase @@ -391,9 +400,11 @@ describe('Sanitizers', () => { // Testing *_remove_dots test({ sanitizer: 'normalizeEmail', - args: [{ - gmail_remove_dots: false, - }], + args: [ + { + gmail_remove_dots: false, + }, + ], expect: { 'SOME.name@GMAIL.com': 'some.name@gmail.com', 'SOME.name+me@GMAIL.com': 'some.name@gmail.com', @@ -403,9 +414,11 @@ describe('Sanitizers', () => { test({ sanitizer: 'normalizeEmail', - args: [{ - gmail_remove_dots: true, - }], + args: [ + { + gmail_remove_dots: true, + }, + ], expect: { 'SOME.name@GMAIL.com': 'somename@gmail.com', 'SOME.name+me@GMAIL.com': 'somename@gmail.com', @@ -417,12 +430,14 @@ describe('Sanitizers', () => { // Testing *_remove_subaddress test({ sanitizer: 'normalizeEmail', - args: [{ - gmail_remove_subaddress: false, - icloud_remove_subaddress: false, - outlookdotcom_remove_subaddress: false, - yahoo_remove_subaddress: false, // Note Yahoo uses "-" - }], + args: [ + { + gmail_remove_subaddress: false, + icloud_remove_subaddress: false, + outlookdotcom_remove_subaddress: false, + yahoo_remove_subaddress: false, // Note Yahoo uses "-" + }, + ], expect: { 'foo+bar@unknown.com': 'foo+bar@unknown.com', 'foo+bar@gmail.com': 'foo+bar@gmail.com', // gmail_remove_subaddress @@ -437,12 +452,14 @@ describe('Sanitizers', () => { test({ sanitizer: 'normalizeEmail', - args: [{ - gmail_remove_subaddress: true, - icloud_remove_subaddress: true, - outlookdotcom_remove_subaddress: true, - yahoo_remove_subaddress: true, // Note Yahoo uses "-" - }], + args: [ + { + gmail_remove_subaddress: true, + icloud_remove_subaddress: true, + outlookdotcom_remove_subaddress: true, + yahoo_remove_subaddress: true, // Note Yahoo uses "-" + }, + ], expect: { 'foo+bar@unknown.com': 'foo+bar@unknown.com', 'foo+bar@gmail.com': 'foo@gmail.com', // gmail_remove_subaddress @@ -458,9 +475,11 @@ describe('Sanitizers', () => { // Testing gmail_convert_googlemaildotcom test({ sanitizer: 'normalizeEmail', - args: [{ - gmail_convert_googlemaildotcom: false, - }], + args: [ + { + gmail_convert_googlemaildotcom: false, + }, + ], expect: { 'SOME.name@GMAIL.com': 'somename@gmail.com', 'SOME.name+me@GMAIL.com': 'somename@gmail.com', @@ -473,9 +492,11 @@ describe('Sanitizers', () => { test({ sanitizer: 'normalizeEmail', - args: [{ - gmail_convert_googlemaildotcom: true, - }], + args: [ + { + gmail_convert_googlemaildotcom: true, + }, + ], expect: { 'SOME.name@GMAIL.com': 'somename@gmail.com', 'SOME.name+me@GMAIL.com': 'somename@gmail.com', diff --git a/test/testFunctions.js b/test/testFunctions.js index dd9860393..53f561016 100644 --- a/test/testFunctions.js +++ b/test/testFunctions.js @@ -1,6 +1,6 @@ -import assert from "assert"; -import { format } from "util"; -import validator from "../src/index.js"; +import assert from 'assert'; +import { format } from 'util'; +import validator from '../src/index.js'; export default function test(options) { const args = options.args || []; @@ -15,9 +15,9 @@ export default function test(options) { assert.throws(() => validator[options.validator](...args)); } catch (err) { const warning = format( - "validator.%s(%s) passed but should error", + 'validator.%s(%s) passed but should error', options.validator, - args.join(", ") + args.join(', '), ); throw new Error(warning); @@ -31,9 +31,9 @@ export default function test(options) { if (validator[options.validator](...args) !== true) { const warning = format( - "validator.%s(%s) failed but should have passed", + 'validator.%s(%s) failed but should have passed', options.validator, - args.join(", ") + args.join(', '), ); throw new Error(warning); @@ -47,9 +47,9 @@ export default function test(options) { if (validator[options.validator](...args) !== false) { const warning = format( - "validator.%s(%s) passed but should have failed", + 'validator.%s(%s) passed but should have failed', options.validator, - args.join(", ") + args.join(', '), ); throw new Error(warning); diff --git a/test/validators.test.js b/test/validators.test.js index 80cf21ab6..34687df63 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -1,1217 +1,1217 @@ /* eslint-disable import/no-extraneous-dependencies */ -import assert from "assert"; -import fs from "fs"; -import path from "path"; -import timezone_mock from "timezone-mock"; -import { format } from "util"; -import { describe, it } from "vitest"; -import vm from "vm"; -import validator from "../src/index.js"; -import test from "./testFunctions.js"; +import assert from 'assert'; +import fs from 'fs'; +import path from 'path'; +import timezone_mock from 'timezone-mock'; +import { format } from 'util'; +import { describe, it } from 'vitest'; +import vm from 'vm'; +import validator from '../src/index.js'; +import test from './testFunctions.js'; const dirname = path.dirname(new URL(import.meta.url).pathname); let validator_js = fs - .readFileSync(path.join(dirname, "..", "validator.js")) + .readFileSync(path.join(dirname, '..', 'validator.js')) .toString(); -describe("Validators", () => { - it("should validate email addresses", () => { +describe('Validators', () => { + it('should validate email addresses', () => { test({ - validator: "isEmail", + validator: 'isEmail', valid: [ - "foo@bar.com", - "x@x.au", - "foo@bar.com.au", - "foo+bar@bar.com", - "hans.m端ller@test.com", - "hans@m端ller.com", - "test|123@m端ller.com", - "test123+ext@gmail.com", - "some.name.midd.leNa.me.and.locality+extension@GoogleMail.com", + 'foo@bar.com', + 'x@x.au', + 'foo@bar.com.au', + 'foo+bar@bar.com', + 'hans.m端ller@test.com', + 'hans@m端ller.com', + 'test|123@m端ller.com', + 'test123+ext@gmail.com', + 'some.name.midd.leNa.me.and.locality+extension@GoogleMail.com', '"foobar"@example.com', '" foo m端ller "@example.com', '"foo\\@bar"@example.com', - `${"a".repeat(64)}@${"a".repeat(63)}.com`, - `${"a".repeat(64)}@${"a".repeat(63)}.com`, - `${"a".repeat(31)}@gmail.com`, - "test@gmail.com", - "test.1@gmail.com", - "test@1337.com", - ], - invalid: [ - "invalidemail@", - "invalid.com", - "@invalid.com", - "foo@bar.com.", - "foo@_bar.com", - "somename@gmail.com", - "foo@bar.co.uk.", - "z@co.c", - "gmailgmailgmailgmailgmail@gmail.com", - `${"a".repeat(64)}@${"a".repeat(251)}.com`, - `${"a".repeat(65)}@${"a".repeat(250)}.com`, - `${"a".repeat(64)}@${"a".repeat(64)}.com`, - `${"a".repeat(64)}@${"a".repeat(63)}.${"a".repeat(63)}.${"a".repeat( - 63 - )}.${"a".repeat(58)}.com`, - "test1@invalid.co m", - "test2@invalid.co m", - "test3@invalid.co m", - "test4@invalid.co m", - "test5@invalid.co m", - "test6@invalid.co m", - "test7@invalid.co m", - "test8@invalid.co m", - "test9@invalid.co m", - "test10@invalid.co m", - "test11@invalid.co m", - "test12@invalid.co m", - "test13@invalid.co m", - "multiple..dots@stillinvalid.com", - "test123+invalid! sub_address@gmail.com", - "gmail...ignores...dots...@gmail.com", - "ends.with.dot.@gmail.com", - "multiple..dots@gmail.com", + `${'a'.repeat(64)}@${'a'.repeat(63)}.com`, + `${'a'.repeat(64)}@${'a'.repeat(63)}.com`, + `${'a'.repeat(31)}@gmail.com`, + 'test@gmail.com', + 'test.1@gmail.com', + 'test@1337.com', + ], + invalid: [ + 'invalidemail@', + 'invalid.com', + '@invalid.com', + 'foo@bar.com.', + 'foo@_bar.com', + 'somename@gmail.com', + 'foo@bar.co.uk.', + 'z@co.c', + 'gmailgmailgmailgmailgmail@gmail.com', + `${'a'.repeat(64)}@${'a'.repeat(251)}.com`, + `${'a'.repeat(65)}@${'a'.repeat(250)}.com`, + `${'a'.repeat(64)}@${'a'.repeat(64)}.com`, + `${'a'.repeat(64)}@${'a'.repeat(63)}.${'a'.repeat(63)}.${'a'.repeat( + 63, + )}.${'a'.repeat(58)}.com`, + 'test1@invalid.co m', + 'test2@invalid.co m', + 'test3@invalid.co m', + 'test4@invalid.co m', + 'test5@invalid.co m', + 'test6@invalid.co m', + 'test7@invalid.co m', + 'test8@invalid.co m', + 'test9@invalid.co m', + 'test10@invalid.co m', + 'test11@invalid.co m', + 'test12@invalid.co m', + 'test13@invalid.co m', + 'multiple..dots@stillinvalid.com', + 'test123+invalid! sub_address@gmail.com', + 'gmail...ignores...dots...@gmail.com', + 'ends.with.dot.@gmail.com', + 'multiple..dots@gmail.com', 'wrong()[]",:;<>@@gmail.com', '"wrong()[]",:;<>@@gmail.com', - "username@domain.com�", - "username@domain.com©", - "nbsp test@test.com", - "nbsp_test@te st.com", - "nbsp_test@test.co m", + 'username@domain.com�', + 'username@domain.com©', + 'nbsp test@test.com', + 'nbsp_test@te st.com', + 'nbsp_test@test.co m', ], }); }); - it("should validate email addresses with domain specific validation", () => { + it('should validate email addresses with domain specific validation', () => { test({ - validator: "isEmail", + validator: 'isEmail', args: [{ domain_specific_validation: true }], valid: [ - "foobar@gmail.com", - "foo.bar@gmail.com", - "foo.bar@googlemail.com", - `${"a".repeat(30)}@gmail.com`, + 'foobar@gmail.com', + 'foo.bar@gmail.com', + 'foo.bar@googlemail.com', + `${'a'.repeat(30)}@gmail.com`, ], invalid: [ - `${"a".repeat(31)}@gmail.com`, - "test@gmail.com", - "test.1@gmail.com", - ".foobar@gmail.com", + `${'a'.repeat(31)}@gmail.com`, + 'test@gmail.com', + 'test.1@gmail.com', + '.foobar@gmail.com', ], }); }); - it("should validate email addresses with underscores in the domain", () => { + it('should validate email addresses with underscores in the domain', () => { test({ - validator: "isEmail", + validator: 'isEmail', args: [{ allow_underscores: true }], - valid: ["foobar@my_sarisari_store.typepad.com"], + valid: ['foobar@my_sarisari_store.typepad.com'], invalid: [], }); }); - it("should validate email addresses without UTF8 characters in local part", () => { + it('should validate email addresses without UTF8 characters in local part', () => { test({ - validator: "isEmail", + validator: 'isEmail', args: [{ allow_utf8_local_part: false }], valid: [ - "foo@bar.com", - "x@x.au", - "foo@bar.com.au", - "foo+bar@bar.com", - "hans@m端ller.com", - "test|123@m端ller.com", - "test123+ext@gmail.com", - "some.name.midd.leNa.me+extension@GoogleMail.com", + 'foo@bar.com', + 'x@x.au', + 'foo@bar.com.au', + 'foo+bar@bar.com', + 'hans@m端ller.com', + 'test|123@m端ller.com', + 'test123+ext@gmail.com', + 'some.name.midd.leNa.me+extension@GoogleMail.com', '"foobar"@example.com', '"foo\\@bar"@example.com', '" foo bar "@example.com', ], invalid: [ - "invalidemail@", - "invalid.com", - "@invalid.com", - "foo@bar.com.", - "foo@bar.co.uk.", - "somename@gmail.com", - "hans.m端ller@test.com", - "z@co.c", - "tüst@invalid.com", - "nbsp test@test.com", + 'invalidemail@', + 'invalid.com', + '@invalid.com', + 'foo@bar.com.', + 'foo@bar.co.uk.', + 'somename@gmail.com', + 'hans.m端ller@test.com', + 'z@co.c', + 'tüst@invalid.com', + 'nbsp test@test.com', ], }); }); - it("should validate email addresses with display names", () => { + it('should validate email addresses with display names', () => { test({ - validator: "isEmail", + validator: 'isEmail', args: [{ allow_display_name: true }], valid: [ - "foo@bar.com", - "x@x.au", - "foo@bar.com.au", - "foo+bar@bar.com", - "hans.m端ller@test.com", - "hans@m端ller.com", - "test|123@m端ller.com", - "test123+ext@gmail.com", - "some.name.midd.leNa.me+extension@GoogleMail.com", - "Some Name ", - "Some Name ", - "Some Name ", - "Some Name ", - "Some Name ", - "Some Name ", - "Some Name ", - "Some Name ", + 'foo@bar.com', + 'x@x.au', + 'foo@bar.com.au', + 'foo+bar@bar.com', + 'hans.m端ller@test.com', + 'hans@m端ller.com', + 'test|123@m端ller.com', + 'test123+ext@gmail.com', + 'some.name.midd.leNa.me+extension@GoogleMail.com', + 'Some Name ', + 'Some Name ', + 'Some Name ', + 'Some Name ', + 'Some Name ', + 'Some Name ', + 'Some Name ', + 'Some Name ', "'Foo Bar, Esq'", - "Some Name ", - "Some Middle Name ", - "Name ", - "Name", - "Some Name ", - "Name🍓With🍑Emoji🚴‍♀️🏆", - "🍇🍗🍑", + 'Some Name ', + 'Some Middle Name ', + 'Name ', + 'Name', + 'Some Name ', + 'Name🍓With🍑Emoji🚴‍♀️🏆', + '🍇🍗🍑', '""', '"\\"quotes\\""', '"name;"', '"name;" ', ], invalid: [ - "invalidemail@", - "invalid.com", - "@invalid.com", - "foo@bar.com.", - "foo@bar.co.uk.", - "Some Name ", - "Some Name ", - "Some Name <@invalid.com>", - "Some Name ", - "Some Name ", - "Some Name foo@bar.co.uk.>", - "Some Name ", - "Name foo@bar.co.uk", - "Some Name ", - "Some Name", - "invisibleCharacter\u001F", - "", + 'invalidemail@', + 'invalid.com', + '@invalid.com', + 'foo@bar.com.', + 'foo@bar.co.uk.', + 'Some Name ', + 'Some Name ', + 'Some Name <@invalid.com>', + 'Some Name ', + 'Some Name ', + 'Some Name foo@bar.co.uk.>', + 'Some Name ', + 'Name foo@bar.co.uk', + 'Some Name ', + 'Some Name', + 'invisibleCharacter\u001F', + '', '\\"quotes\\"', '""quotes""', - "name;", - " ", + 'name;', + ' ', '" "', ], }); }); - it("should validate email addresses with required display names", () => { + it('should validate email addresses with required display names', () => { test({ - validator: "isEmail", + validator: 'isEmail', args: [{ require_display_name: true }], valid: [ - "Some Name ", - "Some Name ", - "Some Name ", - "Some Name ", - "Some Name ", - "Some Name ", - "Some Name ", - "Some Name ", - "Some Name ", - "Some Middle Name ", - "Name ", - "Name", - ], - invalid: [ - "some.name.midd.leNa.me+extension@GoogleMail.com", - "foo@bar.com", - "x@x.au", - "foo@bar.com.au", - "foo+bar@bar.com", - "hans.m端ller@test.com", - "hans@m端ller.com", - "test|123@m端ller.com", - "test123+ext@gmail.com", - "invalidemail@", - "invalid.com", - "@invalid.com", - "foo@bar.com.", - "foo@bar.co.uk.", - "Some Name ", - "Some Name ", - "Some Name <@invalid.com>", - "Some Name ", - "Some Name ", - "Some Name foo@bar.co.uk.>", - "Some Name ", - "Name foo@bar.co.uk", - ], - }); - }); - - it("should validate email addresses with allowed IPs", () => { - test({ - validator: "isEmail", + 'Some Name ', + 'Some Name ', + 'Some Name ', + 'Some Name ', + 'Some Name ', + 'Some Name ', + 'Some Name ', + 'Some Name ', + 'Some Name ', + 'Some Middle Name ', + 'Name ', + 'Name', + ], + invalid: [ + 'some.name.midd.leNa.me+extension@GoogleMail.com', + 'foo@bar.com', + 'x@x.au', + 'foo@bar.com.au', + 'foo+bar@bar.com', + 'hans.m端ller@test.com', + 'hans@m端ller.com', + 'test|123@m端ller.com', + 'test123+ext@gmail.com', + 'invalidemail@', + 'invalid.com', + '@invalid.com', + 'foo@bar.com.', + 'foo@bar.co.uk.', + 'Some Name ', + 'Some Name ', + 'Some Name <@invalid.com>', + 'Some Name ', + 'Some Name ', + 'Some Name foo@bar.co.uk.>', + 'Some Name ', + 'Name foo@bar.co.uk', + ], + }); + }); + + it('should validate email addresses with allowed IPs', () => { + test({ + validator: 'isEmail', args: [{ allow_ip_domain: true }], - valid: ["email@[123.123.123.123]", "email@255.255.255.255"], + valid: ['email@[123.123.123.123]', 'email@255.255.255.255'], invalid: [ - "email@0.0.0.256", - "email@26.0.0.256", - "email@[266.266.266.266]", + 'email@0.0.0.256', + 'email@26.0.0.256', + 'email@[266.266.266.266]', ], }); }); - it("should not validate email addresses with blacklisted chars in the name", () => { + it('should not validate email addresses with blacklisted chars in the name', () => { test({ - validator: "isEmail", - args: [{ blacklisted_chars: "abc" }], - valid: ["emil@gmail.com"], - invalid: ["email@gmail.com"], + validator: 'isEmail', + args: [{ blacklisted_chars: 'abc' }], + valid: ['emil@gmail.com'], + invalid: ['email@gmail.com'], }); }); - it("should validate really long emails if ignore_max_length is set", () => { + it('should validate really long emails if ignore_max_length is set', () => { test({ - validator: "isEmail", + validator: 'isEmail', args: [{ ignore_max_length: false }], valid: [], invalid: [ - "Deleted-user-id-19430-Team-5051deleted-user-id-19430-team-5051XXXXXX@example.com", + 'Deleted-user-id-19430-Team-5051deleted-user-id-19430-team-5051XXXXXX@example.com', ], }); test({ - validator: "isEmail", + validator: 'isEmail', args: [{ ignore_max_length: true }], valid: [ - "Deleted-user-id-19430-Team-5051deleted-user-id-19430-team-5051XXXXXX@example.com", + 'Deleted-user-id-19430-Team-5051deleted-user-id-19430-team-5051XXXXXX@example.com', ], invalid: [], }); test({ - validator: "isEmail", + validator: 'isEmail', args: [{ ignore_max_length: true }], valid: [ - "Deleted-user-id-19430-Team-5051deleted-user-id-19430-team-5051XXXXXX@Deleted-user-id-19430-Team-5051deleted-user-id-19430-team-5051XXXXXX.com", + 'Deleted-user-id-19430-Team-5051deleted-user-id-19430-team-5051XXXXXX@Deleted-user-id-19430-Team-5051deleted-user-id-19430-team-5051XXXXXX.com', ], invalid: [], }); }); - it("should not validate email addresses with denylisted domains", () => { + it('should not validate email addresses with denylisted domains', () => { test({ - validator: "isEmail", - args: [{ host_blacklist: ["gmail.com", "foo.bar.com"] }], - valid: ["email@foo.gmail.com"], - invalid: ["foo+bar@gmail.com", "email@foo.bar.com"], + validator: 'isEmail', + args: [{ host_blacklist: ['gmail.com', 'foo.bar.com'] }], + valid: ['email@foo.gmail.com'], + invalid: ['foo+bar@gmail.com', 'email@foo.bar.com'], }); }); - it("should validate only email addresses with whitelisted domains", () => { + it('should validate only email addresses with whitelisted domains', () => { test({ - validator: "isEmail", - args: [{ host_whitelist: ["gmail.com", "foo.bar.com"] }], - valid: ["email@gmail.com", "test@foo.bar.com"], - invalid: ["foo+bar@test.com", "email@foo.com", "email@bar.com"], + validator: 'isEmail', + args: [{ host_whitelist: ['gmail.com', 'foo.bar.com'] }], + valid: ['email@gmail.com', 'test@foo.bar.com'], + invalid: ['foo+bar@test.com', 'email@foo.com', 'email@bar.com'], }); }); - it("should validate URLs", () => { + it('should validate URLs', () => { test({ - validator: "isURL", + validator: 'isURL', valid: [ - "foobar.com", - "www.foobar.com", - "foobar.com/", - "valid.au", - "http://www.foobar.com/", - "HTTP://WWW.FOOBAR.COM/", - "https://www.foobar.com/", - "HTTPS://WWW.FOOBAR.COM/", - "http://www.foobar.com:23/", - "http://www.foobar.com:65535/", - "http://www.foobar.com:5/", - "https://www.foobar.com/", - "ftp://www.foobar.com/", - "http://www.foobar.com/~foobar", - "http://user:pass@www.foobar.com/", - "http://user:@www.foobar.com/", - "http://:pass@www.foobar.com/", - "http://user@www.foobar.com", - "http://127.0.0.1/", - "http://10.0.0.0/", - "http://189.123.14.13/", - "http://duckduckgo.com/?q=%2F", + 'foobar.com', + 'www.foobar.com', + 'foobar.com/', + 'valid.au', + 'http://www.foobar.com/', + 'HTTP://WWW.FOOBAR.COM/', + 'https://www.foobar.com/', + 'HTTPS://WWW.FOOBAR.COM/', + 'http://www.foobar.com:23/', + 'http://www.foobar.com:65535/', + 'http://www.foobar.com:5/', + 'https://www.foobar.com/', + 'ftp://www.foobar.com/', + 'http://www.foobar.com/~foobar', + 'http://user:pass@www.foobar.com/', + 'http://user:@www.foobar.com/', + 'http://:pass@www.foobar.com/', + 'http://user@www.foobar.com', + 'http://127.0.0.1/', + 'http://10.0.0.0/', + 'http://189.123.14.13/', + 'http://duckduckgo.com/?q=%2F', "http://foobar.com/t$-_.+!*'(),", - "http://foobar.com/?foo=bar#baz=qux", - "http://foobar.com?foo=bar", - "http://foobar.com#baz=qux", - "http://www.xn--froschgrn-x9a.net/", - "http://xn--froschgrn-x9a.com/", - "http://foo--bar.com", - "http://høyfjellet.no", - "http://xn--j1aac5a4g.xn--j1amh", - "http://xn------eddceddeftq7bvv7c4ke4c.xn--p1ai", - "http://кулік.укр", - "test.com?ref=http://test2.com", - "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html", - "http://[1080:0:0:0:8:800:200C:417A]/index.html", - "http://[3ffe:2a00:100:7031::1]", - "http://[1080::8:800:200C:417A]/foo", - "http://[::192.9.5.5]/ipng", - "http://[::FFFF:129.144.52.38]:80/index.html", - "http://[2010:836B:4179::836B:4179]", - "http://example.com/example.json#/foo/bar", - "http://1337.com", - ], - invalid: [ - "http://localhost:3000/", - "//foobar.com", - "xyz://foobar.com", - "invalid/", - "invalid.x", - "invalid.", - ".com", - "http://com/", - "http://300.0.0.1/", - "mailto:foo@bar.com", - "rtmp://foobar.com", - "http://www.xn--.com/", - "http://xn--.com/", - "http://www.foobar.com:0/", - "http://www.foobar.com:70000/", - "http://www.foobar.com:99999/", - "http://www.-foobar.com/", - "http://www.foobar-.com/", - "http://foobar/# lol", - "http://foobar/? lol", - "http://foobar/ lol/", - "http://lol @foobar.com/", - "http://lol:lol @foobar.com/", - "http://lol:lol:lol@foobar.com/", - "http://lol: @foobar.com/", - "http://www.foo_bar.com/", - "http://www.foobar.com/\t", - "http://@foobar.com", - "http://:@foobar.com", - "http://\n@www.foobar.com/", - "", - `http://foobar.com/${new Array(2083).join("f")}`, - "http://*.foo.com", - "*.foo.com", - "!.foo.com", - "http://example.com.", - "http://localhost:61500this is an invalid url!!!!", - "////foobar.com", - "http:////foobar.com", + 'http://foobar.com/?foo=bar#baz=qux', + 'http://foobar.com?foo=bar', + 'http://foobar.com#baz=qux', + 'http://www.xn--froschgrn-x9a.net/', + 'http://xn--froschgrn-x9a.com/', + 'http://foo--bar.com', + 'http://høyfjellet.no', + 'http://xn--j1aac5a4g.xn--j1amh', + 'http://xn------eddceddeftq7bvv7c4ke4c.xn--p1ai', + 'http://кулік.укр', + 'test.com?ref=http://test2.com', + 'http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html', + 'http://[1080:0:0:0:8:800:200C:417A]/index.html', + 'http://[3ffe:2a00:100:7031::1]', + 'http://[1080::8:800:200C:417A]/foo', + 'http://[::192.9.5.5]/ipng', + 'http://[::FFFF:129.144.52.38]:80/index.html', + 'http://[2010:836B:4179::836B:4179]', + 'http://example.com/example.json#/foo/bar', + 'http://1337.com', + ], + invalid: [ + 'http://localhost:3000/', + '//foobar.com', + 'xyz://foobar.com', + 'invalid/', + 'invalid.x', + 'invalid.', + '.com', + 'http://com/', + 'http://300.0.0.1/', + 'mailto:foo@bar.com', + 'rtmp://foobar.com', + 'http://www.xn--.com/', + 'http://xn--.com/', + 'http://www.foobar.com:0/', + 'http://www.foobar.com:70000/', + 'http://www.foobar.com:99999/', + 'http://www.-foobar.com/', + 'http://www.foobar-.com/', + 'http://foobar/# lol', + 'http://foobar/? lol', + 'http://foobar/ lol/', + 'http://lol @foobar.com/', + 'http://lol:lol @foobar.com/', + 'http://lol:lol:lol@foobar.com/', + 'http://lol: @foobar.com/', + 'http://www.foo_bar.com/', + 'http://www.foobar.com/\t', + 'http://@foobar.com', + 'http://:@foobar.com', + 'http://\n@www.foobar.com/', + '', + `http://foobar.com/${new Array(2083).join('f')}`, + 'http://*.foo.com', + '*.foo.com', + '!.foo.com', + 'http://example.com.', + 'http://localhost:61500this is an invalid url!!!!', + '////foobar.com', + 'http:////foobar.com', "https://example.com/foo//", ], }); }); - it("should validate URLs with custom protocols", () => { + it('should validate URLs with custom protocols', () => { test({ - validator: "isURL", + validator: 'isURL', args: [ { - protocols: ["rtmp"], + protocols: ['rtmp'], }, ], - valid: ["rtmp://foobar.com"], - invalid: ["http://foobar.com"], + valid: ['rtmp://foobar.com'], + invalid: ['http://foobar.com'], }); }); - it("should validate file URLs without a host", () => { + it('should validate file URLs without a host', () => { test({ - validator: "isURL", + validator: 'isURL', args: [ { - protocols: ["file"], + protocols: ['file'], require_host: false, require_tld: false, }, ], - valid: ["file://localhost/foo.txt", "file:///foo.txt", "file:///"], - invalid: ["http://foobar.com", "file://"], + valid: ['file://localhost/foo.txt', 'file:///foo.txt', 'file:///'], + invalid: ['http://foobar.com', 'file://'], }); }); - it("should validate postgres URLs without a host", () => { + it('should validate postgres URLs without a host', () => { test({ - validator: "isURL", + validator: 'isURL', args: [ { - protocols: ["postgres"], + protocols: ['postgres'], require_host: false, }, ], - valid: ["postgres://user:pw@/test"], - invalid: ["http://foobar.com", "postgres://"], + valid: ['postgres://user:pw@/test'], + invalid: ['http://foobar.com', 'postgres://'], }); }); - it("should validate URLs with any protocol", () => { + it('should validate URLs with any protocol', () => { test({ - validator: "isURL", + validator: 'isURL', args: [ { require_valid_protocol: false, }, ], - valid: ["rtmp://foobar.com", "http://foobar.com", "test://foobar.com"], - invalid: ["mailto:test@example.com"], + valid: ['rtmp://foobar.com', 'http://foobar.com', 'test://foobar.com'], + invalid: ['mailto:test@example.com'], }); }); - it("should validate URLs with underscores", () => { + it('should validate URLs with underscores', () => { test({ - validator: "isURL", + validator: 'isURL', args: [ { allow_underscores: true, }, ], valid: [ - "http://foo_bar.com", - "http://pr.example_com.294.example.com/", - "http://foo__bar.com", - "http://_.example.com", + 'http://foo_bar.com', + 'http://pr.example_com.294.example.com/', + 'http://foo__bar.com', + 'http://_.example.com', ], invalid: [], }); }); - it("should validate URLs that do not have a TLD", () => { + it('should validate URLs that do not have a TLD', () => { test({ - validator: "isURL", + validator: 'isURL', args: [ { require_tld: false, }, ], valid: [ - "http://foobar.com/", - "http://foobar/", - "http://localhost/", - "foobar/", - "foobar", + 'http://foobar.com/', + 'http://foobar/', + 'http://localhost/', + 'foobar/', + 'foobar', ], invalid: [], }); }); - it("should validate URLs with a trailing dot option", () => { + it('should validate URLs with a trailing dot option', () => { test({ - validator: "isURL", + validator: 'isURL', args: [ { allow_trailing_dot: true, require_tld: false, }, ], - valid: ["http://example.com.", "foobar."], + valid: ['http://example.com.', 'foobar.'], }); }); - it("should validate URLs with column and no port", () => { + it('should validate URLs with column and no port', () => { test({ - validator: "isURL", - valid: ["http://example.com:", "ftp://example.com:"], - invalid: ["https://example.com:abc"], + validator: 'isURL', + valid: ['http://example.com:', 'ftp://example.com:'], + invalid: ['https://example.com:abc'], }); }); - it("should validate sftp protocol URL containing column and no port", () => { + it('should validate sftp protocol URL containing column and no port', () => { test({ - validator: "isURL", + validator: 'isURL', args: [ { - protocols: ["sftp"], + protocols: ['sftp'], }, ], - valid: ["sftp://user:pass@terminal.aws.test.nl:/incoming/things.csv"], + valid: ['sftp://user:pass@terminal.aws.test.nl:/incoming/things.csv'], }); }); - it("should validate protocol relative URLs", () => { + it('should validate protocol relative URLs', () => { test({ - validator: "isURL", + validator: 'isURL', args: [ { allow_protocol_relative_urls: true, }, ], - valid: ["//foobar.com", "http://foobar.com", "foobar.com"], + valid: ['//foobar.com', 'http://foobar.com', 'foobar.com'], invalid: [ - "://foobar.com", - "/foobar.com", - "////foobar.com", - "http:////foobar.com", + '://foobar.com', + '/foobar.com', + '////foobar.com', + 'http:////foobar.com', ], }); }); - it("should not validate URLs with fragments when allow fragments is false", () => { + it('should not validate URLs with fragments when allow fragments is false', () => { test({ - validator: "isURL", + validator: 'isURL', args: [ { allow_fragments: false, }, ], - valid: ["http://foobar.com", "foobar.com"], - invalid: ["http://foobar.com#part", "foobar.com#part"], + valid: ['http://foobar.com', 'foobar.com'], + invalid: ['http://foobar.com#part', 'foobar.com#part'], }); }); - it("should not validate URLs with query components when allow query components is false", () => { + it('should not validate URLs with query components when allow query components is false', () => { test({ - validator: "isURL", + validator: 'isURL', args: [ { allow_query_components: false, }, ], - valid: ["http://foobar.com", "foobar.com"], + valid: ['http://foobar.com', 'foobar.com'], invalid: [ - "http://foobar.com?foo=bar", - "http://foobar.com?foo=bar&bar=foo", - "foobar.com?foo=bar", - "foobar.com?foo=bar&bar=foo", + 'http://foobar.com?foo=bar', + 'http://foobar.com?foo=bar&bar=foo', + 'foobar.com?foo=bar', + 'foobar.com?foo=bar&bar=foo', ], }); }); - it("should not validate protocol relative URLs when require protocol is true", () => { + it('should not validate protocol relative URLs when require protocol is true', () => { test({ - validator: "isURL", + validator: 'isURL', args: [ { allow_protocol_relative_urls: true, require_protocol: true, }, ], - valid: ["http://foobar.com"], - invalid: ["//foobar.com", "://foobar.com", "/foobar.com", "foobar.com"], + valid: ['http://foobar.com'], + invalid: ['//foobar.com', '://foobar.com', '/foobar.com', 'foobar.com'], }); }); - it("should let users specify whether URLs require a protocol", () => { + it('should let users specify whether URLs require a protocol', () => { test({ - validator: "isURL", + validator: 'isURL', args: [ { require_protocol: true, }, ], - valid: ["http://foobar.com/"], - invalid: ["http://localhost/", "foobar.com", "foobar"], + valid: ['http://foobar.com/'], + invalid: ['http://localhost/', 'foobar.com', 'foobar'], }); }); - it("should let users specify a host whitelist", () => { + it('should let users specify a host whitelist', () => { test({ - validator: "isURL", + validator: 'isURL', args: [ { - host_whitelist: ["foo.com", "bar.com"], + host_whitelist: ['foo.com', 'bar.com'], }, ], - valid: ["http://bar.com/", "http://foo.com/"], - invalid: ["http://foobar.com", "http://foo.bar.com/", "http://qux.com"], + valid: ['http://bar.com/', 'http://foo.com/'], + invalid: ['http://foobar.com', 'http://foo.bar.com/', 'http://qux.com'], }); }); - it("should allow regular expressions in the host whitelist", () => { + it('should allow regular expressions in the host whitelist', () => { test({ - validator: "isURL", + validator: 'isURL', args: [ { - host_whitelist: ["bar.com", "foo.com", /\.foo\.com$/], + host_whitelist: ['bar.com', 'foo.com', /\.foo\.com$/], }, ], valid: [ - "http://bar.com/", - "http://foo.com/", - "http://images.foo.com/", - "http://cdn.foo.com/", - "http://a.b.c.foo.com/", + 'http://bar.com/', + 'http://foo.com/', + 'http://images.foo.com/', + 'http://cdn.foo.com/', + 'http://a.b.c.foo.com/', ], - invalid: ["http://foobar.com", "http://foo.bar.com/", "http://qux.com"], + invalid: ['http://foobar.com', 'http://foo.bar.com/', 'http://qux.com'], }); }); - it("should let users specify a host blacklist", () => { + it('should let users specify a host blacklist', () => { test({ - validator: "isURL", + validator: 'isURL', args: [ { - host_blacklist: ["foo.com", "bar.com"], + host_blacklist: ['foo.com', 'bar.com'], }, ], - valid: ["http://foobar.com", "http://foo.bar.com/", "http://qux.com"], - invalid: ["http://bar.com/", "http://foo.com/"], + valid: ['http://foobar.com', 'http://foo.bar.com/', 'http://qux.com'], + invalid: ['http://bar.com/', 'http://foo.com/'], }); }); - it("should allow regular expressions in the host blacklist", () => { + it('should allow regular expressions in the host blacklist', () => { test({ - validator: "isURL", + validator: 'isURL', args: [ { - host_blacklist: ["bar.com", "foo.com", /\.foo\.com$/], + host_blacklist: ['bar.com', 'foo.com', /\.foo\.com$/], }, ], - valid: ["http://foobar.com", "http://foo.bar.com/", "http://qux.com"], + valid: ['http://foobar.com', 'http://foo.bar.com/', 'http://qux.com'], invalid: [ - "http://bar.com/", - "http://foo.com/", - "http://images.foo.com/", - "http://cdn.foo.com/", - "http://a.b.c.foo.com/", + 'http://bar.com/', + 'http://foo.com/', + 'http://images.foo.com/', + 'http://cdn.foo.com/', + 'http://a.b.c.foo.com/', ], }); }); - it("should allow rejecting urls containing authentication information", () => { + it('should allow rejecting urls containing authentication information', () => { test({ - validator: "isURL", + validator: 'isURL', args: [{ disallow_auth: true }], - valid: ["doe.com"], - invalid: ["john@doe.com", "john:john@doe.com"], + valid: ['doe.com'], + invalid: ['john@doe.com', 'john:john@doe.com'], }); }); - it("should accept urls containing authentication information", () => { + it('should accept urls containing authentication information', () => { test({ - validator: "isURL", + validator: 'isURL', args: [{ disallow_auth: false }], valid: [ - "user@example.com", - "user:@example.com", - "user:password@example.com", + 'user@example.com', + 'user:@example.com', + 'user:password@example.com', ], invalid: [ - "user:user:password@example.com", - "@example.com", - ":@example.com", - ":example.com", + 'user:user:password@example.com', + '@example.com', + ':@example.com', + ':example.com', ], }); }); - it("should allow user to skip URL length validation", () => { + it('should allow user to skip URL length validation', () => { test({ - validator: "isURL", + validator: 'isURL', args: [{ validate_length: false }], valid: [ - "http://foobar.com/f", - `http://foobar.com/${new Array(2083).join("f")}`, + 'http://foobar.com/f', + `http://foobar.com/${new Array(2083).join('f')}`, ], invalid: [], }); }); - it("should validate URLs with port present", () => { + it('should validate URLs with port present', () => { test({ - validator: "isURL", + validator: 'isURL', args: [{ require_port: true }], valid: [ - "http://user:pass@www.foobar.com:1", - "http://user:@www.foobar.com:65535", - "http://127.0.0.1:23", - "http://10.0.0.0:256", - "http://189.123.14.13:256", - "http://duckduckgo.com:65535?q=%2F", - ], - invalid: [ - "http://user:pass@www.foobar.com/", - "http://user:@www.foobar.com/", - "http://127.0.0.1/", - "http://10.0.0.0/", - "http://189.123.14.13/", - "http://duckduckgo.com/?q=%2F", - ], - }); - }); - - it("should validate MAC addresses", () => { - test({ - validator: "isMACAddress", - valid: [ - "ab:ab:ab:ab:ab:ab", - "FF:FF:FF:FF:FF:FF", - "01:02:03:04:05:ab", - "01:AB:03:04:05:06", - "A9 C5 D4 9F EB D3", - "01 02 03 04 05 ab", - "01-02-03-04-05-ab", - "0102.0304.05ab", - "ab:ab:ab:ab:ab:ab:ab:ab", - "FF:FF:FF:FF:FF:FF:FF:FF", - "01:02:03:04:05:06:07:ab", - "01:AB:03:04:05:06:07:08", - "A9 C5 D4 9F EB D3 B6 65", - "01 02 03 04 05 06 07 ab", - "01-02-03-04-05-06-07-ab", - "0102.0304.0506.07ab", - ], - invalid: [ - "abc", - "01:02:03:04:05", - "01:02:03:04:05:z0", - "01:02:03:04::ab", - "1:2:3:4:5:6", - "AB:CD:EF:GH:01:02", - "A9C5 D4 9F EB D3", - "01-02 03:04 05 ab", - "0102.03:04.05ab", - "900f/dffs/sdea", - "01:02:03:04:05:06:07", - "01:02:03:04:05:06:07:z0", - "01:02:03:04:05:06::ab", - "1:2:3:4:5:6:7:8", - "AB:CD:EF:GH:01:02:03:04", - "A9C5 D4 9F EB D3 B6 65", - "01-02 03:04 05 06 07 ab", - "0102.03:04.0506.07ab", - "900f/dffs/sdea/54gh", - ], - }); - test({ - validator: "isMACAddress", + 'http://user:pass@www.foobar.com:1', + 'http://user:@www.foobar.com:65535', + 'http://127.0.0.1:23', + 'http://10.0.0.0:256', + 'http://189.123.14.13:256', + 'http://duckduckgo.com:65535?q=%2F', + ], + invalid: [ + 'http://user:pass@www.foobar.com/', + 'http://user:@www.foobar.com/', + 'http://127.0.0.1/', + 'http://10.0.0.0/', + 'http://189.123.14.13/', + 'http://duckduckgo.com/?q=%2F', + ], + }); + }); + + it('should validate MAC addresses', () => { + test({ + validator: 'isMACAddress', + valid: [ + 'ab:ab:ab:ab:ab:ab', + 'FF:FF:FF:FF:FF:FF', + '01:02:03:04:05:ab', + '01:AB:03:04:05:06', + 'A9 C5 D4 9F EB D3', + '01 02 03 04 05 ab', + '01-02-03-04-05-ab', + '0102.0304.05ab', + 'ab:ab:ab:ab:ab:ab:ab:ab', + 'FF:FF:FF:FF:FF:FF:FF:FF', + '01:02:03:04:05:06:07:ab', + '01:AB:03:04:05:06:07:08', + 'A9 C5 D4 9F EB D3 B6 65', + '01 02 03 04 05 06 07 ab', + '01-02-03-04-05-06-07-ab', + '0102.0304.0506.07ab', + ], + invalid: [ + 'abc', + '01:02:03:04:05', + '01:02:03:04:05:z0', + '01:02:03:04::ab', + '1:2:3:4:5:6', + 'AB:CD:EF:GH:01:02', + 'A9C5 D4 9F EB D3', + '01-02 03:04 05 ab', + '0102.03:04.05ab', + '900f/dffs/sdea', + '01:02:03:04:05:06:07', + '01:02:03:04:05:06:07:z0', + '01:02:03:04:05:06::ab', + '1:2:3:4:5:6:7:8', + 'AB:CD:EF:GH:01:02:03:04', + 'A9C5 D4 9F EB D3 B6 65', + '01-02 03:04 05 06 07 ab', + '0102.03:04.0506.07ab', + '900f/dffs/sdea/54gh', + ], + }); + test({ + validator: 'isMACAddress', args: [ { - eui: "48", + eui: '48', }, ], valid: [ - "ab:ab:ab:ab:ab:ab", - "FF:FF:FF:FF:FF:FF", - "01:02:03:04:05:ab", - "01:AB:03:04:05:06", - "A9 C5 D4 9F EB D3", - "01 02 03 04 05 ab", - "01-02-03-04-05-ab", - "0102.0304.05ab", + 'ab:ab:ab:ab:ab:ab', + 'FF:FF:FF:FF:FF:FF', + '01:02:03:04:05:ab', + '01:AB:03:04:05:06', + 'A9 C5 D4 9F EB D3', + '01 02 03 04 05 ab', + '01-02-03-04-05-ab', + '0102.0304.05ab', ], invalid: [ - "ab:ab:ab:ab:ab:ab:ab:ab", - "FF:FF:FF:FF:FF:FF:FF:FF", - "01:02:03:04:05:06:07:ab", - "01:AB:03:04:05:06:07:08", - "A9 C5 D4 9F EB D3 B6 65", - "01 02 03 04 05 06 07 ab", - "01-02-03-04-05-06-07-ab", - "0102.0304.0506.07ab", + 'ab:ab:ab:ab:ab:ab:ab:ab', + 'FF:FF:FF:FF:FF:FF:FF:FF', + '01:02:03:04:05:06:07:ab', + '01:AB:03:04:05:06:07:08', + 'A9 C5 D4 9F EB D3 B6 65', + '01 02 03 04 05 06 07 ab', + '01-02-03-04-05-06-07-ab', + '0102.0304.0506.07ab', ], }); test({ - validator: "isMACAddress", + validator: 'isMACAddress', args: [ { - eui: "64", + eui: '64', }, ], valid: [ - "ab:ab:ab:ab:ab:ab:ab:ab", - "FF:FF:FF:FF:FF:FF:FF:FF", - "01:02:03:04:05:06:07:ab", - "01:AB:03:04:05:06:07:08", - "A9 C5 D4 9F EB D3 B6 65", - "01 02 03 04 05 06 07 ab", - "01-02-03-04-05-06-07-ab", - "0102.0304.0506.07ab", + 'ab:ab:ab:ab:ab:ab:ab:ab', + 'FF:FF:FF:FF:FF:FF:FF:FF', + '01:02:03:04:05:06:07:ab', + '01:AB:03:04:05:06:07:08', + 'A9 C5 D4 9F EB D3 B6 65', + '01 02 03 04 05 06 07 ab', + '01-02-03-04-05-06-07-ab', + '0102.0304.0506.07ab', ], invalid: [ - "ab:ab:ab:ab:ab:ab", - "FF:FF:FF:FF:FF:FF", - "01:02:03:04:05:ab", - "01:AB:03:04:05:06", - "A9 C5 D4 9F EB D3", - "01 02 03 04 05 ab", - "01-02-03-04-05-ab", - "0102.0304.05ab", + 'ab:ab:ab:ab:ab:ab', + 'FF:FF:FF:FF:FF:FF', + '01:02:03:04:05:ab', + '01:AB:03:04:05:06', + 'A9 C5 D4 9F EB D3', + '01 02 03 04 05 ab', + '01-02-03-04-05-ab', + '0102.0304.05ab', ], }); }); - it("should validate MAC addresses without separator", () => { + it('should validate MAC addresses without separator', () => { test({ - validator: "isMACAddress", + validator: 'isMACAddress', args: [ { no_separators: true, }, ], valid: [ - "abababababab", - "FFFFFFFFFFFF", - "0102030405ab", - "01AB03040506", - "abababababababab", - "FFFFFFFFFFFFFFFF", - "01020304050607ab", - "01AB030405060708", - ], - invalid: [ - "abc", - "01:02:03:04:05", - "01:02:03:04::ab", - "1:2:3:4:5:6", - "AB:CD:EF:GH:01:02", - "ab:ab:ab:ab:ab:ab", - "FF:FF:FF:FF:FF:FF", - "01:02:03:04:05:ab", - "01:AB:03:04:05:06", - "0102030405", - "01020304ab", - "123456", - "ABCDEFGH0102", - "01:02:03:04:05:06:07", - "01:02:03:04:05:06::ab", - "1:2:3:4:5:6:7:8", - "AB:CD:EF:GH:01:02:03:04", - "ab:ab:ab:ab:ab:ab:ab:ab", - "FF:FF:FF:FF:FF:FF:FF:FF", - "01:02:03:04:05:06:07:ab", - "01:AB:03:04:05:06:07:08", - "01020304050607", - "010203040506ab", - "12345678", - "ABCDEFGH01020304", - ], - }); - test({ - validator: "isMACAddress", + 'abababababab', + 'FFFFFFFFFFFF', + '0102030405ab', + '01AB03040506', + 'abababababababab', + 'FFFFFFFFFFFFFFFF', + '01020304050607ab', + '01AB030405060708', + ], + invalid: [ + 'abc', + '01:02:03:04:05', + '01:02:03:04::ab', + '1:2:3:4:5:6', + 'AB:CD:EF:GH:01:02', + 'ab:ab:ab:ab:ab:ab', + 'FF:FF:FF:FF:FF:FF', + '01:02:03:04:05:ab', + '01:AB:03:04:05:06', + '0102030405', + '01020304ab', + '123456', + 'ABCDEFGH0102', + '01:02:03:04:05:06:07', + '01:02:03:04:05:06::ab', + '1:2:3:4:5:6:7:8', + 'AB:CD:EF:GH:01:02:03:04', + 'ab:ab:ab:ab:ab:ab:ab:ab', + 'FF:FF:FF:FF:FF:FF:FF:FF', + '01:02:03:04:05:06:07:ab', + '01:AB:03:04:05:06:07:08', + '01020304050607', + '010203040506ab', + '12345678', + 'ABCDEFGH01020304', + ], + }); + test({ + validator: 'isMACAddress', args: [ { no_separators: true, - eui: "48", + eui: '48', }, ], - valid: ["abababababab", "FFFFFFFFFFFF", "0102030405ab", "01AB03040506"], + valid: ['abababababab', 'FFFFFFFFFFFF', '0102030405ab', '01AB03040506'], invalid: [ - "abababababababab", - "FFFFFFFFFFFFFFFF", - "01020304050607ab", - "01AB030405060708", + 'abababababababab', + 'FFFFFFFFFFFFFFFF', + '01020304050607ab', + '01AB030405060708', ], }); test({ - validator: "isMACAddress", + validator: 'isMACAddress', args: [ { no_separators: true, - eui: "64", + eui: '64', }, ], valid: [ - "abababababababab", - "FFFFFFFFFFFFFFFF", - "01020304050607ab", - "01AB030405060708", - ], - invalid: ["abababababab", "FFFFFFFFFFFF", "0102030405ab", "01AB03040506"], - }); - }); - - it("should validate IP addresses", () => { - test({ - validator: "isIP", - valid: [ - "127.0.0.1", - "0.0.0.0", - "255.255.255.255", - "1.2.3.4", - "::1", - "2001:db8:0000:1:1:1:1:1", - "2001:db8:3:4::192.0.2.33", - "2001:41d0:2:a141::1", - "::ffff:127.0.0.1", - "::0000", - "0000::", - "1::", - "1111:1:1:1:1:1:1:1", - "fe80::a6db:30ff:fe98:e946", - "::", - "::8", - "::ffff:127.0.0.1", - "::ffff:255.255.255.255", - "::ffff:0:255.255.255.255", - "::2:3:4:5:6:7:8", - "::255.255.255.255", - "0:0:0:0:0:ffff:127.0.0.1", - "1:2:3:4:5:6:7::", - "1:2:3:4:5:6::8", - "1::7:8", - "1:2:3:4:5::7:8", - "1:2:3:4:5::8", - "1::6:7:8", - "1:2:3:4::6:7:8", - "1:2:3:4::8", - "1::5:6:7:8", - "1:2:3::5:6:7:8", - "1:2:3::8", - "1::4:5:6:7:8", - "1:2::4:5:6:7:8", - "1:2::8", - "1::3:4:5:6:7:8", - "1::8", - "fe80::7:8%eth0", - "fe80::7:8%1", - "64:ff9b::192.0.2.33", - "0:0:0:0:0:0:10.0.0.1", - ], - invalid: [ - "abc", - "256.0.0.0", - "0.0.0.256", - "26.0.0.256", - "0200.200.200.200", - "200.0200.200.200", - "200.200.0200.200", - "200.200.200.0200", - "::banana", - "banana::", - "::1banana", - "::1::", - "1:", - ":1", - ":1:1:1::2", - "1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1", - "::11111", - "11111:1:1:1:1:1:1:1", - "2001:db8:0000:1:1:1:1::1", - "0:0:0:0:0:0:ffff:127.0.0.1", - "0:0:0:0:ffff:127.0.0.1", - ], - }); - test({ - validator: "isIP", + 'abababababababab', + 'FFFFFFFFFFFFFFFF', + '01020304050607ab', + '01AB030405060708', + ], + invalid: ['abababababab', 'FFFFFFFFFFFF', '0102030405ab', '01AB03040506'], + }); + }); + + it('should validate IP addresses', () => { + test({ + validator: 'isIP', + valid: [ + '127.0.0.1', + '0.0.0.0', + '255.255.255.255', + '1.2.3.4', + '::1', + '2001:db8:0000:1:1:1:1:1', + '2001:db8:3:4::192.0.2.33', + '2001:41d0:2:a141::1', + '::ffff:127.0.0.1', + '::0000', + '0000::', + '1::', + '1111:1:1:1:1:1:1:1', + 'fe80::a6db:30ff:fe98:e946', + '::', + '::8', + '::ffff:127.0.0.1', + '::ffff:255.255.255.255', + '::ffff:0:255.255.255.255', + '::2:3:4:5:6:7:8', + '::255.255.255.255', + '0:0:0:0:0:ffff:127.0.0.1', + '1:2:3:4:5:6:7::', + '1:2:3:4:5:6::8', + '1::7:8', + '1:2:3:4:5::7:8', + '1:2:3:4:5::8', + '1::6:7:8', + '1:2:3:4::6:7:8', + '1:2:3:4::8', + '1::5:6:7:8', + '1:2:3::5:6:7:8', + '1:2:3::8', + '1::4:5:6:7:8', + '1:2::4:5:6:7:8', + '1:2::8', + '1::3:4:5:6:7:8', + '1::8', + 'fe80::7:8%eth0', + 'fe80::7:8%1', + '64:ff9b::192.0.2.33', + '0:0:0:0:0:0:10.0.0.1', + ], + invalid: [ + 'abc', + '256.0.0.0', + '0.0.0.256', + '26.0.0.256', + '0200.200.200.200', + '200.0200.200.200', + '200.200.0200.200', + '200.200.200.0200', + '::banana', + 'banana::', + '::1banana', + '::1::', + '1:', + ':1', + ':1:1:1::2', + '1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1', + '::11111', + '11111:1:1:1:1:1:1:1', + '2001:db8:0000:1:1:1:1::1', + '0:0:0:0:0:0:ffff:127.0.0.1', + '0:0:0:0:ffff:127.0.0.1', + ], + }); + test({ + validator: 'isIP', args: [4], valid: [ - "127.0.0.1", - "0.0.0.0", - "255.255.255.255", - "1.2.3.4", - "255.0.0.1", - "0.0.1.1", + '127.0.0.1', + '0.0.0.0', + '255.255.255.255', + '1.2.3.4', + '255.0.0.1', + '0.0.1.1', ], invalid: [ - "::1", - "2001:db8:0000:1:1:1:1:1", - "::ffff:127.0.0.1", - "137.132.10.01", - "0.256.0.256", - "255.256.255.256", + '::1', + '2001:db8:0000:1:1:1:1:1', + '::ffff:127.0.0.1', + '137.132.10.01', + '0.256.0.256', + '255.256.255.256', ], }); test({ - validator: "isIP", + validator: 'isIP', args: [6], valid: [ - "::1", - "2001:db8:0000:1:1:1:1:1", - "::ffff:127.0.0.1", - "fe80::1234%1", - "ff08::9abc%10", - "ff08::9abc%interface10", - "ff02::5678%pvc1.3", + '::1', + '2001:db8:0000:1:1:1:1:1', + '::ffff:127.0.0.1', + 'fe80::1234%1', + 'ff08::9abc%10', + 'ff08::9abc%interface10', + 'ff02::5678%pvc1.3', ], invalid: [ - "127.0.0.1", - "0.0.0.0", - "255.255.255.255", - "1.2.3.4", - "::ffff:287.0.0.1", - "%", - "fe80::1234%", - "fe80::1234%1%3%4", - "fe80%fe80%", + '127.0.0.1', + '0.0.0.0', + '255.255.255.255', + '1.2.3.4', + '::ffff:287.0.0.1', + '%', + 'fe80::1234%', + 'fe80::1234%1%3%4', + 'fe80%fe80%', ], }); test({ - validator: "isIP", + validator: 'isIP', args: [10], valid: [], invalid: [ - "127.0.0.1", - "0.0.0.0", - "255.255.255.255", - "1.2.3.4", - "::1", - "2001:db8:0000:1:1:1:1:1", + '127.0.0.1', + '0.0.0.0', + '255.255.255.255', + '1.2.3.4', + '::1', + '2001:db8:0000:1:1:1:1:1', ], }); }); - it("should validate isIPRange", () => { + it('should validate isIPRange', () => { test({ - validator: "isIPRange", + validator: 'isIPRange', valid: [ - "127.0.0.1/24", - "0.0.0.0/0", - "255.255.255.0/32", - "::/0", - "::/128", - "2001::/128", - "2001:800::/128", - "::ffff:127.0.0.1/128", + '127.0.0.1/24', + '0.0.0.0/0', + '255.255.255.0/32', + '::/0', + '::/128', + '2001::/128', + '2001:800::/128', + '::ffff:127.0.0.1/128', ], invalid: [ - "abc", - "127.200.230.1/35", - "127.200.230.1/-1", - "1.1.1.1/011", - "1.1.1/24.1", - "1.1.1.1/01", - "1.1.1.1/1.1", - "1.1.1.1/1.", - "1.1.1.1/1/1", - "1.1.1.1", - "::1", - "::1/164", - "2001::/240", - "2001::/-1", - "2001::/001", - "2001::/24.1", - "2001:db8:0000:1:1:1:1:1", - "::ffff:127.0.0.1", + 'abc', + '127.200.230.1/35', + '127.200.230.1/-1', + '1.1.1.1/011', + '1.1.1/24.1', + '1.1.1.1/01', + '1.1.1.1/1.1', + '1.1.1.1/1.', + '1.1.1.1/1/1', + '1.1.1.1', + '::1', + '::1/164', + '2001::/240', + '2001::/-1', + '2001::/001', + '2001::/24.1', + '2001:db8:0000:1:1:1:1:1', + '::ffff:127.0.0.1', ], }); test({ - validator: "isIPRange", + validator: 'isIPRange', args: [4], valid: [ - "127.0.0.1/1", - "0.0.0.0/1", - "255.255.255.255/1", - "1.2.3.4/1", - "255.0.0.1/1", - "0.0.1.1/1", + '127.0.0.1/1', + '0.0.0.0/1', + '255.255.255.255/1', + '1.2.3.4/1', + '255.0.0.1/1', + '0.0.1.1/1', ], invalid: [ - "abc", - "::1", - "2001:db8:0000:1:1:1:1:1", - "::ffff:127.0.0.1", - "137.132.10.01", - "0.256.0.256", - "255.256.255.256", + 'abc', + '::1', + '2001:db8:0000:1:1:1:1:1', + '::ffff:127.0.0.1', + '137.132.10.01', + '0.256.0.256', + '255.256.255.256', ], }); test({ - validator: "isIPRange", + validator: 'isIPRange', args: [6], - valid: ["::1/1", "2001:db8:0000:1:1:1:1:1/1", "::ffff:127.0.0.1/1"], + valid: ['::1/1', '2001:db8:0000:1:1:1:1:1/1', '::ffff:127.0.0.1/1'], invalid: [ - "abc", - "127.0.0.1", - "0.0.0.0", - "255.255.255.255", - "1.2.3.4", - "::ffff:287.0.0.1", - "::ffff:287.0.0.1/254", - "%", - "fe80::1234%", - "fe80::1234%1%3%4", - "fe80%fe80%", + 'abc', + '127.0.0.1', + '0.0.0.0', + '255.255.255.255', + '1.2.3.4', + '::ffff:287.0.0.1', + '::ffff:287.0.0.1/254', + '%', + 'fe80::1234%', + 'fe80::1234%1%3%4', + 'fe80%fe80%', ], }); test({ - validator: "isIPRange", + validator: 'isIPRange', args: [10], valid: [], invalid: [ - "abc", - "127.0.0.1/1", - "0.0.0.0/1", - "255.255.255.255/1", - "1.2.3.4/1", - "::1/1", - "2001:db8:0000:1:1:1:1:1/1", + 'abc', + '127.0.0.1/1', + '0.0.0.0/1', + '255.255.255.255/1', + '1.2.3.4/1', + '::1/1', + '2001:db8:0000:1:1:1:1:1/1', ], }); }); - it("should validate FQDN", () => { + it('should validate FQDN', () => { test({ - validator: "isFQDN", + validator: 'isFQDN', valid: [ - "domain.com", - "dom.plato", - "a.domain.co", - "foo--bar.com", - "xn--froschgrn-x9a.com", - "rebecca.blackfriday", - "1337.com", + 'domain.com', + 'dom.plato', + 'a.domain.co', + 'foo--bar.com', + 'xn--froschgrn-x9a.com', + 'rebecca.blackfriday', + '1337.com', ], invalid: [ - "abc", - "256.0.0.0", - "_.com", - "*.some.com", - "s!ome.com", - "domain.com/", - "/more.com", - "domain.com�", - "domain.co\u00A0m", - "domain.co\u1680m", - "domain.co\u2006m", - "domain.co\u2028m", - "domain.co\u2029m", - "domain.co\u202Fm", - "domain.co\u205Fm", - "domain.co\u3000m", - "domain.com\uDC00", - "domain.co\uEFFFm", - "domain.co\uFDDAm", - "domain.co\uFFF4m", - "domain.com©", - "example.0", - "192.168.0.9999", - "192.168.0", + 'abc', + '256.0.0.0', + '_.com', + '*.some.com', + 's!ome.com', + 'domain.com/', + '/more.com', + 'domain.com�', + 'domain.co\u00A0m', + 'domain.co\u1680m', + 'domain.co\u2006m', + 'domain.co\u2028m', + 'domain.co\u2029m', + 'domain.co\u202Fm', + 'domain.co\u205Fm', + 'domain.co\u3000m', + 'domain.com\uDC00', + 'domain.co\uEFFFm', + 'domain.co\uFDDAm', + 'domain.co\uFFF4m', + 'domain.com©', + 'example.0', + '192.168.0.9999', + '192.168.0', ], }); }); - it("should validate FQDN with trailing dot option", () => { + it('should validate FQDN with trailing dot option', () => { test({ - validator: "isFQDN", + validator: 'isFQDN', args: [{ allow_trailing_dot: true }], - valid: ["example.com."], + valid: ['example.com.'], }); }); - it("should invalidate FQDN when not require_tld", () => { + it('should invalidate FQDN when not require_tld', () => { test({ - validator: "isFQDN", + validator: 'isFQDN', args: [{ require_tld: false }], - invalid: ["example.0", "192.168.0", "192.168.0.9999"], + invalid: ['example.0', '192.168.0', '192.168.0.9999'], }); }); - it("should validate FQDN when not require_tld but allow_numeric_tld", () => { + it('should validate FQDN when not require_tld but allow_numeric_tld', () => { test({ - validator: "isFQDN", + validator: 'isFQDN', args: [{ allow_numeric_tld: true, require_tld: false }], - valid: ["example.0", "192.168.0", "192.168.0.9999"], + valid: ['example.0', '192.168.0', '192.168.0.9999'], }); }); - it("should validate FQDN with wildcard option", () => { + it('should validate FQDN with wildcard option', () => { test({ - validator: "isFQDN", + validator: 'isFQDN', args: [{ allow_wildcard: true }], - valid: ["*.example.com", "*.shop.example.com"], + valid: ['*.example.com', '*.shop.example.com'], }); }); - it("should validate FQDN with required allow_trailing_dot, allow_underscores and allow_numeric_tld options", () => { + it('should validate FQDN with required allow_trailing_dot, allow_underscores and allow_numeric_tld options', () => { test({ - validator: "isFQDN", + validator: 'isFQDN', args: [ { allow_trailing_dot: true, @@ -1219,1966 +1219,1966 @@ describe("Validators", () => { allow_numeric_tld: true, }, ], - valid: ["abc.efg.g1h.", "as1s.sad3s.ssa2d."], + valid: ['abc.efg.g1h.', 'as1s.sad3s.ssa2d.'], }); }); - it("should validate alpha strings", () => { + it('should validate alpha strings', () => { test({ - validator: "isAlpha", - valid: ["abc", "ABC", "FoObar"], - invalid: ["abc1", " foo ", "", "ÄBC", "FÜübar", "Jön", "Heiß"], + validator: 'isAlpha', + valid: ['abc', 'ABC', 'FoObar'], + invalid: ['abc1', ' foo ', '', 'ÄBC', 'FÜübar', 'Jön', 'Heiß'], }); }); - it("should validate alpha string with ignored characters", () => { + it('should validate alpha string with ignored characters', () => { test({ - validator: "isAlpha", - args: ["en-US", { ignore: "- /" }], // ignore [space-/] - valid: ["en-US", "this is a valid alpha string", "us/usa"], + validator: 'isAlpha', + args: ['en-US', { ignore: '- /' }], // ignore [space-/] + valid: ['en-US', 'this is a valid alpha string', 'us/usa'], invalid: [ - "1. this is not a valid alpha string", - "this$is also not a valid.alpha string", - "this is also not a valid alpha string.", + '1. this is not a valid alpha string', + 'this$is also not a valid.alpha string', + 'this is also not a valid alpha string.', ], }); test({ - validator: "isAlpha", - args: ["en-US", { ignore: /[\s/-]/g }], // ignore [space -] - valid: ["en-US", "this is a valid alpha string"], + validator: 'isAlpha', + args: ['en-US', { ignore: /[\s/-]/g }], // ignore [space -] + valid: ['en-US', 'this is a valid alpha string'], invalid: [ - "1. this is not a valid alpha string", - "this$is also not a valid.alpha string", - "this is also not a valid alpha string.", + '1. this is not a valid alpha string', + 'this$is also not a valid.alpha string', + 'this is also not a valid alpha string.', ], }); test({ - validator: "isAlpha", - args: ["en-US", { ignore: 1234 }], // invalid ignore matcher - error: ["alpha"], + validator: 'isAlpha', + args: ['en-US', { ignore: 1234 }], // invalid ignore matcher + error: ['alpha'], }); }); - it("should validate Azerbaijani alpha strings", () => { + it('should validate Azerbaijani alpha strings', () => { test({ - validator: "isAlpha", - args: ["az-AZ"], + validator: 'isAlpha', + args: ['az-AZ'], valid: [ - "Azərbaycan", - "Bakı", - "üöğıəçş", - "sizAzərbaycanlaşdırılmışlardansınızmı", - "dahaBirDüzgünString", - "abcçdeəfgğhxıijkqlmnoöprsştuüvyz", + 'Azərbaycan', + 'Bakı', + 'üöğıəçş', + 'sizAzərbaycanlaşdırılmışlardansınızmı', + 'dahaBirDüzgünString', + 'abcçdeəfgğhxıijkqlmnoöprsştuüvyz', ], - invalid: ["rəqəm1", " foo ", "", "ab(cd)", "simvol@", "wəkil"], + invalid: ['rəqəm1', ' foo ', '', 'ab(cd)', 'simvol@', 'wəkil'], }); }); - it("should validate bulgarian alpha strings", () => { + it('should validate bulgarian alpha strings', () => { test({ - validator: "isAlpha", - args: ["bg-BG"], - valid: ["абв", "АБВ", "жаба", "яГоДа"], - invalid: ["abc1", " foo ", "", "ЁЧПС", "_аз_обичам_обувки_", "ехо!"], + validator: 'isAlpha', + args: ['bg-BG'], + valid: ['абв', 'АБВ', 'жаба', 'яГоДа'], + invalid: ['abc1', ' foo ', '', 'ЁЧПС', '_аз_обичам_обувки_', 'ехо!'], }); }); - it("should validate Bengali alpha strings", () => { + it('should validate Bengali alpha strings', () => { test({ - validator: "isAlpha", - args: ["bn-BD"], - valid: ["অয়াওর", "ফগফদ্রত", "ফদ্ম্যতভ", "বেরেওভচনভন", "আমারবাসগা"], - invalid: ["দাস২৩৪", " দ্গফহ্নভ ", "", "(গফদ)"], + validator: 'isAlpha', + args: ['bn-BD'], + valid: ['অয়াওর', 'ফগফদ্রত', 'ফদ্ম্যতভ', 'বেরেওভচনভন', 'আমারবাসগা'], + invalid: ['দাস২৩৪', ' দ্গফহ্নভ ', '', '(গফদ)'], }); }); - it("should validate czech alpha strings", () => { + it('should validate czech alpha strings', () => { test({ - validator: "isAlpha", - args: ["cs-CZ"], - valid: ["žluťoučký", "KŮŇ", "Pěl", "Ďábelské", "ódy"], - invalid: ["ábc1", " fůj ", ""], + validator: 'isAlpha', + args: ['cs-CZ'], + valid: ['žluťoučký', 'KŮŇ', 'Pěl', 'Ďábelské', 'ódy'], + invalid: ['ábc1', ' fůj ', ''], }); }); - it("should validate slovak alpha strings", () => { + it('should validate slovak alpha strings', () => { test({ - validator: "isAlpha", - args: ["sk-SK"], + validator: 'isAlpha', + args: ['sk-SK'], valid: [ - "môj", - "ľúbím", - "mäkčeň", - "stĹp", - "vŕba", - "ňorimberk", - "ťava", - "žanéta", - "Ďábelské", - "ódy", + 'môj', + 'ľúbím', + 'mäkčeň', + 'stĹp', + 'vŕba', + 'ňorimberk', + 'ťava', + 'žanéta', + 'Ďábelské', + 'ódy', ], - invalid: ["1moj", "你好世界", " Привет мир ", "مرحبا العا "], + invalid: ['1moj', '你好世界', ' Привет мир ', 'مرحبا العا '], }); }); - it("should validate danish alpha strings", () => { + it('should validate danish alpha strings', () => { test({ - validator: "isAlpha", - args: ["da-DK"], - valid: ["aøå", "Ære", "Øre", "Åre"], - invalid: ["äbc123", "ÄBC11", ""], + validator: 'isAlpha', + args: ['da-DK'], + valid: ['aøå', 'Ære', 'Øre', 'Åre'], + invalid: ['äbc123', 'ÄBC11', ''], }); }); - it("should validate dutch alpha strings", () => { + it('should validate dutch alpha strings', () => { test({ - validator: "isAlpha", - args: ["nl-NL"], - valid: ["Kán", "één", "vóór", "nú", "héél"], - invalid: ["äca ", "abcß", "Øre"], + validator: 'isAlpha', + args: ['nl-NL'], + valid: ['Kán', 'één', 'vóór', 'nú', 'héél'], + invalid: ['äca ', 'abcß', 'Øre'], }); }); - it("should validate german alpha strings", () => { + it('should validate german alpha strings', () => { test({ - validator: "isAlpha", - args: ["de-DE"], - valid: ["äbc", "ÄBC", "FöÖbär", "Heiß"], - invalid: ["äbc1", " föö ", ""], + validator: 'isAlpha', + args: ['de-DE'], + valid: ['äbc', 'ÄBC', 'FöÖbär', 'Heiß'], + invalid: ['äbc1', ' föö ', ''], }); }); - it("should validate hungarian alpha strings", () => { + it('should validate hungarian alpha strings', () => { test({ - validator: "isAlpha", - args: ["hu-HU"], - valid: ["árvíztűrőtükörfúrógép", "ÁRVÍZTŰRŐTÜKÖRFÚRÓGÉP"], - invalid: ["äbc1", " fäö ", "Heiß", ""], + validator: 'isAlpha', + args: ['hu-HU'], + valid: ['árvíztűrőtükörfúrógép', 'ÁRVÍZTŰRŐTÜKÖRFÚRÓGÉP'], + invalid: ['äbc1', ' fäö ', 'Heiß', ''], }); }); - it("should validate portuguese alpha strings", () => { + it('should validate portuguese alpha strings', () => { test({ - validator: "isAlpha", - args: ["pt-PT"], - valid: ["palíndromo", "órgão", "qwértyúão", "àäãcëüïÄÏÜ"], - invalid: ["12abc", "Heiß", "Øre", "æøå", ""], + validator: 'isAlpha', + args: ['pt-PT'], + valid: ['palíndromo', 'órgão', 'qwértyúão', 'àäãcëüïÄÏÜ'], + invalid: ['12abc', 'Heiß', 'Øre', 'æøå', ''], }); }); - it("should validate italian alpha strings", () => { + it('should validate italian alpha strings', () => { test({ - validator: "isAlpha", - args: ["it-IT"], + validator: 'isAlpha', + args: ['it-IT'], valid: [ - "àéèìîóòù", - "correnti", - "DEFINIZIONE", - "compilazione", - "metró", - "pèsca", - "PÉSCA", - "genî", + 'àéèìîóòù', + 'correnti', + 'DEFINIZIONE', + 'compilazione', + 'metró', + 'pèsca', + 'PÉSCA', + 'genî', ], - invalid: ["äbc123", "ÄBC11", "æøå", ""], + invalid: ['äbc123', 'ÄBC11', 'æøå', ''], }); }); - it("should validate Japanese alpha strings", () => { + it('should validate Japanese alpha strings', () => { test({ - validator: "isAlpha", - args: ["ja-JP"], + validator: 'isAlpha', + args: ['ja-JP'], valid: [ - "あいうえお", - "がぎぐげご", - "ぁぃぅぇぉ", - "アイウエオ", - "ァィゥェ", - "アイウエオ", - "吾輩は猫である", - "臥薪嘗胆", - "新世紀エヴァンゲリオン", - "天国と地獄", - "七人の侍", - "シン・ウルトラマン", + 'あいうえお', + 'がぎぐげご', + 'ぁぃぅぇぉ', + 'アイウエオ', + 'ァィゥェ', + 'アイウエオ', + '吾輩は猫である', + '臥薪嘗胆', + '新世紀エヴァンゲリオン', + '天国と地獄', + '七人の侍', + 'シン・ウルトラマン', ], - invalid: ["あいう123", "abcあいう", "1984"], + invalid: ['あいう123', 'abcあいう', '1984'], }); }); - it("should validate kazakh alpha strings", () => { + it('should validate kazakh alpha strings', () => { test({ - validator: "isAlpha", - args: ["kk-KZ"], + validator: 'isAlpha', + args: ['kk-KZ'], valid: [ - "Сәлем", - "қанағаттандырылмағандықтарыңыздан", - "Кешіріңіз", - "Өкінішке", - "Қайталаңызшы", - "ағылшынша", - "түсінбедім", + 'Сәлем', + 'қанағаттандырылмағандықтарыңыздан', + 'Кешіріңіз', + 'Өкінішке', + 'Қайталаңызшы', + 'ағылшынша', + 'түсінбедім', ], - invalid: ["Кешіріңіз1", " Кет бар ", "مرحبا العا"], + invalid: ['Кешіріңіз1', ' Кет бар ', 'مرحبا العا'], }); }); - it("should validate Vietnamese alpha strings", () => { + it('should validate Vietnamese alpha strings', () => { test({ - validator: "isAlpha", - args: ["vi-VN"], - valid: ["thiến", "nghiêng", "xin", "chào", "thế", "giới"], - invalid: ["thầy3", "Ba gà", ""], + validator: 'isAlpha', + args: ['vi-VN'], + valid: ['thiến', 'nghiêng', 'xin', 'chào', 'thế', 'giới'], + invalid: ['thầy3', 'Ba gà', ''], }); }); - it("should validate arabic alpha strings", () => { + it('should validate arabic alpha strings', () => { test({ - validator: "isAlpha", - args: ["ar"], - valid: ["أبت", "اَبِتَثّجً"], + validator: 'isAlpha', + args: ['ar'], + valid: ['أبت', 'اَبِتَثّجً'], invalid: [ - "١٢٣أبت", - "١٢٣", - "abc1", - " foo ", - "", - "ÄBC", - "FÜübar", - "Jön", - "Heiß", + '١٢٣أبت', + '١٢٣', + 'abc1', + ' foo ', + '', + 'ÄBC', + 'FÜübar', + 'Jön', + 'Heiß', ], }); }); - it("should validate farsi alpha strings", () => { + it('should validate farsi alpha strings', () => { test({ - validator: "isAlpha", - args: ["fa-IR"], - valid: ["پدر", "مادر", "برادر", "خواهر"], + validator: 'isAlpha', + args: ['fa-IR'], + valid: ['پدر', 'مادر', 'برادر', 'خواهر'], invalid: [ - "فارسی۱۲۳", - "۱۶۴", - "abc1", - " foo ", - "", - "ÄBC", - "FÜübar", - "Jön", - "Heiß", + 'فارسی۱۲۳', + '۱۶۴', + 'abc1', + ' foo ', + '', + 'ÄBC', + 'FÜübar', + 'Jön', + 'Heiß', ], }); }); - it("should validate finnish alpha strings", () => { + it('should validate finnish alpha strings', () => { test({ - validator: "isAlpha", - args: ["fi-FI"], - valid: ["äiti", "Öljy", "Åke", "testÖ"], - invalid: ["AİıÖöÇ窺ĞğÜüZ", "äöå123", ""], + validator: 'isAlpha', + args: ['fi-FI'], + valid: ['äiti', 'Öljy', 'Åke', 'testÖ'], + invalid: ['AİıÖöÇ窺ĞğÜüZ', 'äöå123', ''], }); }); - it("should validate kurdish alpha strings", () => { + it('should validate kurdish alpha strings', () => { test({ - validator: "isAlpha", - args: ["ku-IQ"], - valid: ["ئؤڤگێ", "کوردستان"], + validator: 'isAlpha', + args: ['ku-IQ'], + valid: ['ئؤڤگێ', 'کوردستان'], invalid: [ - "ئؤڤگێ١٢٣", - "١٢٣", - "abc1", - " foo ", - "", - "ÄBC", - "FÜübar", - "Jön", - "Heiß", + 'ئؤڤگێ١٢٣', + '١٢٣', + 'abc1', + ' foo ', + '', + 'ÄBC', + 'FÜübar', + 'Jön', + 'Heiß', ], }); }); - it("should validate norwegian alpha strings", () => { + it('should validate norwegian alpha strings', () => { test({ - validator: "isAlpha", - args: ["nb-NO"], - valid: ["aøå", "Ære", "Øre", "Åre"], - invalid: ["äbc123", "ÄBC11", ""], + validator: 'isAlpha', + args: ['nb-NO'], + valid: ['aøå', 'Ære', 'Øre', 'Åre'], + invalid: ['äbc123', 'ÄBC11', ''], }); }); - it("should validate polish alpha strings", () => { + it('should validate polish alpha strings', () => { test({ - validator: "isAlpha", - args: ["pl-PL"], + validator: 'isAlpha', + args: ['pl-PL'], valid: [ - "kreską", - "zamknięte", - "zwykłe", - "kropką", - "przyjęły", - "święty", - "Pozwól", + 'kreską', + 'zamknięte', + 'zwykłe', + 'kropką', + 'przyjęły', + 'święty', + 'Pozwól', ], - invalid: ["12řiď ", "blé!!", "föö!2!"], + invalid: ['12řiď ', 'blé!!', 'föö!2!'], }); }); - it("should validate serbian cyrillic alpha strings", () => { + it('should validate serbian cyrillic alpha strings', () => { test({ - validator: "isAlpha", - args: ["sr-RS"], - valid: ["ШћжЂљЕ", "ЧПСТЋЏ"], - invalid: ["řiď ", "blé33!!", "föö!!"], + validator: 'isAlpha', + args: ['sr-RS'], + valid: ['ШћжЂљЕ', 'ЧПСТЋЏ'], + invalid: ['řiď ', 'blé33!!', 'föö!!'], }); }); - it("should validate serbian latin alpha strings", () => { + it('should validate serbian latin alpha strings', () => { test({ - validator: "isAlpha", - args: ["sr-RS@latin"], - valid: ["ŠAabčšđćž", "ŠATROĆčđš"], - invalid: ["12řiď ", "blé!!", "föö!2!"], + validator: 'isAlpha', + args: ['sr-RS@latin'], + valid: ['ŠAabčšđćž', 'ŠATROĆčđš'], + invalid: ['12řiď ', 'blé!!', 'föö!2!'], }); }); - it("should validate spanish alpha strings", () => { + it('should validate spanish alpha strings', () => { test({ - validator: "isAlpha", - args: ["es-ES"], - valid: ["ábcó", "ÁBCÓ", "dormís", "volvés", "español"], - invalid: ["äca ", "abcß", "föö!!"], + validator: 'isAlpha', + args: ['es-ES'], + valid: ['ábcó', 'ÁBCÓ', 'dormís', 'volvés', 'español'], + invalid: ['äca ', 'abcß', 'föö!!'], }); }); - it("should validate swedish alpha strings", () => { + it('should validate swedish alpha strings', () => { test({ - validator: "isAlpha", - args: ["sv-SE"], - valid: ["religiös", "stjäla", "västgöte", "Åre"], - invalid: ["AİıÖöÇ窺ĞğÜüZ", "religiös23", ""], + validator: 'isAlpha', + args: ['sv-SE'], + valid: ['religiös', 'stjäla', 'västgöte', 'Åre'], + invalid: ['AİıÖöÇ窺ĞğÜüZ', 'religiös23', ''], }); }); - it("should validate defined arabic locales alpha strings", () => { + it('should validate defined arabic locales alpha strings', () => { test({ - validator: "isAlpha", - args: ["ar-SY"], - valid: ["أبت", "اَبِتَثّجً"], + validator: 'isAlpha', + args: ['ar-SY'], + valid: ['أبت', 'اَبِتَثّجً'], invalid: [ - "١٢٣أبت", - "١٢٣", - "abc1", - " foo ", - "", - "ÄBC", - "FÜübar", - "Jön", - "Heiß", + '١٢٣أبت', + '١٢٣', + 'abc1', + ' foo ', + '', + 'ÄBC', + 'FÜübar', + 'Jön', + 'Heiß', ], }); }); - it("should validate turkish alpha strings", () => { + it('should validate turkish alpha strings', () => { test({ - validator: "isAlpha", - args: ["tr-TR"], - valid: ["AİıÖöÇ窺ĞğÜüZ"], + validator: 'isAlpha', + args: ['tr-TR'], + valid: ['AİıÖöÇ窺ĞğÜüZ'], invalid: [ - "0AİıÖöÇ窺ĞğÜüZ1", - " AİıÖöÇ窺ĞğÜüZ ", - "abc1", - " foo ", - "", - "ÄBC", - "Heiß", + '0AİıÖöÇ窺ĞğÜüZ1', + ' AİıÖöÇ窺ĞğÜüZ ', + 'abc1', + ' foo ', + '', + 'ÄBC', + 'Heiß', ], }); }); - it("should validate urkrainian alpha strings", () => { + it('should validate urkrainian alpha strings', () => { test({ - validator: "isAlpha", - args: ["uk-UA"], - valid: ["АБВГҐДЕЄЖЗИIЇЙКЛМНОПРСТУФХЦШЩЬЮЯ"], + validator: 'isAlpha', + args: ['uk-UA'], + valid: ['АБВГҐДЕЄЖЗИIЇЙКЛМНОПРСТУФХЦШЩЬЮЯ'], invalid: [ - "0AİıÖöÇ窺ĞğÜüZ1", - " AİıÖöÇ窺ĞğÜüZ ", - "abc1", - " foo ", - "", - "ÄBC", - "Heiß", - "ЫыЪъЭэ", + '0AİıÖöÇ窺ĞğÜüZ1', + ' AİıÖöÇ窺ĞğÜüZ ', + 'abc1', + ' foo ', + '', + 'ÄBC', + 'Heiß', + 'ЫыЪъЭэ', ], }); }); - it("should validate greek alpha strings", () => { + it('should validate greek alpha strings', () => { test({ - validator: "isAlpha", - args: ["el-GR"], + validator: 'isAlpha', + args: ['el-GR'], valid: [ - "αβγδεζηθικλμνξοπρςστυφχψω", - "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ", - "άέήίΰϊϋόύώ", - "ΆΈΉΊΪΫΎΏ", + 'αβγδεζηθικλμνξοπρςστυφχψω', + 'ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ', + 'άέήίΰϊϋόύώ', + 'ΆΈΉΊΪΫΎΏ', ], invalid: [ - "0AİıÖöÇ窺ĞğÜüZ1", - " AİıÖöÇ窺ĞğÜüZ ", - "ÄBC", - "Heiß", - "ЫыЪъЭэ", - "120", - "jαckγ", + '0AİıÖöÇ窺ĞğÜüZ1', + ' AİıÖöÇ窺ĞğÜüZ ', + 'ÄBC', + 'Heiß', + 'ЫыЪъЭэ', + '120', + 'jαckγ', ], }); }); - it("should validate Hebrew alpha strings", () => { + it('should validate Hebrew alpha strings', () => { test({ - validator: "isAlpha", - args: ["he"], - valid: ["בדיקה", "שלום"], - invalid: ["בדיקה123", " foo ", "abc1", ""], + validator: 'isAlpha', + args: ['he'], + valid: ['בדיקה', 'שלום'], + invalid: ['בדיקה123', ' foo ', 'abc1', ''], }); }); - it("should validate Hindi alpha strings", () => { + it('should validate Hindi alpha strings', () => { test({ - validator: "isAlpha", - args: ["hi-IN"], + validator: 'isAlpha', + args: ['hi-IN'], valid: [ - "अतअपनाअपनीअपनेअभीअंदरआदिआपइत्यादिइनइनकाइन्हींइन्हेंइन्होंइसइसकाइसकीइसकेइसमेंइसीइसेउनउनकाउनकीउनकेउनकोउन्हींउन्हेंउन्होंउसउसकेउसीउसेएकएवंएसऐसेऔरकईकरकरताकरतेकरनाकरनेकरेंकहतेकहाकाकाफ़ीकिकितनाकिन्हेंकिन्होंकियाकिरकिसकिसीकिसेकीकुछकुलकेकोकोईकौनकौनसागयाघरजबजहाँजाजितनाजिनजिन्हेंजिन्होंजिसजिसेजीधरजैसाजैसेजोतकतबतरहतिनतिन्हेंतिन्होंतिसतिसेतोथाथीथेदबारादियादुसरादूसरेदोद्वाराननकेनहींनानिहायतनीचेनेपरपहलेपूरापेफिरबनीबहीबहुतबादबालाबिलकुलभीभीतरमगरमानोमेमेंयदियहयहाँयहीयायिहयेरखेंरहारहेऱ्वासालिएलियेलेकिनववग़ैरहवर्गवहवहाँवहींवालेवुहवेवोसकतासकतेसबसेसभीसाथसाबुतसाभसारासेसोसंगहीहुआहुईहुएहैहैंहोहोताहोतीहोतेहोनाहोने", - "इन्हें", + 'अतअपनाअपनीअपनेअभीअंदरआदिआपइत्यादिइनइनकाइन्हींइन्हेंइन्होंइसइसकाइसकीइसकेइसमेंइसीइसेउनउनकाउनकीउनकेउनकोउन्हींउन्हेंउन्होंउसउसकेउसीउसेएकएवंएसऐसेऔरकईकरकरताकरतेकरनाकरनेकरेंकहतेकहाकाकाफ़ीकिकितनाकिन्हेंकिन्होंकियाकिरकिसकिसीकिसेकीकुछकुलकेकोकोईकौनकौनसागयाघरजबजहाँजाजितनाजिनजिन्हेंजिन्होंजिसजिसेजीधरजैसाजैसेजोतकतबतरहतिनतिन्हेंतिन्होंतिसतिसेतोथाथीथेदबारादियादुसरादूसरेदोद्वाराननकेनहींनानिहायतनीचेनेपरपहलेपूरापेफिरबनीबहीबहुतबादबालाबिलकुलभीभीतरमगरमानोमेमेंयदियहयहाँयहीयायिहयेरखेंरहारहेऱ्वासालिएलियेलेकिनववग़ैरहवर्गवहवहाँवहींवालेवुहवेवोसकतासकतेसबसेसभीसाथसाबुतसाभसारासेसोसंगहीहुआहुईहुएहैहैंहोहोताहोतीहोतेहोनाहोने', + 'इन्हें', ], - invalid: ["अत०२३४५६७८९", "अत 12", " अत ", "abc1", "abc", ""], + invalid: ['अत०२३४५६७८९', 'अत 12', ' अत ', 'abc1', 'abc', ''], }); }); - it("should validate persian alpha strings", () => { + it('should validate persian alpha strings', () => { test({ - validator: "isAlpha", - args: ["fa-IR"], - valid: ["تست", "عزیزم", "ح"], - invalid: ["تست 1", " عزیزم ", ""], + validator: 'isAlpha', + args: ['fa-IR'], + valid: ['تست', 'عزیزم', 'ح'], + invalid: ['تست 1', ' عزیزم ', ''], }); }); - it("should validate Thai alpha strings", () => { + it('should validate Thai alpha strings', () => { test({ - validator: "isAlpha", - args: ["th-TH"], - valid: ["สวัสดี", "ยินดีต้อนรับ เทสเคส"], - invalid: ["สวัสดีHi", "123 ยินดีต้อนรับ", "ยินดีต้อนรับ-๑๒๓"], + validator: 'isAlpha', + args: ['th-TH'], + valid: ['สวัสดี', 'ยินดีต้อนรับ เทสเคส'], + invalid: ['สวัสดีHi', '123 ยินดีต้อนรับ', 'ยินดีต้อนรับ-๑๒๓'], }); }); - it("should validate Korea alpha strings", () => { + it('should validate Korea alpha strings', () => { test({ - validator: "isAlpha", - args: ["ko-KR"], + validator: 'isAlpha', + args: ['ko-KR'], valid: [ - "ㄱ", - "ㅑ", - "ㄱㄴㄷㅏㅕ", - "세종대왕", - "나랏말싸미듕귁에달아문자와로서르사맛디아니할쎄", + 'ㄱ', + 'ㅑ', + 'ㄱㄴㄷㅏㅕ', + '세종대왕', + '나랏말싸미듕귁에달아문자와로서르사맛디아니할쎄', ], invalid: [ - "abc", - "123", - "흥선대원군 문호개방", - "1592년임진왜란", - "대한민국!", + 'abc', + '123', + '흥선대원군 문호개방', + '1592년임진왜란', + '대한민국!', ], }); }); - it("should validate Sinhala alpha strings", () => { + it('should validate Sinhala alpha strings', () => { test({ - validator: "isAlpha", - args: ["si-LK"], - valid: ["චතුර", "කචටදබ", "ඎඏදාෛපසුගො"], - invalid: ["ஆஐअतක", "කචට 12", " ඎ ", "abc1", "abc", ""], + validator: 'isAlpha', + args: ['si-LK'], + valid: ['චතුර', 'කචටදබ', 'ඎඏදාෛපසුගො'], + invalid: ['ஆஐअतක', 'කචට 12', ' ඎ ', 'abc1', 'abc', ''], }); }); - it("should error on invalid locale", () => { + it('should error on invalid locale', () => { test({ - validator: "isAlpha", - args: ["is-NOT"], - error: ["abc", "ABC"], + validator: 'isAlpha', + args: ['is-NOT'], + error: ['abc', 'ABC'], }); }); - it("should validate alphanumeric strings", () => { + it('should validate alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - valid: ["abc123", "ABC11"], - invalid: ["abc ", "foo!!", "ÄBC", "FÜübar", "Jön"], + validator: 'isAlphanumeric', + valid: ['abc123', 'ABC11'], + invalid: ['abc ', 'foo!!', 'ÄBC', 'FÜübar', 'Jön'], }); }); - it("should validate alphanumeric string with ignored characters", () => { + it('should validate alphanumeric string with ignored characters', () => { test({ - validator: "isAlphanumeric", - args: ["en-US", { ignore: "@_- " }], // ignore [@ space _ -] + validator: 'isAlphanumeric', + args: ['en-US', { ignore: '@_- ' }], // ignore [@ space _ -] valid: [ - "Hello@123", - "this is a valid alphaNumeric string", - "En-US @ alpha_numeric", + 'Hello@123', + 'this is a valid alphaNumeric string', + 'En-US @ alpha_numeric', ], - invalid: ["In*Valid", "hello$123", "{invalid}"], + invalid: ['In*Valid', 'hello$123', '{invalid}'], }); test({ - validator: "isAlphanumeric", - args: ["en-US", { ignore: /[\s/-]/g }], // ignore [space -] - valid: ["en-US", "this is a valid alphaNumeric string"], - invalid: ["INVALID$ AlphaNum Str", "hello@123", "abc*123"], + validator: 'isAlphanumeric', + args: ['en-US', { ignore: /[\s/-]/g }], // ignore [space -] + valid: ['en-US', 'this is a valid alphaNumeric string'], + invalid: ['INVALID$ AlphaNum Str', 'hello@123', 'abc*123'], }); test({ - validator: "isAlphanumeric", - args: ["en-US", { ignore: 1234 }], // invalid ignore matcher (ignore should be instance of a String or RegExp) - error: ["alpha"], + validator: 'isAlphanumeric', + args: ['en-US', { ignore: 1234 }], // invalid ignore matcher (ignore should be instance of a String or RegExp) + error: ['alpha'], }); }); - it("should validate defined english aliases", () => { + it('should validate defined english aliases', () => { test({ - validator: "isAlphanumeric", - args: ["en-GB"], - valid: ["abc123", "ABC11"], - invalid: ["abc ", "foo!!", "ÄBC", "FÜübar", "Jön"], + validator: 'isAlphanumeric', + args: ['en-GB'], + valid: ['abc123', 'ABC11'], + invalid: ['abc ', 'foo!!', 'ÄBC', 'FÜübar', 'Jön'], }); }); - it("should validate Azerbaijani alphanumeric strings", () => { + it('should validate Azerbaijani alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["az-AZ"], - valid: ["Azərbaycan", "Bakı", "abc1", "abcç2", "3kərə4kərə"], - invalid: [" foo1 ", "", "ab(cd)", "simvol@", "wəkil"], + validator: 'isAlphanumeric', + args: ['az-AZ'], + valid: ['Azərbaycan', 'Bakı', 'abc1', 'abcç2', '3kərə4kərə'], + invalid: [' foo1 ', '', 'ab(cd)', 'simvol@', 'wəkil'], }); }); - it("should validate bulgarian alphanumeric strings", () => { + it('should validate bulgarian alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["bg-BG"], - valid: ["абв1", "4АБ5В6", "жаба", "яГоДа2", "йЮя", "123"], - invalid: [" ", "789 ", "hello000"], + validator: 'isAlphanumeric', + args: ['bg-BG'], + valid: ['абв1', '4АБ5В6', 'жаба', 'яГоДа2', 'йЮя', '123'], + invalid: [' ', '789 ', 'hello000'], }); }); - it("should validate Bengali alphanumeric strings", () => { + it('should validate Bengali alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["bn-BD"], + validator: 'isAlphanumeric', + args: ['bn-BD'], valid: [ - "দ্গজ্ঞহ্রত্য১২৩", - "দ্গগফ৮৯০", - "চব৩৬৫ভবচ", - "১২৩৪", - "৩৪২৩৪দফজ্ঞদফ", + 'দ্গজ্ঞহ্রত্য১২৩', + 'দ্গগফ৮৯০', + 'চব৩৬৫ভবচ', + '১২৩৪', + '৩৪২৩৪দফজ্ঞদফ', ], - invalid: [" ", "১২৩ ", "hel৩২0"], + invalid: [' ', '১২৩ ', 'hel৩২0'], }); }); - it("should validate czech alphanumeric strings", () => { + it('should validate czech alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["cs-CZ"], - valid: ["řiť123", "KŮŇ11"], - invalid: ["řiď ", "blé!!"], + validator: 'isAlphanumeric', + args: ['cs-CZ'], + valid: ['řiť123', 'KŮŇ11'], + invalid: ['řiď ', 'blé!!'], }); }); - it("should validate slovak alphanumeric strings", () => { + it('should validate slovak alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["sk-SK"], + validator: 'isAlphanumeric', + args: ['sk-SK'], valid: [ - "1môj", - "2ľúbím", - "3mäkčeň", - "4stĹp", - "5vŕba", - "6ňorimberk", - "7ťava", - "8žanéta", - "9Ďábelské", - "10ódy", + '1môj', + '2ľúbím', + '3mäkčeň', + '4stĹp', + '5vŕba', + '6ňorimberk', + '7ťava', + '8žanéta', + '9Ďábelské', + '10ódy', ], - invalid: ["1moj!", "你好世界", " Привет мир "], + invalid: ['1moj!', '你好世界', ' Привет мир '], }); }); - it("should validate danish alphanumeric strings", () => { + it('should validate danish alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["da-DK"], - valid: ["ÆØÅ123", "Ære321", "321Øre", "123Åre"], - invalid: ["äbc123", "ÄBC11", ""], + validator: 'isAlphanumeric', + args: ['da-DK'], + valid: ['ÆØÅ123', 'Ære321', '321Øre', '123Åre'], + invalid: ['äbc123', 'ÄBC11', ''], }); }); - it("should validate dutch alphanumeric strings", () => { + it('should validate dutch alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["nl-NL"], - valid: ["Kán123", "één354", "v4óór", "nú234", "hé54él"], - invalid: ["1äca ", "ab3cß", "Øre"], + validator: 'isAlphanumeric', + args: ['nl-NL'], + valid: ['Kán123', 'één354', 'v4óór', 'nú234', 'hé54él'], + invalid: ['1äca ', 'ab3cß', 'Øre'], }); }); - it("should validate finnish alphanumeric strings", () => { + it('should validate finnish alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["fi-FI"], - valid: ["äiti124", "ÖLJY1234", "123Åke", "451åå23"], - invalid: ["AİıÖöÇ窺ĞğÜüZ", "foo!!", ""], + validator: 'isAlphanumeric', + args: ['fi-FI'], + valid: ['äiti124', 'ÖLJY1234', '123Åke', '451åå23'], + invalid: ['AİıÖöÇ窺ĞğÜüZ', 'foo!!', ''], }); }); - it("should validate german alphanumeric strings", () => { + it('should validate german alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["de-DE"], - valid: ["äbc123", "ÄBC11"], - invalid: ["äca ", "föö!!"], + validator: 'isAlphanumeric', + args: ['de-DE'], + valid: ['äbc123', 'ÄBC11'], + invalid: ['äca ', 'föö!!'], }); }); - it("should validate hungarian alphanumeric strings", () => { + it('should validate hungarian alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["hu-HU"], - valid: ["0árvíztűrőtükörfúrógép123", "0ÁRVÍZTŰRŐTÜKÖRFÚRÓGÉP123"], - invalid: ["1időúr!", "äbc1", " fäö ", "Heiß!", ""], + validator: 'isAlphanumeric', + args: ['hu-HU'], + valid: ['0árvíztűrőtükörfúrógép123', '0ÁRVÍZTŰRŐTÜKÖRFÚRÓGÉP123'], + invalid: ['1időúr!', 'äbc1', ' fäö ', 'Heiß!', ''], }); }); - it("should validate portuguese alphanumeric strings", () => { + it('should validate portuguese alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["pt-PT"], - valid: ["palíndromo", "2órgão", "qwértyúão9", "àäãcë4üïÄÏÜ"], - invalid: ["!abc", "Heiß", "Øre", "æøå", ""], + validator: 'isAlphanumeric', + args: ['pt-PT'], + valid: ['palíndromo', '2órgão', 'qwértyúão9', 'àäãcë4üïÄÏÜ'], + invalid: ['!abc', 'Heiß', 'Øre', 'æøå', ''], }); }); - it("should validate italian alphanumeric strings", () => { + it('should validate italian alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["it-IT"], + validator: 'isAlphanumeric', + args: ['it-IT'], valid: [ - "123àéèìîóòù", - "123correnti", - "DEFINIZIONE321", - "compil123azione", - "met23ró", - "pès56ca", - "PÉS45CA", - "gen45î", + '123àéèìîóòù', + '123correnti', + 'DEFINIZIONE321', + 'compil123azione', + 'met23ró', + 'pès56ca', + 'PÉS45CA', + 'gen45î', ], - invalid: ["äbc123", "ÄBC11", "æøå", ""], + invalid: ['äbc123', 'ÄBC11', 'æøå', ''], }); }); - it("should validate spanish alphanumeric strings", () => { + it('should validate spanish alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["es-ES"], - valid: ["ábcó123", "ÁBCÓ11"], - invalid: ["äca ", "abcß", "föö!!"], + validator: 'isAlphanumeric', + args: ['es-ES'], + valid: ['ábcó123', 'ÁBCÓ11'], + invalid: ['äca ', 'abcß', 'föö!!'], }); }); - it("should validate Vietnamese alphanumeric strings", () => { + it('should validate Vietnamese alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["vi-VN"], - valid: ["Thầy3", "3Gà"], - invalid: ["toang!", "Cậu Vàng"], + validator: 'isAlphanumeric', + args: ['vi-VN'], + valid: ['Thầy3', '3Gà'], + invalid: ['toang!', 'Cậu Vàng'], }); }); - it("should validate arabic alphanumeric strings", () => { + it('should validate arabic alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["ar"], - valid: ["أبت123", "أبتَُِ١٢٣"], - invalid: ["äca ", "abcß", "föö!!"], + validator: 'isAlphanumeric', + args: ['ar'], + valid: ['أبت123', 'أبتَُِ١٢٣'], + invalid: ['äca ', 'abcß', 'föö!!'], }); }); - it("should validate Hindi alphanumeric strings", () => { + it('should validate Hindi alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["hi-IN"], + validator: 'isAlphanumeric', + args: ['hi-IN'], valid: [ - "अतअपनाअपनीअपनेअभीअंदरआदिआपइत्यादिइनइनकाइन्हींइन्हेंइन्होंइसइसकाइसकीइसकेइसमेंइसीइसेउनउनकाउनकीउनकेउनकोउन्हींउन्हेंउन्होंउसउसकेउसीउसेएकएवंएसऐसेऔरकईकरकरताकरतेकरनाकरनेकरेंकहतेकहाकाकाफ़ीकिकितनाकिन्हेंकिन्होंकियाकिरकिसकिसीकिसेकीकुछकुलकेकोकोईकौनकौनसागयाघरजबजहाँजाजितनाजिनजिन्हेंजिन्होंजिसजिसेजीधरजैसाजैसेजोतकतबतरहतिनतिन्हेंतिन्होंतिसतिसेतोथाथीथेदबारादियादुसरादूसरेदोद्वाराननकेनहींनानिहायतनीचेनेपरपहलेपूरापेफिरबनीबहीबहुतबादबालाबिलकुलभीभीतरमगरमानोमेमेंयदियहयहाँयहीयायिहयेरखेंरहारहेऱ्वासालिएलियेलेकिनववग़ैरहवर्गवहवहाँवहींवालेवुहवेवोसकतासकतेसबसेसभीसाथसाबुतसाभसारासेसोसंगहीहुआहुईहुएहैहैंहोहोताहोतीहोतेहोनाहोने०२३४५६७८९", - "इन्हें४५६७८९", + 'अतअपनाअपनीअपनेअभीअंदरआदिआपइत्यादिइनइनकाइन्हींइन्हेंइन्होंइसइसकाइसकीइसकेइसमेंइसीइसेउनउनकाउनकीउनकेउनकोउन्हींउन्हेंउन्होंउसउसकेउसीउसेएकएवंएसऐसेऔरकईकरकरताकरतेकरनाकरनेकरेंकहतेकहाकाकाफ़ीकिकितनाकिन्हेंकिन्होंकियाकिरकिसकिसीकिसेकीकुछकुलकेकोकोईकौनकौनसागयाघरजबजहाँजाजितनाजिनजिन्हेंजिन्होंजिसजिसेजीधरजैसाजैसेजोतकतबतरहतिनतिन्हेंतिन्होंतिसतिसेतोथाथीथेदबारादियादुसरादूसरेदोद्वाराननकेनहींनानिहायतनीचेनेपरपहलेपूरापेफिरबनीबहीबहुतबादबालाबिलकुलभीभीतरमगरमानोमेमेंयदियहयहाँयहीयायिहयेरखेंरहारहेऱ्वासालिएलियेलेकिनववग़ैरहवर्गवहवहाँवहींवालेवुहवेवोसकतासकतेसबसेसभीसाथसाबुतसाभसारासेसोसंगहीहुआहुईहुएहैहैंहोहोताहोतीहोतेहोनाहोने०२३४५६७८९', + 'इन्हें४५६७८९', ], - invalid: ["अत ०२३४५६७८९", " ३४५६७८९", "12 ", " अत ", "abc1", "abc", ""], + invalid: ['अत ०२३४५६७८९', ' ३४५६७८९', '12 ', ' अत ', 'abc1', 'abc', ''], }); }); - it("should validate farsi alphanumeric strings", () => { + it('should validate farsi alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["fa-IR"], - valid: ["پارسی۱۲۳", "۱۴۵۶", "مژگان9"], - invalid: ["äca ", "abcßة", "föö!!", "٤٥٦"], + validator: 'isAlphanumeric', + args: ['fa-IR'], + valid: ['پارسی۱۲۳', '۱۴۵۶', 'مژگان9'], + invalid: ['äca ', 'abcßة', 'föö!!', '٤٥٦'], }); }); - it("should validate Japanese alphanumeric strings", () => { + it('should validate Japanese alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["ja-JP"], + validator: 'isAlphanumeric', + args: ['ja-JP'], valid: [ - "あいうえお123", - "123がぎぐげご", - "ぁぃぅぇぉ", - "アイウエオ", - "ァィゥェ", - "アイウエオ", - "20世紀少年", - "華氏451度", + 'あいうえお123', + '123がぎぐげご', + 'ぁぃぅぇぉ', + 'アイウエオ', + 'ァィゥェ', + 'アイウエオ', + '20世紀少年', + '華氏451度', ], - invalid: [" あいう123 ", "abcあいう", "生きろ!!"], + invalid: [' あいう123 ', 'abcあいう', '生きろ!!'], }); }); - it("should validate kazakh alphanumeric strings", () => { + it('should validate kazakh alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["kk-KZ"], + validator: 'isAlphanumeric', + args: ['kk-KZ'], valid: [ - "Сәлем777", - "123Бәсе", - "солай", - "Жиенсу", - "90тоқсан", - "жалғыз", - "570бердім", + 'Сәлем777', + '123Бәсе', + 'солай', + 'Жиенсу', + '90тоқсан', + 'жалғыз', + '570бердім', ], - invalid: [" кешіріңіз ", "abcағылшынша", "мүмкін!!"], + invalid: [' кешіріңіз ', 'abcағылшынша', 'мүмкін!!'], }); }); - it("should validate kurdish alphanumeric strings", () => { + it('should validate kurdish alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["ku-IQ"], - valid: ["ئؤڤگێ١٢٣"], - invalid: ["äca ", "abcß", "föö!!"], + validator: 'isAlphanumeric', + args: ['ku-IQ'], + valid: ['ئؤڤگێ١٢٣'], + invalid: ['äca ', 'abcß', 'föö!!'], }); }); - it("should validate defined arabic aliases", () => { + it('should validate defined arabic aliases', () => { test({ - validator: "isAlphanumeric", - args: ["ar-SY"], - valid: ["أبت123", "أبتَُِ١٢٣"], - invalid: ["abc ", "foo!!", "ÄBC", "FÜübar", "Jön"], + validator: 'isAlphanumeric', + args: ['ar-SY'], + valid: ['أبت123', 'أبتَُِ١٢٣'], + invalid: ['abc ', 'foo!!', 'ÄBC', 'FÜübar', 'Jön'], }); }); - it("should validate norwegian alphanumeric strings", () => { + it('should validate norwegian alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["nb-NO"], - valid: ["ÆØÅ123", "Ære321", "321Øre", "123Åre"], - invalid: ["äbc123", "ÄBC11", ""], + validator: 'isAlphanumeric', + args: ['nb-NO'], + valid: ['ÆØÅ123', 'Ære321', '321Øre', '123Åre'], + invalid: ['äbc123', 'ÄBC11', ''], }); }); - it("should validate polish alphanumeric strings", () => { + it('should validate polish alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["pl-PL"], + validator: 'isAlphanumeric', + args: ['pl-PL'], valid: [ - "kre123ską", - "zam21knięte", - "zw23ykłe", - "123", - "prz23yjęły", - "świ23ęty", - "Poz1322wól", + 'kre123ską', + 'zam21knięte', + 'zw23ykłe', + '123', + 'prz23yjęły', + 'świ23ęty', + 'Poz1322wól', ], - invalid: ["12řiď ", "blé!!", "föö!2!"], + invalid: ['12řiď ', 'blé!!', 'föö!2!'], }); }); - it("should validate serbian cyrillic alphanumeric strings", () => { + it('should validate serbian cyrillic alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["sr-RS"], - valid: ["ШћжЂљЕ123", "ЧПСТ132ЋЏ"], - invalid: ["řiď ", "blé!!", "föö!!"], + validator: 'isAlphanumeric', + args: ['sr-RS'], + valid: ['ШћжЂљЕ123', 'ЧПСТ132ЋЏ'], + invalid: ['řiď ', 'blé!!', 'föö!!'], }); }); - it("should validate serbian latin alphanumeric strings", () => { + it('should validate serbian latin alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["sr-RS@latin"], - valid: ["ŠAabčšđćž123", "ŠATRO11Ćčđš"], - invalid: ["řiď ", "blé!!", "föö!!"], + validator: 'isAlphanumeric', + args: ['sr-RS@latin'], + valid: ['ŠAabčšđćž123', 'ŠATRO11Ćčđš'], + invalid: ['řiď ', 'blé!!', 'föö!!'], }); }); - it("should validate swedish alphanumeric strings", () => { + it('should validate swedish alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["sv-SE"], - valid: ["religiös13", "st23jäla", "västgöte123", "123Åre"], - invalid: ["AİıÖöÇ窺ĞğÜüZ", "foo!!", ""], + validator: 'isAlphanumeric', + args: ['sv-SE'], + valid: ['religiös13', 'st23jäla', 'västgöte123', '123Åre'], + invalid: ['AİıÖöÇ窺ĞğÜüZ', 'foo!!', ''], }); }); - it("should validate turkish alphanumeric strings", () => { + it('should validate turkish alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["tr-TR"], - valid: ["AİıÖöÇ窺ĞğÜüZ123"], - invalid: ["AİıÖöÇ窺ĞğÜüZ ", "foo!!", "ÄBC"], + validator: 'isAlphanumeric', + args: ['tr-TR'], + valid: ['AİıÖöÇ窺ĞğÜüZ123'], + invalid: ['AİıÖöÇ窺ĞğÜüZ ', 'foo!!', 'ÄBC'], }); }); - it("should validate urkrainian alphanumeric strings", () => { + it('should validate urkrainian alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["uk-UA"], - valid: ["АБВГҐДЕЄЖЗИIЇЙКЛМНОПРСТУФХЦШЩЬЮЯ123"], - invalid: ["éeoc ", "foo!!", "ÄBC", "ЫыЪъЭэ"], + validator: 'isAlphanumeric', + args: ['uk-UA'], + valid: ['АБВГҐДЕЄЖЗИIЇЙКЛМНОПРСТУФХЦШЩЬЮЯ123'], + invalid: ['éeoc ', 'foo!!', 'ÄBC', 'ЫыЪъЭэ'], }); }); - it("should validate greek alphanumeric strings", () => { + it('should validate greek alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["el-GR"], + validator: 'isAlphanumeric', + args: ['el-GR'], valid: [ - "αβγδεζηθικλμνξοπρςστυφχψω", - "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ", - "20θ", - "1234568960", + 'αβγδεζηθικλμνξοπρςστυφχψω', + 'ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ', + '20θ', + '1234568960', ], invalid: [ - "0AİıÖöÇ窺ĞğÜüZ1", - " AİıÖöÇ窺ĞğÜüZ ", - "ÄBC", - "Heiß", - "ЫыЪъЭэ", - "jαckγ", + '0AİıÖöÇ窺ĞğÜüZ1', + ' AİıÖöÇ窺ĞğÜüZ ', + 'ÄBC', + 'Heiß', + 'ЫыЪъЭэ', + 'jαckγ', ], }); }); - it("should validate Hebrew alphanumeric strings", () => { + it('should validate Hebrew alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["he"], - valid: ["אבג123", "שלום11"], - invalid: ["אבג ", "לא!!", "abc", " foo "], + validator: 'isAlphanumeric', + args: ['he'], + valid: ['אבג123', 'שלום11'], + invalid: ['אבג ', 'לא!!', 'abc', ' foo '], }); }); - it("should validate Thai alphanumeric strings", () => { + it('should validate Thai alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["th-TH"], - valid: ["สวัสดี ๑๒๓", "ยินดีต้อนรับทั้ง ๒ คน"], - invalid: ["1.สวัสดี", "ยินดีต้อนรับทั้ง 2 คน"], + validator: 'isAlphanumeric', + args: ['th-TH'], + valid: ['สวัสดี ๑๒๓', 'ยินดีต้อนรับทั้ง ๒ คน'], + invalid: ['1.สวัสดี', 'ยินดีต้อนรับทั้ง 2 คน'], }); }); - it("should validate Korea alphanumeric strings", () => { + it('should validate Korea alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["ko-KR"], - valid: ["2002", "훈민정음", "1446년훈민정음반포"], - invalid: ["2022!", "2019 코로나시작", "1.로렘입숨"], + validator: 'isAlphanumeric', + args: ['ko-KR'], + valid: ['2002', '훈민정음', '1446년훈민정음반포'], + invalid: ['2022!', '2019 코로나시작', '1.로렘입숨'], }); }); - it("should validate Sinhala alphanumeric strings", () => { + it('should validate Sinhala alphanumeric strings', () => { test({ - validator: "isAlphanumeric", - args: ["si-LK"], - valid: ["චතුර", "කචට12", "ඎඏදාෛපසුගො2", "1234"], - invalid: ["ஆஐअतක", "කචට 12", " ඎ ", "a1234", "abc", ""], + validator: 'isAlphanumeric', + args: ['si-LK'], + valid: ['චතුර', 'කචට12', 'ඎඏදාෛපසුගො2', '1234'], + invalid: ['ஆஐअतක', 'කචට 12', ' ඎ ', 'a1234', 'abc', ''], }); }); - it("should error on invalid locale", () => { + it('should error on invalid locale', () => { test({ - validator: "isAlphanumeric", - args: ["is-NOT"], - error: ["1234568960", "abc123"], + validator: 'isAlphanumeric', + args: ['is-NOT'], + error: ['1234568960', 'abc123'], }); }); - it("should validate numeric strings", () => { + it('should validate numeric strings', () => { test({ - validator: "isNumeric", + validator: 'isNumeric', valid: [ - "123", - "00123", - "-00123", - "0", - "-0", - "+123", - "123.123", - "+000000", + '123', + '00123', + '-00123', + '0', + '-0', + '+123', + '123.123', + '+000000', ], - invalid: [" ", "", "."], + invalid: [' ', '', '.'], }); }); - it("should validate numeric strings without symbols", () => { + it('should validate numeric strings without symbols', () => { test({ - validator: "isNumeric", + validator: 'isNumeric', args: [ { no_symbols: true, }, ], - valid: ["123", "00123", "0"], - invalid: ["-0", "+000000", "", "+123", "123.123", "-00123", " ", "."], + valid: ['123', '00123', '0'], + invalid: ['-0', '+000000', '', '+123', '123.123', '-00123', ' ', '.'], }); }); - it("should validate numeric strings with locale", () => { + it('should validate numeric strings with locale', () => { test({ - validator: "isNumeric", + validator: 'isNumeric', args: [ { - locale: "fr-FR", + locale: 'fr-FR', }, ], valid: [ - "123", - "00123", - "-00123", - "0", - "-0", - "+123", - "123,123", - "+000000", + '123', + '00123', + '-00123', + '0', + '-0', + '+123', + '123,123', + '+000000', ], - invalid: [" ", "", ","], + invalid: [' ', '', ','], }); }); - it("should validate numeric strings with locale", () => { + it('should validate numeric strings with locale', () => { test({ - validator: "isNumeric", + validator: 'isNumeric', args: [ { - locale: "fr-CA", + locale: 'fr-CA', }, ], valid: [ - "123", - "00123", - "-00123", - "0", - "-0", - "+123", - "123,123", - "+000000", + '123', + '00123', + '-00123', + '0', + '-0', + '+123', + '123,123', + '+000000', ], - invalid: [" ", "", "."], + invalid: [' ', '', '.'], }); }); - it("should validate ports", () => { + it('should validate ports', () => { test({ - validator: "isPort", - valid: ["0", "22", "80", "443", "3000", "8080", "65535"], - invalid: ["", "-1", "65536"], + validator: 'isPort', + valid: ['0', '22', '80', '443', '3000', '8080', '65535'], + invalid: ['', '-1', '65536'], }); }); - it("should validate passport number", () => { + it('should validate passport number', () => { test({ - validator: "isPassportNumber", - args: ["AM"], - valid: ["AF0549358"], - invalid: ["A1054935"], + validator: 'isPassportNumber', + args: ['AM'], + valid: ['AF0549358'], + invalid: ['A1054935'], }); test({ - validator: "isPassportNumber", - args: ["ID"], - valid: ["C1253473", "B5948378", "A4859472"], - invalid: ["D39481728", "A-3847362", "324132132"], + validator: 'isPassportNumber', + args: ['ID'], + valid: ['C1253473', 'B5948378', 'A4859472'], + invalid: ['D39481728', 'A-3847362', '324132132'], }); test({ - validator: "isPassportNumber", - args: ["AR"], - valid: ["AAC811035"], - invalid: ["A11811035"], + validator: 'isPassportNumber', + args: ['AR'], + valid: ['AAC811035'], + invalid: ['A11811035'], }); test({ - validator: "isPassportNumber", - args: ["AT"], - valid: ["P 1630837", "P 4366918"], - invalid: ["0 1630837"], + validator: 'isPassportNumber', + args: ['AT'], + valid: ['P 1630837', 'P 4366918'], + invalid: ['0 1630837'], }); test({ - validator: "isPassportNumber", - args: ["AU"], - valid: ["N0995852", "L4819236"], - invalid: ["1A012345"], + validator: 'isPassportNumber', + args: ['AU'], + valid: ['N0995852', 'L4819236'], + invalid: ['1A012345'], }); test({ - validator: "isPassportNumber", - args: ["AZ"], - valid: ["AZE16175905", "AA1617595"], - invalid: ["A12345843"], + validator: 'isPassportNumber', + args: ['AZ'], + valid: ['AZE16175905', 'AA1617595'], + invalid: ['A12345843'], }); test({ - validator: "isPassportNumber", - args: ["BE"], - valid: ["EM000000", "LA080402"], - invalid: ["00123456"], + validator: 'isPassportNumber', + args: ['BE'], + valid: ['EM000000', 'LA080402'], + invalid: ['00123456'], }); test({ - validator: "isPassportNumber", - args: ["BG"], - valid: ["346395366", "039903356"], - invalid: ["ABC123456"], + validator: 'isPassportNumber', + args: ['BG'], + valid: ['346395366', '039903356'], + invalid: ['ABC123456'], }); test({ - validator: "isPassportNumber", - args: ["BR"], - valid: ["FZ973689", "GH231233"], - invalid: ["ABX29332"], + validator: 'isPassportNumber', + args: ['BR'], + valid: ['FZ973689', 'GH231233'], + invalid: ['ABX29332'], }); test({ - validator: "isPassportNumber", - args: ["BY"], - valid: ["MP3899901"], - invalid: ["345333454", "FG53334542"], + validator: 'isPassportNumber', + args: ['BY'], + valid: ['MP3899901'], + invalid: ['345333454', 'FG53334542'], }); test({ - validator: "isPassportNumber", - args: ["CA"], - valid: ["GA302922", "ZE000509"], - invalid: ["AB0123456"], + validator: 'isPassportNumber', + args: ['CA'], + valid: ['GA302922', 'ZE000509'], + invalid: ['AB0123456'], }); test({ - validator: "isPassportNumber", - args: ["CH"], - valid: ["S1100409", "S5200073", "X4028791"], - invalid: ["AB123456"], + validator: 'isPassportNumber', + args: ['CH'], + valid: ['S1100409', 'S5200073', 'X4028791'], + invalid: ['AB123456'], }); test({ - validator: "isPassportNumber", - args: ["CN"], - valid: ["G25352389", "E00160027", "EA1234567"], + validator: 'isPassportNumber', + args: ['CN'], + valid: ['G25352389', 'E00160027', 'EA1234567'], invalid: [ - "K0123456", - "E-1234567", - "G.1234567", - "GA1234567", - "EI1234567", - "GO1234567", + 'K0123456', + 'E-1234567', + 'G.1234567', + 'GA1234567', + 'EI1234567', + 'GO1234567', ], }); test({ - validator: "isPassportNumber", - args: ["CY"], - valid: ["K00000413"], - invalid: ["K10100"], + validator: 'isPassportNumber', + args: ['CY'], + valid: ['K00000413'], + invalid: ['K10100'], }); test({ - validator: "isPassportNumber", - args: ["CZ"], - valid: ["99003853", "42747260"], - invalid: ["012345678", "AB123456"], + validator: 'isPassportNumber', + args: ['CZ'], + valid: ['99003853', '42747260'], + invalid: ['012345678', 'AB123456'], }); test({ - validator: "isPassportNumber", - args: ["DE"], - valid: ["C01X00T47", "C26VMVVC3"], - invalid: ["AS0123456", "A012345678"], + validator: 'isPassportNumber', + args: ['DE'], + valid: ['C01X00T47', 'C26VMVVC3'], + invalid: ['AS0123456', 'A012345678'], }); test({ - validator: "isPassportNumber", - args: ["DK"], - valid: ["900010172"], - invalid: ["01234567", "K01234567"], + validator: 'isPassportNumber', + args: ['DK'], + valid: ['900010172'], + invalid: ['01234567', 'K01234567'], }); test({ - validator: "isPassportNumber", - args: ["DZ"], - valid: ["855609385", "154472412", "197025599"], + validator: 'isPassportNumber', + args: ['DZ'], + valid: ['855609385', '154472412', '197025599'], invalid: [ - "AS0123456", - "A012345678", - "0123456789", - "12345678", - "98KK54321", + 'AS0123456', + 'A012345678', + '0123456789', + '12345678', + '98KK54321', ], }); test({ - validator: "isPassportNumber", - args: ["EE"], - valid: ["K4218285", "K3295867", "KB0167630", "VD0023777"], - invalid: ["K01234567", "KB00112233"], + validator: 'isPassportNumber', + args: ['EE'], + valid: ['K4218285', 'K3295867', 'KB0167630', 'VD0023777'], + invalid: ['K01234567', 'KB00112233'], }); test({ - validator: "isPassportNumber", - args: ["ES"], - valid: ["AF238143", "ZAB000254"], - invalid: ["AF01234567"], + validator: 'isPassportNumber', + args: ['ES'], + valid: ['AF238143', 'ZAB000254'], + invalid: ['AF01234567'], }); test({ - validator: "isPassportNumber", - args: ["FI"], - valid: ["XP8271602", "XD8500003"], - invalid: ["A01234567", "ABC012345"], + validator: 'isPassportNumber', + args: ['FI'], + valid: ['XP8271602', 'XD8500003'], + invalid: ['A01234567', 'ABC012345'], }); test({ - validator: "isPassportNumber", - args: ["FR"], - valid: ["10CV28144", "60RF19342", "05RP34083"], - invalid: ["012345678", "AB0123456", "01C234567"], + validator: 'isPassportNumber', + args: ['FR'], + valid: ['10CV28144', '60RF19342', '05RP34083'], + invalid: ['012345678', 'AB0123456', '01C234567'], }); test({ - validator: "isPassportNumber", - args: ["GB"], - valid: ["925076473", "107182890", "104121156"], - invalid: ["A012345678", "K000000000", "0123456789"], + validator: 'isPassportNumber', + args: ['GB'], + valid: ['925076473', '107182890', '104121156'], + invalid: ['A012345678', 'K000000000', '0123456789'], }); test({ - validator: "isPassportNumber", - args: ["GR"], - valid: ["AE0000005", "AK0219304"], - invalid: ["A01234567", "012345678"], + validator: 'isPassportNumber', + args: ['GR'], + valid: ['AE0000005', 'AK0219304'], + invalid: ['A01234567', '012345678'], }); test({ - validator: "isPassportNumber", - args: ["HR"], - valid: ["007007007", "138463188"], - invalid: ["A01234567", "00112233"], + validator: 'isPassportNumber', + args: ['HR'], + valid: ['007007007', '138463188'], + invalid: ['A01234567', '00112233'], }); test({ - validator: "isPassportNumber", - args: ["HU"], - valid: ["ZA084505", "BA0006902"], - invalid: ["A01234567", "012345678"], + validator: 'isPassportNumber', + args: ['HU'], + valid: ['ZA084505', 'BA0006902'], + invalid: ['A01234567', '012345678'], }); test({ - validator: "isPassportNumber", - args: ["IE"], - valid: ["D23145890", "X65097105", "XN0019390"], - invalid: ["XND012345", "0123456789"], + validator: 'isPassportNumber', + args: ['IE'], + valid: ['D23145890', 'X65097105', 'XN0019390'], + invalid: ['XND012345', '0123456789'], }); test({ - validator: "isPassportNumber", - args: ["IN"], - valid: ["A-1234567", "A1234567", "X0019390"], - invalid: ["AB-1234567", "0123456789"], + validator: 'isPassportNumber', + args: ['IN'], + valid: ['A-1234567', 'A1234567', 'X0019390'], + invalid: ['AB-1234567', '0123456789'], }); test({ - validator: "isPassportNumber", - args: ["IR"], - valid: ["J97634522", "A01234567", "Z11977831"], - invalid: ["A0123456", "A0123456Z", "012345678"], + validator: 'isPassportNumber', + args: ['IR'], + valid: ['J97634522', 'A01234567', 'Z11977831'], + invalid: ['A0123456', 'A0123456Z', '012345678'], }); test({ - validator: "isPassportNumber", - args: ["IS"], - valid: ["A2040611", "A1197783"], - invalid: ["K0000000", "01234567"], + validator: 'isPassportNumber', + args: ['IS'], + valid: ['A2040611', 'A1197783'], + invalid: ['K0000000', '01234567'], }); test({ - validator: "isPassportNumber", - args: ["IT"], - valid: ["YA8335453", "KK0000000"], - invalid: ["01234567", "KAK001122"], + validator: 'isPassportNumber', + args: ['IT'], + valid: ['YA8335453', 'KK0000000'], + invalid: ['01234567', 'KAK001122'], }); test({ - validator: "isPassportNumber", - args: ["JM"], - valid: ["A0123456"], - invalid: ["s0123456", "a01234567"], + validator: 'isPassportNumber', + args: ['JM'], + valid: ['A0123456'], + invalid: ['s0123456', 'a01234567'], }); test({ - validator: "isPassportNumber", - args: ["JP"], - valid: ["NH1106002", "TE3180251", "XS1234567"], - invalid: ["X12345678", "012345678"], + validator: 'isPassportNumber', + args: ['JP'], + valid: ['NH1106002', 'TE3180251', 'XS1234567'], + invalid: ['X12345678', '012345678'], }); test({ - validator: "isPassportNumber", - args: ["KR"], - valid: ["M35772699", "M70689098"], - invalid: ["X12345678", "012345678"], + validator: 'isPassportNumber', + args: ['KR'], + valid: ['M35772699', 'M70689098'], + invalid: ['X12345678', '012345678'], }); test({ - validator: "isPassportNumber", - args: ["KZ"], - valid: ["A0123456", "b0123456"], - invalid: ["01234567", "bb0123456"], + validator: 'isPassportNumber', + args: ['KZ'], + valid: ['A0123456', 'b0123456'], + invalid: ['01234567', 'bb0123456'], }); test({ - validator: "isPassportNumber", - args: ["LI"], - valid: ["a01234", "f01234"], - invalid: ["012345"], + validator: 'isPassportNumber', + args: ['LI'], + valid: ['a01234', 'f01234'], + invalid: ['012345'], }); test({ - validator: "isPassportNumber", - args: ["LT"], - valid: ["20200997", "LB311756"], - invalid: ["LB01234567"], + validator: 'isPassportNumber', + args: ['LT'], + valid: ['20200997', 'LB311756'], + invalid: ['LB01234567'], }); test({ - validator: "isPassportNumber", - args: ["LU"], - valid: ["JCU9J4T2", "JC4E7L2H"], - invalid: ["JCU9J4T", "JC4E7L2H0"], + validator: 'isPassportNumber', + args: ['LU'], + valid: ['JCU9J4T2', 'JC4E7L2H'], + invalid: ['JCU9J4T', 'JC4E7L2H0'], }); test({ - validator: "isPassportNumber", - args: ["LV"], - valid: ["LV9000339", "LV4017173"], - invalid: ["LV01234567", "4017173LV"], + validator: 'isPassportNumber', + args: ['LV'], + valid: ['LV9000339', 'LV4017173'], + invalid: ['LV01234567', '4017173LV'], }); test({ - validator: "isPassportNumber", - args: ["LY"], - valid: ["P79JF34X", "RJ45H4V2"], - invalid: ["P79JF34", "RJ45H4V2C", "RJ4-H4V2"], + validator: 'isPassportNumber', + args: ['LY'], + valid: ['P79JF34X', 'RJ45H4V2'], + invalid: ['P79JF34', 'RJ45H4V2C', 'RJ4-H4V2'], }); test({ - validator: "isPassportNumber", - args: ["MT"], - valid: ["1026564"], - invalid: ["01234567", "MT01234"], + validator: 'isPassportNumber', + args: ['MT'], + valid: ['1026564'], + invalid: ['01234567', 'MT01234'], }); test({ - validator: "isPassportNumber", - args: ["MZ"], - valid: ["AB0808212", "08AB12123"], - invalid: ["1AB011241", "1AB01121", "ABAB01121"], + validator: 'isPassportNumber', + args: ['MZ'], + valid: ['AB0808212', '08AB12123'], + invalid: ['1AB011241', '1AB01121', 'ABAB01121'], }); test({ - validator: "isPassportNumber", - args: ["MY"], - valid: ["A00000000", "H12345678", "K43143233"], - invalid: ["A1234567", "C01234567"], + validator: 'isPassportNumber', + args: ['MY'], + valid: ['A00000000', 'H12345678', 'K43143233'], + invalid: ['A1234567', 'C01234567'], }); test({ - validator: "isPassportNumber", - args: ["MX"], - valid: ["43986369222", "01234567890"], - invalid: ["ABC34567890", "34567890"], + validator: 'isPassportNumber', + args: ['MX'], + valid: ['43986369222', '01234567890'], + invalid: ['ABC34567890', '34567890'], }); test({ - validator: "isPassportNumber", - args: ["NL"], - valid: ["XTR110131", "XR1001R58"], - invalid: ["XTR11013R", "XR1001R58A"], + validator: 'isPassportNumber', + args: ['NL'], + valid: ['XTR110131', 'XR1001R58'], + invalid: ['XTR11013R', 'XR1001R58A'], }); test({ - validator: "isPassportNumber", - args: ["PK"], - valid: ["QZ1791293", "XR1001458"], - invalid: ["XTR11013R", "XR1001R58A"], + validator: 'isPassportNumber', + args: ['PK'], + valid: ['QZ1791293', 'XR1001458'], + invalid: ['XTR11013R', 'XR1001R58A'], }); test({ - validator: "isPassportNumber", - args: ["PH"], - valid: ["X123456", "XY123456", "XY1234567", "X1234567Y"], - invalid: ["XY12345", "X12345Z", "XY12345Z"], + validator: 'isPassportNumber', + args: ['PH'], + valid: ['X123456', 'XY123456', 'XY1234567', 'X1234567Y'], + invalid: ['XY12345', 'X12345Z', 'XY12345Z'], }); test({ - validator: "isPassportNumber", - args: ["NZ"], + validator: 'isPassportNumber', + args: ['NZ'], valid: [ - "Lf012345", - "La012345", - "Ld012345", - "Lh012345", - "ea012345", - "ep012345", - "n012345", + 'Lf012345', + 'La012345', + 'Ld012345', + 'Lh012345', + 'ea012345', + 'ep012345', + 'n012345', ], - invalid: ["Lp012345", "nd012345", "ed012345", "eh012345", "ef012345"], + invalid: ['Lp012345', 'nd012345', 'ed012345', 'eh012345', 'ef012345'], }); test({ - validator: "isPassportNumber", - args: ["PL"], - valid: ["ZS 0000177", "AN 3000011"], - invalid: ["A1 0000177", "012345678"], + validator: 'isPassportNumber', + args: ['PL'], + valid: ['ZS 0000177', 'AN 3000011'], + invalid: ['A1 0000177', '012345678'], }); test({ - validator: "isPassportNumber", - args: ["PT"], - valid: ["I700044", "K453286"], - invalid: ["0700044", "K4532861"], + validator: 'isPassportNumber', + args: ['PT'], + valid: ['I700044', 'K453286'], + invalid: ['0700044', 'K4532861'], }); test({ - validator: "isPassportNumber", - args: ["RO"], - valid: ["05485968", "040005646"], - invalid: ["R05485968", "0511060461"], + validator: 'isPassportNumber', + args: ['RO'], + valid: ['05485968', '040005646'], + invalid: ['R05485968', '0511060461'], }); test({ - validator: "isPassportNumber", - args: ["RU"], - valid: ["2 32 636829", "012 345321", "439863692"], + validator: 'isPassportNumber', + args: ['RU'], + valid: ['2 32 636829', '012 345321', '439863692'], invalid: [ - "A 2R YU46J0", - "01A 3D5321", - "SF233D53T", - "12345678", - "1234567890", + 'A 2R YU46J0', + '01A 3D5321', + 'SF233D53T', + '12345678', + '1234567890', ], }); test({ - validator: "isPassportNumber", - args: ["SE"], - valid: ["59000001", "56702928"], - invalid: ["SE012345", "012345678"], + validator: 'isPassportNumber', + args: ['SE'], + valid: ['59000001', '56702928'], + invalid: ['SE012345', '012345678'], }); test({ - validator: "isPassportNumber", - args: ["SL"], - valid: ["PB0036440", "PB1390281"], - invalid: ["SL0123456", "P01234567"], + validator: 'isPassportNumber', + args: ['SL'], + valid: ['PB0036440', 'PB1390281'], + invalid: ['SL0123456', 'P01234567'], }); test({ - validator: "isPassportNumber", - args: ["SK"], - valid: ["P0000000"], - invalid: ["SK012345", "012345678"], + validator: 'isPassportNumber', + args: ['SK'], + valid: ['P0000000'], + invalid: ['SK012345', '012345678'], }); test({ - validator: "isPassportNumber", - args: ["TH"], - valid: ["A123456", "B1234567", "CD123456", "EF1234567"], - invalid: ["123456", "1234567", "010485371AA"], + validator: 'isPassportNumber', + args: ['TH'], + valid: ['A123456', 'B1234567', 'CD123456', 'EF1234567'], + invalid: ['123456', '1234567', '010485371AA'], }); test({ - validator: "isPassportNumber", - args: ["TR"], - valid: ["U 06764100", "U 01048537"], - invalid: ["06764100U", "010485371"], + validator: 'isPassportNumber', + args: ['TR'], + valid: ['U 06764100', 'U 01048537'], + invalid: ['06764100U', '010485371'], }); test({ - validator: "isPassportNumber", - args: ["UA"], - valid: ["EH345655", "EK000001", "AP841503"], - invalid: ["01234567", "012345EH", "A012345P"], + validator: 'isPassportNumber', + args: ['UA'], + valid: ['EH345655', 'EK000001', 'AP841503'], + invalid: ['01234567', '012345EH', 'A012345P'], }); test({ - validator: "isPassportNumber", - args: ["US"], - valid: ["790369937", "340007237"], - invalid: ["US0123456", "0123456US", "7903699371"], + validator: 'isPassportNumber', + args: ['US'], + valid: ['790369937', '340007237'], + invalid: ['US0123456', '0123456US', '7903699371'], }); }); - it("should validate decimal numbers", () => { + it('should validate decimal numbers', () => { test({ - validator: "isDecimal", + validator: 'isDecimal', valid: [ - "123", - "00123", - "-00123", - "0", - "-0", - "+123", - "0.01", - ".1", - "1.0", - "-.25", - "-0", - "0.0000000000001", + '123', + '00123', + '-00123', + '0', + '-0', + '+123', + '0.01', + '.1', + '1.0', + '-.25', + '-0', + '0.0000000000001', ], invalid: [ - "0,01", - ",1", - "1,0", - "-,25", - "0,0000000000001", - "0٫01", - "٫1", - "1٫0", - "-٫25", - "0٫0000000000001", - "....", - " ", - "", - "-", - "+", - ".", - "0.1a", - "a", - "\n", + '0,01', + ',1', + '1,0', + '-,25', + '0,0000000000001', + '0٫01', + '٫1', + '1٫0', + '-٫25', + '0٫0000000000001', + '....', + ' ', + '', + '-', + '+', + '.', + '0.1a', + 'a', + '\n', ], }); test({ - validator: "isDecimal", - args: [{ locale: "en-AU" }], + validator: 'isDecimal', + args: [{ locale: 'en-AU' }], valid: [ - "123", - "00123", - "-00123", - "0", - "-0", - "+123", - "0.01", - ".1", - "1.0", - "-.25", - "-0", - "0.0000000000001", - ], - invalid: [ - "0,01", - ",1", - "1,0", - "-,25", - "0,0000000000001", - "0٫01", - "٫1", - "1٫0", - "-٫25", - "0٫0000000000001", - "....", - " ", - "", - "-", - "+", - ".", - "0.1a", - "a", - "\n", - ], - }); - - test({ - validator: "isDecimal", - args: [{ locale: ["bg-BG"] }], - valid: [ - "123", - "00123", - "-00123", - "0", - "-0", - "+123", - "0,01", - ",1", - "1,0", - "-,25", - "-0", - "0,0000000000001", - ], - invalid: [ - "0.0000000000001", - "0.01", - ".1", - "1.0", - "-.25", - "0٫01", - "٫1", - "1٫0", - "-٫25", - "0٫0000000000001", - "....", - " ", - "", - "-", - "+", - ".", - "0.1a", - "a", - "\n", - ], - }); - - test({ - validator: "isDecimal", - args: [{ locale: ["cs-CZ"] }], - valid: [ - "123", - "00123", - "-00123", - "0", - "-0", - "+123", - "0,01", - ",1", - "1,0", - "-,25", - "-0", - "0,0000000000001", - ], - invalid: [ - "0.0000000000001", - "0.01", - ".1", - "1.0", - "-.25", - "0٫01", - "٫1", - "1٫0", - "-٫25", - "0٫0000000000001", - "....", - " ", - "", - "-", - "+", - ".", - "0.1a", - "a", - "\n", - ], - }); - - test({ - validator: "isDecimal", - args: [{ locale: ["ar-JO"] }], - valid: [ - "123", - "00123", - "-00123", - "0", - "-0", - "+123", - "0٫01", - "٫1", - "1٫0", - "-٫25", - "-0", - "0٫0000000000001", - ], - invalid: [ - "0,0000000000001", - "0,01", - ",1", - "1,0", - "-,25", - "0.0000000000001", - "0.01", - ".1", - "1.0", - "-.25", - "....", - " ", - "", - "-", - "+", - ".", - "0.1a", - "a", - "\n", - ], - }); - - test({ - validator: "isDecimal", - args: [{ locale: ["ar-EG"] }], - valid: ["0.01"], - invalid: ["0,01"], - }); - - test({ - validator: "isDecimal", - args: [{ locale: ["en-ZM"] }], - valid: ["0,01"], - invalid: ["0.01"], - }); - - test({ - validator: "isDecimal", + '123', + '00123', + '-00123', + '0', + '-0', + '+123', + '0.01', + '.1', + '1.0', + '-.25', + '-0', + '0.0000000000001', + ], + invalid: [ + '0,01', + ',1', + '1,0', + '-,25', + '0,0000000000001', + '0٫01', + '٫1', + '1٫0', + '-٫25', + '0٫0000000000001', + '....', + ' ', + '', + '-', + '+', + '.', + '0.1a', + 'a', + '\n', + ], + }); + + test({ + validator: 'isDecimal', + args: [{ locale: ['bg-BG'] }], + valid: [ + '123', + '00123', + '-00123', + '0', + '-0', + '+123', + '0,01', + ',1', + '1,0', + '-,25', + '-0', + '0,0000000000001', + ], + invalid: [ + '0.0000000000001', + '0.01', + '.1', + '1.0', + '-.25', + '0٫01', + '٫1', + '1٫0', + '-٫25', + '0٫0000000000001', + '....', + ' ', + '', + '-', + '+', + '.', + '0.1a', + 'a', + '\n', + ], + }); + + test({ + validator: 'isDecimal', + args: [{ locale: ['cs-CZ'] }], + valid: [ + '123', + '00123', + '-00123', + '0', + '-0', + '+123', + '0,01', + ',1', + '1,0', + '-,25', + '-0', + '0,0000000000001', + ], + invalid: [ + '0.0000000000001', + '0.01', + '.1', + '1.0', + '-.25', + '0٫01', + '٫1', + '1٫0', + '-٫25', + '0٫0000000000001', + '....', + ' ', + '', + '-', + '+', + '.', + '0.1a', + 'a', + '\n', + ], + }); + + test({ + validator: 'isDecimal', + args: [{ locale: ['ar-JO'] }], + valid: [ + '123', + '00123', + '-00123', + '0', + '-0', + '+123', + '0٫01', + '٫1', + '1٫0', + '-٫25', + '-0', + '0٫0000000000001', + ], + invalid: [ + '0,0000000000001', + '0,01', + ',1', + '1,0', + '-,25', + '0.0000000000001', + '0.01', + '.1', + '1.0', + '-.25', + '....', + ' ', + '', + '-', + '+', + '.', + '0.1a', + 'a', + '\n', + ], + }); + + test({ + validator: 'isDecimal', + args: [{ locale: ['ar-EG'] }], + valid: ['0.01'], + invalid: ['0,01'], + }); + + test({ + validator: 'isDecimal', + args: [{ locale: ['en-ZM'] }], + valid: ['0,01'], + invalid: ['0.01'], + }); + + test({ + validator: 'isDecimal', args: [{ force_decimal: true }], - valid: ["0.01", ".1", "1.0", "-.25", "0.0000000000001"], + valid: ['0.01', '.1', '1.0', '-.25', '0.0000000000001'], invalid: [ - "-0", - "123", - "00123", - "-00123", - "0", - "-0", - "+123", - "0,0000000000001", - "0,01", - ",1", - "1,0", - "-,25", - "....", - " ", - "", - "-", - "+", - ".", - "0.1a", - "a", - "\n", + '-0', + '123', + '00123', + '-00123', + '0', + '-0', + '+123', + '0,0000000000001', + '0,01', + ',1', + '1,0', + '-,25', + '....', + ' ', + '', + '-', + '+', + '.', + '0.1a', + 'a', + '\n', ], }); test({ - validator: "isDecimal", - args: [{ decimal_digits: "2,3" }], + validator: 'isDecimal', + args: [{ decimal_digits: '2,3' }], valid: [ - "123", - "00123", - "-00123", - "0", - "-0", - "+123", - "0.01", - "1.043", - ".15", - "-.255", - "-0", + '123', + '00123', + '-00123', + '0', + '-0', + '+123', + '0.01', + '1.043', + '.15', + '-.255', + '-0', ], invalid: [ - "0.0000000000001", - "0.0", - ".1", - "1.0", - "-.2564", - "0.0", - "٫1", - "1٫0", - "-٫25", - "0٫0000000000001", - "....", - " ", - "", - "-", - "+", - ".", - "0.1a", - "a", - "\n", + '0.0000000000001', + '0.0', + '.1', + '1.0', + '-.2564', + '0.0', + '٫1', + '1٫0', + '-٫25', + '0٫0000000000001', + '....', + ' ', + '', + '-', + '+', + '.', + '0.1a', + 'a', + '\n', ], }); }); - it("should error on invalid locale", () => { + it('should error on invalid locale', () => { test({ - validator: "isDecimal", - args: [{ locale: ["is-NOT"] }], - error: ["123", "0.01", "0,01"], + validator: 'isDecimal', + args: [{ locale: ['is-NOT'] }], + error: ['123', '0.01', '0,01'], }); }); - it("should validate lowercase strings", () => { + it('should validate lowercase strings', () => { test({ - validator: "isLowercase", - valid: ["abc", "abc123", "this is lowercase.", "tr竪s 端ber"], - invalid: ["fooBar", "123A"], + validator: 'isLowercase', + valid: ['abc', 'abc123', 'this is lowercase.', 'tr竪s 端ber'], + invalid: ['fooBar', '123A'], }); }); - it("should validate imei strings", () => { + it('should validate imei strings', () => { test({ - validator: "isIMEI", + validator: 'isIMEI', valid: [ - "352099001761481", - "868932036356090", - "490154203237518", - "546918475942169", - "998227667144730", - "532729766805999", + '352099001761481', + '868932036356090', + '490154203237518', + '546918475942169', + '998227667144730', + '532729766805999', ], - invalid: ["490154203237517", "3568680000414120", "3520990017614823"], + invalid: ['490154203237517', '3568680000414120', '3520990017614823'], }); }); - it("should validate imei strings with hyphens", () => { + it('should validate imei strings with hyphens', () => { test({ - validator: "isIMEI", + validator: 'isIMEI', args: [{ allow_hyphens: true }], valid: [ - "35-209900-176148-1", - "86-893203-635609-0", - "49-015420-323751-8", - "54-691847-594216-9", - "99-822766-714473-0", - "53-272976-680599-9", + '35-209900-176148-1', + '86-893203-635609-0', + '49-015420-323751-8', + '54-691847-594216-9', + '99-822766-714473-0', + '53-272976-680599-9', ], invalid: [ - "49-015420-323751-7", - "35-686800-0041412-0", - "35-209900-1761482-3", + '49-015420-323751-7', + '35-686800-0041412-0', + '35-209900-1761482-3', ], }); }); - it("should validate uppercase strings", () => { + it('should validate uppercase strings', () => { test({ - validator: "isUppercase", - valid: ["ABC", "ABC123", "ALL CAPS IS FUN.", " ."], - invalid: ["fooBar", "123abc"], + validator: 'isUppercase', + valid: ['ABC', 'ABC123', 'ALL CAPS IS FUN.', ' .'], + invalid: ['fooBar', '123abc'], }); }); - it("should validate integers", () => { + it('should validate integers', () => { test({ - validator: "isInt", - valid: ["13", "123", "0", "123", "-0", "+1", "01", "-01", "000"], - invalid: ["100e10", "123.123", " ", ""], + validator: 'isInt', + valid: ['13', '123', '0', '123', '-0', '+1', '01', '-01', '000'], + invalid: ['100e10', '123.123', ' ', ''], }); test({ - validator: "isInt", + validator: 'isInt', args: [{ allow_leading_zeroes: false }], - valid: ["13", "123", "0", "123", "-0", "+1"], - invalid: ["01", "-01", "000", "100e10", "123.123", " ", ""], + valid: ['13', '123', '0', '123', '-0', '+1'], + invalid: ['01', '-01', '000', '100e10', '123.123', ' ', ''], }); test({ - validator: "isInt", + validator: 'isInt', args: [{ allow_leading_zeroes: true }], valid: [ - "13", - "123", - "0", - "123", - "-0", - "+1", - "01", - "-01", - "000", - "-000", - "+000", + '13', + '123', + '0', + '123', + '-0', + '+1', + '01', + '-01', + '000', + '-000', + '+000', ], - invalid: ["100e10", "123.123", " ", ""], + invalid: ['100e10', '123.123', ' ', ''], }); test({ - validator: "isInt", + validator: 'isInt', args: [ { min: 10, }, ], - valid: ["15", "80", "99"], - invalid: ["9", "6", "3.2", "a"], + valid: ['15', '80', '99'], + invalid: ['9', '6', '3.2', 'a'], }); test({ - validator: "isInt", + validator: 'isInt', args: [ { min: 10, max: 15, }, ], - valid: ["15", "11", "13"], - invalid: ["9", "2", "17", "3.2", "33", "a"], + valid: ['15', '11', '13'], + invalid: ['9', '2', '17', '3.2', '33', 'a'], }); test({ - validator: "isInt", + validator: 'isInt', args: [ { gt: 10, lt: 15, }, ], - valid: ["14", "11", "13"], - invalid: ["10", "15", "17", "3.2", "33", "a"], + valid: ['14', '11', '13'], + invalid: ['10', '15', '17', '3.2', '33', 'a'], }); }); - it("should validate floats", () => { + it('should validate floats', () => { test({ - validator: "isFloat", + validator: 'isFloat', valid: [ - "123", - "123.", - "123.123", - "-123.123", - "-0.123", - "+0.123", - "0.123", - ".0", - "-.123", - "+.123", - "01.123", - "-0.22250738585072011e-307", + '123', + '123.', + '123.123', + '-123.123', + '-0.123', + '+0.123', + '0.123', + '.0', + '-.123', + '+.123', + '01.123', + '-0.22250738585072011e-307', ], invalid: [ - "+", - "-", - " ", - "", - ".", - ",", - "foo", - "20.foo", - "2020-01-06T14:31:00.135Z", + '+', + '-', + ' ', + '', + '.', + ',', + 'foo', + '20.foo', + '2020-01-06T14:31:00.135Z', ], }); test({ - validator: "isFloat", - args: [{ locale: "en-AU" }], + validator: 'isFloat', + args: [{ locale: 'en-AU' }], valid: [ - "123", - "123.", - "123.123", - "-123.123", - "-0.123", - "+0.123", - "0.123", - ".0", - "-.123", - "+.123", - "01.123", - "-0.22250738585072011e-307", + '123', + '123.', + '123.123', + '-123.123', + '-0.123', + '+0.123', + '0.123', + '.0', + '-.123', + '+.123', + '01.123', + '-0.22250738585072011e-307', ], - invalid: ["123٫123", "123,123", " ", "", ".", "foo"], + invalid: ['123٫123', '123,123', ' ', '', '.', 'foo'], }); test({ - validator: "isFloat", - args: [{ locale: "de-DE" }], + validator: 'isFloat', + args: [{ locale: 'de-DE' }], valid: [ - "123", - "123,", - "123,123", - "-123,123", - "-0,123", - "+0,123", - "0,123", - ",0", - "-,123", - "+,123", - "01,123", - "-0,22250738585072011e-307", + '123', + '123,', + '123,123', + '-123,123', + '-0,123', + '+0,123', + '0,123', + ',0', + '-,123', + '+,123', + '01,123', + '-0,22250738585072011e-307', ], - invalid: ["123.123", "123٫123", " ", "", ".", "foo"], + invalid: ['123.123', '123٫123', ' ', '', '.', 'foo'], }); test({ - validator: "isFloat", - args: [{ locale: "ar-JO" }], + validator: 'isFloat', + args: [{ locale: 'ar-JO' }], valid: [ - "123", - "123٫", - "123٫123", - "-123٫123", - "-0٫123", - "+0٫123", - "0٫123", - "٫0", - "-٫123", - "+٫123", - "01٫123", - "-0٫22250738585072011e-307", + '123', + '123٫', + '123٫123', + '-123٫123', + '-0٫123', + '+0٫123', + '0٫123', + '٫0', + '-٫123', + '+٫123', + '01٫123', + '-0٫22250738585072011e-307', ], - invalid: ["123,123", "123.123", " ", "", ".", "foo"], + invalid: ['123,123', '123.123', ' ', '', '.', 'foo'], }); test({ - validator: "isFloat", + validator: 'isFloat', args: [ { min: 3.7, }, ], - valid: ["3.888", "3.92", "4.5", "50", "3.7", "3.71"], - invalid: ["3.6", "3.69", "3", "1.5", "a"], + valid: ['3.888', '3.92', '4.5', '50', '3.7', '3.71'], + invalid: ['3.6', '3.69', '3', '1.5', 'a'], }); test({ - validator: "isFloat", + validator: 'isFloat', args: [ { min: 0.1, max: 1.0, }, ], - valid: ["0.1", "1.0", "0.15", "0.33", "0.57", "0.7"], - invalid: ["0", "0.0", "a", "1.3", "0.05", "5"], + valid: ['0.1', '1.0', '0.15', '0.33', '0.57', '0.7'], + invalid: ['0', '0.0', 'a', '1.3', '0.05', '5'], }); test({ - validator: "isFloat", + validator: 'isFloat', args: [ { gt: -5.5, lt: 10, }, ], - valid: ["9.9", "1.0", "0", "-1", "7", "-5.4"], - invalid: ["10", "-5.5", "a", "-20.3", "20e3", "10.00001"], + valid: ['9.9', '1.0', '0', '-1', '7', '-5.4'], + invalid: ['10', '-5.5', 'a', '-20.3', '20e3', '10.00001'], }); test({ - validator: "isFloat", + validator: 'isFloat', args: [ { min: -5.5, @@ -3187,1612 +3187,1612 @@ describe("Validators", () => { lt: 10, }, ], - valid: ["9.99999", "-5.499999"], - invalid: ["10", "-5.5"], + valid: ['9.99999', '-5.499999'], + invalid: ['10', '-5.5'], }); test({ - validator: "isFloat", + validator: 'isFloat', args: [ { - locale: "de-DE", + locale: 'de-DE', min: 3.1, }, ], - valid: ["123", "123,", "123,123", "3,1", "3,100001"], + valid: ['123', '123,', '123,123', '3,1', '3,100001'], invalid: [ - "3,09", - "-,123", - "+,123", - "01,123", - "-0,22250738585072011e-307", - "-123,123", - "-0,123", - "+0,123", - "0,123", - ",0", - "123.123", - "123٫123", - " ", - "", - ".", - "foo", + '3,09', + '-,123', + '+,123', + '01,123', + '-0,22250738585072011e-307', + '-123,123', + '-0,123', + '+0,123', + '0,123', + ',0', + '123.123', + '123٫123', + ' ', + '', + '.', + 'foo', ], }); }); - it("should validate hexadecimal strings", () => { + it('should validate hexadecimal strings', () => { test({ - validator: "isHexadecimal", + validator: 'isHexadecimal', valid: [ - "deadBEEF", - "ff0044", - "0xff0044", - "0XfF0044", - "0x0123456789abcDEF", - "0X0123456789abcDEF", - "0hfedCBA9876543210", - "0HfedCBA9876543210", - "0123456789abcDEF", + 'deadBEEF', + 'ff0044', + '0xff0044', + '0XfF0044', + '0x0123456789abcDEF', + '0X0123456789abcDEF', + '0hfedCBA9876543210', + '0HfedCBA9876543210', + '0123456789abcDEF', ], invalid: [ - "abcdefg", - "", - "..", - "0xa2h", - "0xa20x", - "0x0123456789abcDEFq", - "0hfedCBA9876543210q", - "01234q56789abcDEF", + 'abcdefg', + '', + '..', + '0xa2h', + '0xa20x', + '0x0123456789abcDEFq', + '0hfedCBA9876543210q', + '01234q56789abcDEF', ], }); }); - it("should validate octal strings", () => { + it('should validate octal strings', () => { test({ - validator: "isOctal", - valid: ["076543210", "0o01234567"], - invalid: ["abcdefg", "012345678", "012345670c", "00c12345670c", "", ".."], + validator: 'isOctal', + valid: ['076543210', '0o01234567'], + invalid: ['abcdefg', '012345678', '012345670c', '00c12345670c', '', '..'], }); }); - it("should validate hexadecimal color strings", () => { + it('should validate hexadecimal color strings', () => { test({ - validator: "isHexColor", - valid: ["#ff0000ff", "#ff0034", "#CCCCCC", "0f38", "fff", "#f00"], - invalid: ["#ff", "fff0a", "#ff12FG"], + validator: 'isHexColor', + valid: ['#ff0000ff', '#ff0034', '#CCCCCC', '0f38', 'fff', '#f00'], + invalid: ['#ff', 'fff0a', '#ff12FG'], }); }); - it("should validate HSL color strings", () => { + it('should validate HSL color strings', () => { test({ - validator: "isHSL", + validator: 'isHSL', valid: [ - "hsl(360,0000000000100%,000000100%)", - "hsl(000010, 00000000001%, 00000040%)", - "HSL(00000,0000000000100%,000000100%)", - "hsL(0, 0%, 0%)", - "hSl( 360 , 100% , 100% )", - "Hsl( 00150 , 000099% , 01% )", - "hsl(01080, 03%, 4%)", - "hsl(-540, 03%, 4%)", - "hsla(+540, 03%, 4%)", - "hsla(+540, 03%, 4%, 500)", - "hsl(+540deg, 03%, 4%, 500)", - "hsl(+540gRaD, 03%, 4%, 500)", - "hsl(+540.01e-98rad, 03%, 4%, 500)", - "hsl(-540.5turn, 03%, 4%, 500)", - "hsl(+540, 03%, 4%, 500e-01)", - "hsl(+540, 03%, 4%, 500e+80)", - "hsl(4.71239rad, 60%, 70%)", - "hsl(270deg, 60%, 70%)", - "hsl(200, +.1%, 62%, 1)", - "hsl(270 60% 70%)", - "hsl(200, +.1e-9%, 62e10%, 1)", - "hsl(.75turn, 60%, 70%)", + 'hsl(360,0000000000100%,000000100%)', + 'hsl(000010, 00000000001%, 00000040%)', + 'HSL(00000,0000000000100%,000000100%)', + 'hsL(0, 0%, 0%)', + 'hSl( 360 , 100% , 100% )', + 'Hsl( 00150 , 000099% , 01% )', + 'hsl(01080, 03%, 4%)', + 'hsl(-540, 03%, 4%)', + 'hsla(+540, 03%, 4%)', + 'hsla(+540, 03%, 4%, 500)', + 'hsl(+540deg, 03%, 4%, 500)', + 'hsl(+540gRaD, 03%, 4%, 500)', + 'hsl(+540.01e-98rad, 03%, 4%, 500)', + 'hsl(-540.5turn, 03%, 4%, 500)', + 'hsl(+540, 03%, 4%, 500e-01)', + 'hsl(+540, 03%, 4%, 500e+80)', + 'hsl(4.71239rad, 60%, 70%)', + 'hsl(270deg, 60%, 70%)', + 'hsl(200, +.1%, 62%, 1)', + 'hsl(270 60% 70%)', + 'hsl(200, +.1e-9%, 62e10%, 1)', + 'hsl(.75turn, 60%, 70%)', // 'hsl(200grad+.1%62%/1)', //supposed to pass, but need to handle delimiters - "hsl(200grad +.1% 62% / 1)", - "hsl(270, 60%, 50%, .15)", - "hsl(270, 60%, 50%, 15%)", - "hsl(270 60% 50% / .15)", - "hsl(270 60% 50% / 15%)", + 'hsl(200grad +.1% 62% / 1)', + 'hsl(270, 60%, 50%, .15)', + 'hsl(270, 60%, 50%, 15%)', + 'hsl(270 60% 50% / .15)', + 'hsl(270 60% 50% / 15%)', ], invalid: [ - "hsl (360,0000000000100%,000000100%)", - "hsl(0260, 100 %, 100%)", - "hsl(0160, 100%, 100%, 100 %)", - "hsl(-0160, 100%, 100a)", - "hsl(-0160, 100%, 100)", - "hsl(-0160 100%, 100%, )", - "hsl(270 deg, 60%, 70%)", - "hsl( deg, 60%, 70%)", - "hsl(, 60%, 70%)", - "hsl(3000deg, 70%)", + 'hsl (360,0000000000100%,000000100%)', + 'hsl(0260, 100 %, 100%)', + 'hsl(0160, 100%, 100%, 100 %)', + 'hsl(-0160, 100%, 100a)', + 'hsl(-0160, 100%, 100)', + 'hsl(-0160 100%, 100%, )', + 'hsl(270 deg, 60%, 70%)', + 'hsl( deg, 60%, 70%)', + 'hsl(, 60%, 70%)', + 'hsl(3000deg, 70%)', ], }); }); - it("should validate rgb color strings", () => { + it('should validate rgb color strings', () => { test({ - validator: "isRgbColor", + validator: 'isRgbColor', valid: [ - "rgb(0,0,0)", - "rgb(255,255,255)", - "rgba(0,0,0,0)", - "rgba(255,255,255,1)", - "rgba(255,255,255,.1)", - "rgba(255,255,255,0.1)", - "rgb(5%,5%,5%)", - "rgba(5%,5%,5%,.3)", + 'rgb(0,0,0)', + 'rgb(255,255,255)', + 'rgba(0,0,0,0)', + 'rgba(255,255,255,1)', + 'rgba(255,255,255,.1)', + 'rgba(255,255,255,0.1)', + 'rgb(5%,5%,5%)', + 'rgba(5%,5%,5%,.3)', ], invalid: [ - "rgb(0,0,0,)", - "rgb(0,0,)", - "rgb(0,0,256)", - "rgb()", - "rgba(0,0,0)", - "rgba(255,255,255,2)", - "rgba(255,255,255,.12)", - "rgba(255,255,256,0.1)", - "rgb(4,4,5%)", - "rgba(5%,5%,5%)", - "rgba(3,3,3%,.3)", - "rgb(101%,101%,101%)", - "rgba(3%,3%,101%,0.3)", - "rgb(101%,101%,101%) additional invalid string part", - "rgba(3%,3%,101%,0.3) additional invalid string part", + 'rgb(0,0,0,)', + 'rgb(0,0,)', + 'rgb(0,0,256)', + 'rgb()', + 'rgba(0,0,0)', + 'rgba(255,255,255,2)', + 'rgba(255,255,255,.12)', + 'rgba(255,255,256,0.1)', + 'rgb(4,4,5%)', + 'rgba(5%,5%,5%)', + 'rgba(3,3,3%,.3)', + 'rgb(101%,101%,101%)', + 'rgba(3%,3%,101%,0.3)', + 'rgb(101%,101%,101%) additional invalid string part', + 'rgba(3%,3%,101%,0.3) additional invalid string part', ], }); // test where includePercentValues is given as false test({ - validator: "isRgbColor", + validator: 'isRgbColor', args: [false], - valid: ["rgb(5,5,5)", "rgba(5,5,5,.3)"], - invalid: ["rgb(4,4,5%)", "rgba(5%,5%,5%)"], + valid: ['rgb(5,5,5)', 'rgba(5,5,5,.3)'], + invalid: ['rgb(4,4,5%)', 'rgba(5%,5%,5%)'], }); }); - it("should validate ISRC code strings", () => { + it('should validate ISRC code strings', () => { test({ - validator: "isISRC", - valid: ["USAT29900609", "GBAYE6800011", "USRC15705223", "USCA29500702"], - invalid: ["USAT2990060", "SRC15705223", "US-CA29500702", "USARC15705223"], + validator: 'isISRC', + valid: ['USAT29900609', 'GBAYE6800011', 'USRC15705223', 'USCA29500702'], + invalid: ['USAT2990060', 'SRC15705223', 'US-CA29500702', 'USARC15705223'], }); }); - it("should validate md5 strings", () => { + it('should validate md5 strings', () => { test({ - validator: "isMD5", + validator: 'isMD5', valid: [ - "d94f3f016ae679c3008de268209132f2", - "751adbc511ccbe8edf23d486fa4581cd", - "88dae00e614d8f24cfd5a8b3f8002e93", - "0bf1c35032a71a14c2f719e5a14c1e96", + 'd94f3f016ae679c3008de268209132f2', + '751adbc511ccbe8edf23d486fa4581cd', + '88dae00e614d8f24cfd5a8b3f8002e93', + '0bf1c35032a71a14c2f719e5a14c1e96', ], invalid: [ - "KYT0bf1c35032a71a14c2f719e5a14c1", - "q94375dj93458w34", - "39485729348", - "%&FHKJFvk", + 'KYT0bf1c35032a71a14c2f719e5a14c1', + 'q94375dj93458w34', + '39485729348', + '%&FHKJFvk', ], }); }); - it("should validate hash strings", () => { - ["md5", "md4", "ripemd128", "tiger128"].forEach((algorithm) => { + it('should validate hash strings', () => { + ['md5', 'md4', 'ripemd128', 'tiger128'].forEach((algorithm) => { test({ - validator: "isHash", + validator: 'isHash', args: [algorithm], valid: [ - "d94f3f016ae679c3008de268209132f2", - "751adbc511ccbe8edf23d486fa4581cd", - "88dae00e614d8f24cfd5a8b3f8002e93", - "0bf1c35032a71a14c2f719e5a14c1e96", - "d94f3F016Ae679C3008de268209132F2", - "88DAE00e614d8f24cfd5a8b3f8002E93", + 'd94f3f016ae679c3008de268209132f2', + '751adbc511ccbe8edf23d486fa4581cd', + '88dae00e614d8f24cfd5a8b3f8002e93', + '0bf1c35032a71a14c2f719e5a14c1e96', + 'd94f3F016Ae679C3008de268209132F2', + '88DAE00e614d8f24cfd5a8b3f8002E93', ], invalid: [ - "q94375dj93458w34", - "39485729348", - "%&FHKJFvk", - "KYT0bf1c35032a71a14c2f719e5a1", + 'q94375dj93458w34', + '39485729348', + '%&FHKJFvk', + 'KYT0bf1c35032a71a14c2f719e5a1', ], }); }); - ["crc32", "crc32b"].forEach((algorithm) => { + ['crc32', 'crc32b'].forEach((algorithm) => { test({ - validator: "isHash", + validator: 'isHash', args: [algorithm], valid: [ - "d94f3f01", - "751adbc5", - "88dae00e", - "0bf1c350", - "88DAE00e", - "751aDBc5", + 'd94f3f01', + '751adbc5', + '88dae00e', + '0bf1c350', + '88DAE00e', + '751aDBc5', ], invalid: [ - "KYT0bf1c35032a71a14c2f719e5a14c1", - "q94375dj93458w34", - "q943", - "39485729348", - "%&FHKJFvk", + 'KYT0bf1c35032a71a14c2f719e5a14c1', + 'q94375dj93458w34', + 'q943', + '39485729348', + '%&FHKJFvk', ], }); }); - ["sha1", "tiger160", "ripemd160"].forEach((algorithm) => { + ['sha1', 'tiger160', 'ripemd160'].forEach((algorithm) => { test({ - validator: "isHash", + validator: 'isHash', args: [algorithm], valid: [ - "3ca25ae354e192b26879f651a51d92aa8a34d8d3", - "aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d", - "beb8c3f30da46be179b8df5f5ecb5e4b10508230", - "efd5d3b190e893ed317f38da2420d63b7ae0d5ed", - "AAF4c61ddCC5e8a2dabede0f3b482cd9AEA9434D", - "3ca25AE354e192b26879f651A51d92aa8a34d8D3", + '3ca25ae354e192b26879f651a51d92aa8a34d8d3', + 'aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d', + 'beb8c3f30da46be179b8df5f5ecb5e4b10508230', + 'efd5d3b190e893ed317f38da2420d63b7ae0d5ed', + 'AAF4c61ddCC5e8a2dabede0f3b482cd9AEA9434D', + '3ca25AE354e192b26879f651A51d92aa8a34d8D3', ], invalid: [ - "KYT0bf1c35032a71a14c2f719e5a14c1", - "KYT0bf1c35032a71a14c2f719e5a14c1dsjkjkjkjkkjk", - "q94375dj93458w34", - "39485729348", - "%&FHKJFvk", + 'KYT0bf1c35032a71a14c2f719e5a14c1', + 'KYT0bf1c35032a71a14c2f719e5a14c1dsjkjkjkjkkjk', + 'q94375dj93458w34', + '39485729348', + '%&FHKJFvk', ], }); }); test({ - validator: "isHash", - args: ["sha256"], + validator: 'isHash', + args: ['sha256'], valid: [ - "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", - "1d996e033d612d9af2b44b70061ee0e868bfd14c2dd90b129e1edeb7953e7985", - "80f70bfeaed5886e33536bcfa8c05c60afef5a0e48f699a7912d5e399cdcc441", - "579282cfb65ca1f109b78536effaf621b853c9f7079664a3fbe2b519f435898c", - "2CF24dba5FB0a30e26E83b2AC5b9E29E1b161e5C1fa7425E73043362938b9824", - "80F70bFEAed5886e33536bcfa8c05c60aFEF5a0e48f699a7912d5e399cdCC441", + '2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824', + '1d996e033d612d9af2b44b70061ee0e868bfd14c2dd90b129e1edeb7953e7985', + '80f70bfeaed5886e33536bcfa8c05c60afef5a0e48f699a7912d5e399cdcc441', + '579282cfb65ca1f109b78536effaf621b853c9f7079664a3fbe2b519f435898c', + '2CF24dba5FB0a30e26E83b2AC5b9E29E1b161e5C1fa7425E73043362938b9824', + '80F70bFEAed5886e33536bcfa8c05c60aFEF5a0e48f699a7912d5e399cdCC441', ], invalid: [ - "KYT0bf1c35032a71a14c2f719e5a14c1", - "KYT0bf1c35032a71a14c2f719e5a14c1dsjkjkjkjkkjk", - "q94375dj93458w34", - "39485729348", - "%&FHKJFvk", + 'KYT0bf1c35032a71a14c2f719e5a14c1', + 'KYT0bf1c35032a71a14c2f719e5a14c1dsjkjkjkjkkjk', + 'q94375dj93458w34', + '39485729348', + '%&FHKJFvk', ], }); test({ - validator: "isHash", - args: ["sha384"], + validator: 'isHash', + args: ['sha384'], valid: [ - "3fed1f814d28dc5d63e313f8a601ecc4836d1662a19365cbdcf6870f6b56388850b58043f7ebf2418abb8f39c3a42e31", - "b330f4e575db6e73500bd3b805db1a84b5a034e5d21f0041d91eec85af1dfcb13e40bb1c4d36a72487e048ac6af74b58", - "bf547c3fc5841a377eb1519c2890344dbab15c40ae4150b4b34443d2212e5b04aa9d58865bf03d8ae27840fef430b891", - "fc09a3d11368386530f985dacddd026ae1e44e0e297c805c3429d50744e6237eb4417c20ffca8807b071823af13a3f65", - "3fed1f814d28dc5d63e313f8A601ecc4836d1662a19365CBDCf6870f6b56388850b58043f7ebf2418abb8f39c3a42e31", - "b330f4E575db6e73500bd3b805db1a84b5a034e5d21f0041d91EEC85af1dfcb13e40bb1c4d36a72487e048ac6af74b58", + '3fed1f814d28dc5d63e313f8a601ecc4836d1662a19365cbdcf6870f6b56388850b58043f7ebf2418abb8f39c3a42e31', + 'b330f4e575db6e73500bd3b805db1a84b5a034e5d21f0041d91eec85af1dfcb13e40bb1c4d36a72487e048ac6af74b58', + 'bf547c3fc5841a377eb1519c2890344dbab15c40ae4150b4b34443d2212e5b04aa9d58865bf03d8ae27840fef430b891', + 'fc09a3d11368386530f985dacddd026ae1e44e0e297c805c3429d50744e6237eb4417c20ffca8807b071823af13a3f65', + '3fed1f814d28dc5d63e313f8A601ecc4836d1662a19365CBDCf6870f6b56388850b58043f7ebf2418abb8f39c3a42e31', + 'b330f4E575db6e73500bd3b805db1a84b5a034e5d21f0041d91EEC85af1dfcb13e40bb1c4d36a72487e048ac6af74b58', ], invalid: [ - "KYT0bf1c35032a71a14c2f719e5a14c1", - "KYT0bf1c35032a71a14c2f719e5a14c1dsjkjkjkjkkjk", - "q94375dj93458w34", - "39485729348", - "%&FHKJFvk", + 'KYT0bf1c35032a71a14c2f719e5a14c1', + 'KYT0bf1c35032a71a14c2f719e5a14c1dsjkjkjkjkkjk', + 'q94375dj93458w34', + '39485729348', + '%&FHKJFvk', ], }); test({ - validator: "isHash", - args: ["sha512"], + validator: 'isHash', + args: ['sha512'], valid: [ - "9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043", - "83c586381bf5ba94c8d9ba8b6b92beb0997d76c257708742a6c26d1b7cbb9269af92d527419d5b8475f2bb6686d2f92a6649b7f174c1d8306eb335e585ab5049", - "45bc5fa8cb45ee408c04b6269e9f1e1c17090c5ce26ffeeda2af097735b29953ce547e40ff3ad0d120e5361cc5f9cee35ea91ecd4077f3f589b4d439168f91b9", - "432ac3d29e4f18c7f604f7c3c96369a6c5c61fc09bf77880548239baffd61636d42ed374f41c261e424d20d98e320e812a6d52865be059745fdb2cb20acff0ab", - "9B71D224bd62f3785D96d46ad3ea3d73319bFBC2890CAAdae2dff72519673CA72323C3d99ba5c11d7c7ACC6e14b8c5DA0c4663475c2E5c3adef46f73bcDEC043", - "432AC3d29E4f18c7F604f7c3c96369A6C5c61fC09Bf77880548239baffd61636d42ed374f41c261e424d20d98e320e812a6d52865be059745fdb2cb20acff0ab", + '9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043', + '83c586381bf5ba94c8d9ba8b6b92beb0997d76c257708742a6c26d1b7cbb9269af92d527419d5b8475f2bb6686d2f92a6649b7f174c1d8306eb335e585ab5049', + '45bc5fa8cb45ee408c04b6269e9f1e1c17090c5ce26ffeeda2af097735b29953ce547e40ff3ad0d120e5361cc5f9cee35ea91ecd4077f3f589b4d439168f91b9', + '432ac3d29e4f18c7f604f7c3c96369a6c5c61fc09bf77880548239baffd61636d42ed374f41c261e424d20d98e320e812a6d52865be059745fdb2cb20acff0ab', + '9B71D224bd62f3785D96d46ad3ea3d73319bFBC2890CAAdae2dff72519673CA72323C3d99ba5c11d7c7ACC6e14b8c5DA0c4663475c2E5c3adef46f73bcDEC043', + '432AC3d29E4f18c7F604f7c3c96369A6C5c61fC09Bf77880548239baffd61636d42ed374f41c261e424d20d98e320e812a6d52865be059745fdb2cb20acff0ab', ], invalid: [ - "KYT0bf1c35032a71a14c2f719e5a14c1", - "KYT0bf1c35032a71a14c2f719e5a14c1dsjkjkjkjkkjk", - "q94375dj93458w34", - "39485729348", - "%&FHKJFvk", + 'KYT0bf1c35032a71a14c2f719e5a14c1', + 'KYT0bf1c35032a71a14c2f719e5a14c1dsjkjkjkjkkjk', + 'q94375dj93458w34', + '39485729348', + '%&FHKJFvk', ], }); test({ - validator: "isHash", - args: ["tiger192"], + validator: 'isHash', + args: ['tiger192'], valid: [ - "6281a1f098c5e7290927ed09150d43ff3990a0fe1a48267c", - "56268f7bc269cf1bc83d3ce42e07a85632394737918f4760", - "46fc0125a148788a3ac1d649566fc04eb84a746f1a6e4fa7", - "7731ea1621ae99ea3197b94583d034fdbaa4dce31a67404a", - "6281A1f098c5e7290927ed09150d43ff3990a0fe1a48267C", - "46FC0125a148788a3AC1d649566fc04eb84A746f1a6E4fa7", + '6281a1f098c5e7290927ed09150d43ff3990a0fe1a48267c', + '56268f7bc269cf1bc83d3ce42e07a85632394737918f4760', + '46fc0125a148788a3ac1d649566fc04eb84a746f1a6e4fa7', + '7731ea1621ae99ea3197b94583d034fdbaa4dce31a67404a', + '6281A1f098c5e7290927ed09150d43ff3990a0fe1a48267C', + '46FC0125a148788a3AC1d649566fc04eb84A746f1a6E4fa7', ], invalid: [ - "KYT0bf1c35032a71a14c2f719e5a14c1", - "KYT0bf1c35032a71a14c2f719e5a14c1dsjkjkjkjkkjk", - "q94375dj93458w34", - "39485729348", - "%&FHKJFvk", + 'KYT0bf1c35032a71a14c2f719e5a14c1', + 'KYT0bf1c35032a71a14c2f719e5a14c1dsjkjkjkjkkjk', + 'q94375dj93458w34', + '39485729348', + '%&FHKJFvk', ], }); }); - it("should validate JWT tokens", () => { + it('should validate JWT tokens', () => { test({ - validator: "isJWT", + validator: 'isJWT', valid: [ - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsb2dnZWRJbkFzIjoiYWRtaW4iLCJpYXQiOjE0MjI3Nzk2Mzh9.gzSraSYS8EXBxLN_oWnFSRgCzcmJmMjLiuyu5CSpyHI", - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsb3JlbSI6Imlwc3VtIn0.ymiJSsMJXR6tMSr8G9usjQ15_8hKPDv_CArLhxw28MI", - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb2xvciI6InNpdCIsImFtZXQiOlsibG9yZW0iLCJpcHN1bSJdfQ.rRpe04zbWbbJjwM43VnHzAboDzszJtGrNsUxaqQ-GQ8", - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqb2huIjp7ImFnZSI6MjUsImhlaWdodCI6MTg1fSwiamFrZSI6eyJhZ2UiOjMwLCJoZWlnaHQiOjI3MH19.YRLPARDmhGMC3BBk_OhtwwK21PIkVCqQe8ncIRPKo-E", + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsb2dnZWRJbkFzIjoiYWRtaW4iLCJpYXQiOjE0MjI3Nzk2Mzh9.gzSraSYS8EXBxLN_oWnFSRgCzcmJmMjLiuyu5CSpyHI', + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsb3JlbSI6Imlwc3VtIn0.ymiJSsMJXR6tMSr8G9usjQ15_8hKPDv_CArLhxw28MI', + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb2xvciI6InNpdCIsImFtZXQiOlsibG9yZW0iLCJpcHN1bSJdfQ.rRpe04zbWbbJjwM43VnHzAboDzszJtGrNsUxaqQ-GQ8', + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqb2huIjp7ImFnZSI6MjUsImhlaWdodCI6MTg1fSwiamFrZSI6eyJhZ2UiOjMwLCJoZWlnaHQiOjI3MH19.YRLPARDmhGMC3BBk_OhtwwK21PIkVCqQe8ncIRPKo-E', ], invalid: [ - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9", - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NSIsIm5hbWUiOiJKb2huIERvZSIsImlhdCI6MTUxNjIzOTAyMn0", - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NSIsIm5hbWUiOiJKb2huIERvZSIsImlhdCI6MTYxNjY1Mzg3Mn0.eyJpc3MiOiJodHRwczovL2V4YW1wbGUuY29tIiwiaWF0IjoxNjE2NjUzODcyLCJleHAiOjE2MTY2NTM4ODJ9.a1jLRQkO5TV5y5ERcaPAiM9Xm2gBdRjKrrCpHkGr_8M", - "$Zs.ewu.su84", - "ks64$S/9.dy$§kz.3sd73b", + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NSIsIm5hbWUiOiJKb2huIERvZSIsImlhdCI6MTUxNjIzOTAyMn0', + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NSIsIm5hbWUiOiJKb2huIERvZSIsImlhdCI6MTYxNjY1Mzg3Mn0.eyJpc3MiOiJodHRwczovL2V4YW1wbGUuY29tIiwiaWF0IjoxNjE2NjUzODcyLCJleHAiOjE2MTY2NTM4ODJ9.a1jLRQkO5TV5y5ERcaPAiM9Xm2gBdRjKrrCpHkGr_8M', + '$Zs.ewu.su84', + 'ks64$S/9.dy$§kz.3sd73b', ], error: [[], {}, null, undefined], }); }); - it("should validate null strings", () => { + it('should validate null strings', () => { test({ - validator: "isEmpty", - valid: [""], - invalid: [" ", "foo", "3"], + validator: 'isEmpty', + valid: [''], + invalid: [' ', 'foo', '3'], }); test({ - validator: "isEmpty", + validator: 'isEmpty', args: [{ ignore_whitespace: false }], - valid: [""], - invalid: [" ", "foo", "3"], + valid: [''], + invalid: [' ', 'foo', '3'], }); test({ - validator: "isEmpty", + validator: 'isEmpty', args: [{ ignore_whitespace: true }], - valid: ["", " "], - invalid: ["foo", "3"], + valid: ['', ' '], + invalid: ['foo', '3'], }); }); - it("should validate strings against an expected value", () => { + it('should validate strings against an expected value', () => { test({ - validator: "equals", - args: ["abc"], - valid: ["abc"], - invalid: ["Abc", "123"], + validator: 'equals', + args: ['abc'], + valid: ['abc'], + invalid: ['Abc', '123'], }); }); - it("should validate strings contain another string", () => { + it('should validate strings contain another string', () => { test({ - validator: "contains", - args: ["foo"], - valid: ["foo", "foobar", "bazfoo"], - invalid: ["bar", "fobar"], + validator: 'contains', + args: ['foo'], + valid: ['foo', 'foobar', 'bazfoo'], + invalid: ['bar', 'fobar'], }); test({ - validator: "contains", + validator: 'contains', args: [ - "foo", + 'foo', { ignoreCase: true, }, ], - valid: ["Foo", "FOObar", "BAZfoo"], - invalid: ["bar", "fobar", "baxoof"], + valid: ['Foo', 'FOObar', 'BAZfoo'], + invalid: ['bar', 'fobar', 'baxoof'], }); test({ - validator: "contains", + validator: 'contains', args: [ - "foo", + 'foo', { minOccurrences: 2, }, ], - valid: ["foofoofoo", "12foo124foo", "fofooofoooofoooo", "foo1foo"], - invalid: ["foo", "foobar", "Fooofoo", "foofo"], + valid: ['foofoofoo', '12foo124foo', 'fofooofoooofoooo', 'foo1foo'], + invalid: ['foo', 'foobar', 'Fooofoo', 'foofo'], }); }); - it("should validate strings against a pattern", () => { + it('should validate strings against a pattern', () => { test({ - validator: "matches", + validator: 'matches', args: [/abc/], - valid: ["abc", "abcdef", "123abc"], - invalid: ["acb", "Abc"], + valid: ['abc', 'abcdef', '123abc'], + invalid: ['acb', 'Abc'], }); test({ - validator: "matches", - args: ["abc"], - valid: ["abc", "abcdef", "123abc"], - invalid: ["acb", "Abc"], + validator: 'matches', + args: ['abc'], + valid: ['abc', 'abcdef', '123abc'], + invalid: ['acb', 'Abc'], }); test({ - validator: "matches", - args: ["abc", "i"], - valid: ["abc", "abcdef", "123abc", "AbC"], - invalid: ["acb"], + validator: 'matches', + args: ['abc', 'i'], + valid: ['abc', 'abcdef', '123abc', 'AbC'], + invalid: ['acb'], }); }); - it("should validate strings by length (deprecated api)", () => { + it('should validate strings by length (deprecated api)', () => { test({ - validator: "isLength", + validator: 'isLength', args: [2], - valid: ["abc", "de", "abcd"], - invalid: ["", "a"], + valid: ['abc', 'de', 'abcd'], + invalid: ['', 'a'], }); test({ - validator: "isLength", + validator: 'isLength', args: [2, 3], - valid: ["abc", "de"], - invalid: ["", "a", "abcd"], + valid: ['abc', 'de'], + invalid: ['', 'a', 'abcd'], }); test({ - validator: "isLength", + validator: 'isLength', args: [2, 3], - valid: ["干𩸽", "𠮷野家"], - invalid: ["", "𠀋", "千竈通り"], + valid: ['干𩸽', '𠮷野家'], + invalid: ['', '𠀋', '千竈通り'], }); test({ - validator: "isLength", + validator: 'isLength', args: [0, 0], - valid: [""], - invalid: ["a", "ab"], - }); - }); - - it("should validate isLocale codes", () => { - test({ - validator: "isLocale", - valid: [ - "uz_Latn_UZ", - "en", - "gsw", - "en-US", - "es_ES", - "es-419", - "sw_KE", - "am_ET", - "zh-CHS", - "ca_ES_VALENCIA", - "en_US_POSIX", - "hak-CN", - "zh-Hant", - "zh-Hans", - "sr-Cyrl", - "sr-Latn", - "zh-cmn-Hans-CN", - "cmn-Hans-CN", - "zh-yue-HK", - "yue-HK", - "zh-Hans-CN", - "sr-Latn-RS", - "sl-rozaj", - "sl-rozaj-biske", - "sl-nedis", - "de-CH-1901", - "sl-IT-nedis", - "hy-Latn-IT-arevela", - "i-enochian", - "en-scotland-fonipa", - "sl-IT-rozaj-biske-1994", - "de-CH-x-phonebk", - "az-Arab-x-AZE-derbend", - "x-whatever", - "qaa-Qaaa-QM-x-southern", - "de-Qaaa", - "sr-Latn-QM", - "sr-Qaaa-RS", - "en-US-u-islamcal", - "zh-CN-a-myext-x-private", - "en-a-myext-b-another", - ], - invalid: ["lo_POP", "12", "12_DD", "de-419-DE", "a-DE"], - }); - }); - - it("should validate strings by byte length (deprecated api)", () => { - test({ - validator: "isByteLength", + valid: [''], + invalid: ['a', 'ab'], + }); + }); + + it('should validate isLocale codes', () => { + test({ + validator: 'isLocale', + valid: [ + 'uz_Latn_UZ', + 'en', + 'gsw', + 'en-US', + 'es_ES', + 'es-419', + 'sw_KE', + 'am_ET', + 'zh-CHS', + 'ca_ES_VALENCIA', + 'en_US_POSIX', + 'hak-CN', + 'zh-Hant', + 'zh-Hans', + 'sr-Cyrl', + 'sr-Latn', + 'zh-cmn-Hans-CN', + 'cmn-Hans-CN', + 'zh-yue-HK', + 'yue-HK', + 'zh-Hans-CN', + 'sr-Latn-RS', + 'sl-rozaj', + 'sl-rozaj-biske', + 'sl-nedis', + 'de-CH-1901', + 'sl-IT-nedis', + 'hy-Latn-IT-arevela', + 'i-enochian', + 'en-scotland-fonipa', + 'sl-IT-rozaj-biske-1994', + 'de-CH-x-phonebk', + 'az-Arab-x-AZE-derbend', + 'x-whatever', + 'qaa-Qaaa-QM-x-southern', + 'de-Qaaa', + 'sr-Latn-QM', + 'sr-Qaaa-RS', + 'en-US-u-islamcal', + 'zh-CN-a-myext-x-private', + 'en-a-myext-b-another', + ], + invalid: ['lo_POP', '12', '12_DD', 'de-419-DE', 'a-DE'], + }); + }); + + it('should validate strings by byte length (deprecated api)', () => { + test({ + validator: 'isByteLength', args: [2], - valid: ["abc", "de", "abcd", "gmail"], - invalid: ["", "a"], + valid: ['abc', 'de', 'abcd', 'gmail'], + invalid: ['', 'a'], }); test({ - validator: "isByteLength", + validator: 'isByteLength', args: [2, 3], - valid: ["abc", "de", "g"], - invalid: ["", "a", "abcd", "gm"], + valid: ['abc', 'de', 'g'], + invalid: ['', 'a', 'abcd', 'gm'], }); test({ - validator: "isByteLength", + validator: 'isByteLength', args: [0, 0], - valid: [""], - invalid: ["g", "a"], + valid: [''], + invalid: ['g', 'a'], }); }); - it("should validate strings by length", () => { + it('should validate strings by length', () => { test({ - validator: "isLength", + validator: 'isLength', args: [{ min: 2 }], - valid: ["abc", "de", "abcd"], - invalid: ["", "a"], + valid: ['abc', 'de', 'abcd'], + invalid: ['', 'a'], }); test({ - validator: "isLength", + validator: 'isLength', args: [{ min: 2, max: 3 }], - valid: ["abc", "de"], - invalid: ["", "a", "abcd"], + valid: ['abc', 'de'], + invalid: ['', 'a', 'abcd'], }); test({ - validator: "isLength", + validator: 'isLength', args: [{ min: 2, max: 3 }], - valid: ["干𩸽", "𠮷野家"], - invalid: ["", "𠀋", "千竈通り"], + valid: ['干𩸽', '𠮷野家'], + invalid: ['', '𠀋', '千竈通り'], }); test({ - validator: "isLength", + validator: 'isLength', args: [{ max: 3 }], - valid: ["abc", "de", "a", ""], - invalid: ["abcd"], + valid: ['abc', 'de', 'a', ''], + invalid: ['abcd'], }); test({ - validator: "isLength", + validator: 'isLength', args: [{ max: 0 }], - valid: [""], - invalid: ["a", "ab"], + valid: [''], + invalid: ['a', 'ab'], }); test({ - validator: "isLength", - valid: ["a", "", "asds"], + validator: 'isLength', + valid: ['a', '', 'asds'], }); test({ - validator: "isLength", + validator: 'isLength', args: [{ max: 8 }], - valid: ["👩🦰👩👩👦👦🏳️🌈", "⏩︎⏩︎⏪︎⏪︎⏭︎⏭︎⏮︎⏮︎"], + valid: ['👩🦰👩👩👦👦🏳️🌈', '⏩︎⏩︎⏪︎⏪︎⏭︎⏭︎⏮︎⏮︎'], }); }); - it("should validate strings by byte length", () => { + it('should validate strings by byte length', () => { test({ - validator: "isByteLength", + validator: 'isByteLength', args: [{ min: 2 }], - valid: ["abc", "de", "abcd", "gmail"], - invalid: ["", "a"], + valid: ['abc', 'de', 'abcd', 'gmail'], + invalid: ['', 'a'], }); test({ - validator: "isByteLength", + validator: 'isByteLength', args: [{ min: 2, max: 3 }], - valid: ["abc", "de", "g"], - invalid: ["", "a", "abcd", "gm"], + valid: ['abc', 'de', 'g'], + invalid: ['', 'a', 'abcd', 'gm'], }); test({ - validator: "isByteLength", + validator: 'isByteLength', args: [{ max: 3 }], - valid: ["abc", "de", "g", "a", ""], - invalid: ["abcd", "gm"], + valid: ['abc', 'de', 'g', 'a', ''], + invalid: ['abcd', 'gm'], }); test({ - validator: "isByteLength", + validator: 'isByteLength', args: [{ max: 0 }], - valid: [""], - invalid: ["g", "a"], + valid: [''], + invalid: ['g', 'a'], }); }); - it("should validate UUIDs", () => { + it('should validate UUIDs', () => { test({ - validator: "isUUID", + validator: 'isUUID', valid: [ - "A987FBC9-4BED-3078-CF07-9141BA07C9F3", - "A987FBC9-4BED-4078-8F07-9141BA07C9F3", - "A987FBC9-4BED-5078-AF07-9141BA07C9F3", + 'A987FBC9-4BED-3078-CF07-9141BA07C9F3', + 'A987FBC9-4BED-4078-8F07-9141BA07C9F3', + 'A987FBC9-4BED-5078-AF07-9141BA07C9F3', ], invalid: [ - "", - "xxxA987FBC9-4BED-3078-CF07-9141BA07C9F3", - "A987FBC9-4BED-3078-CF07-9141BA07C9F3xxx", - "A987FBC94BED3078CF079141BA07C9F3", - "934859", - "987FBC9-4BED-3078-CF07A-9141BA07C9F3", - "AAAAAAAA-1111-1111-AAAG-111111111111", + '', + 'xxxA987FBC9-4BED-3078-CF07-9141BA07C9F3', + 'A987FBC9-4BED-3078-CF07-9141BA07C9F3xxx', + 'A987FBC94BED3078CF079141BA07C9F3', + '934859', + '987FBC9-4BED-3078-CF07A-9141BA07C9F3', + 'AAAAAAAA-1111-1111-AAAG-111111111111', ], }); test({ - validator: "isUUID", + validator: 'isUUID', args: [undefined], valid: [ - "A117FBC9-4BED-3078-CF07-9141BA07C9F3", - "A117FBC9-4BED-5078-AF07-9141BA07C9F3", + 'A117FBC9-4BED-3078-CF07-9141BA07C9F3', + 'A117FBC9-4BED-5078-AF07-9141BA07C9F3', ], invalid: [ - "", - "xxxA987FBC9-4BED-3078-CF07-9141BA07C9F3", - "A987FBC94BED3078CF079141BA07C9F3", - "A11AAAAA-1111-1111-AAAG-111111111111", + '', + 'xxxA987FBC9-4BED-3078-CF07-9141BA07C9F3', + 'A987FBC94BED3078CF079141BA07C9F3', + 'A11AAAAA-1111-1111-AAAG-111111111111', ], }); test({ - validator: "isUUID", + validator: 'isUUID', args: [null], - valid: ["A127FBC9-4BED-3078-CF07-9141BA07C9F3"], + valid: ['A127FBC9-4BED-3078-CF07-9141BA07C9F3'], invalid: [ - "", - "xxxA987FBC9-4BED-3078-CF07-9141BA07C9F3", - "A127FBC9-4BED-3078-CF07-9141BA07C9F3xxx", - "912859", - "A12AAAAA-1111-1111-AAAG-111111111111", + '', + 'xxxA987FBC9-4BED-3078-CF07-9141BA07C9F3', + 'A127FBC9-4BED-3078-CF07-9141BA07C9F3xxx', + '912859', + 'A12AAAAA-1111-1111-AAAG-111111111111', ], }); test({ - validator: "isUUID", + validator: 'isUUID', args: [1], - valid: ["E034B584-7D89-11E9-9669-1AECF481A97B"], + valid: ['E034B584-7D89-11E9-9669-1AECF481A97B'], invalid: [ - "xxxA987FBC9-4BED-3078-CF07-9141BA07C9F3", - "AAAAAAAA-1111-2222-AAAG", - "AAAAAAAA-1111-2222-AAAG-111111111111", - "A987FBC9-4BED-4078-8F07-9141BA07C9F3", - "A987FBC9-4BED-5078-AF07-9141BA07C9F3", + 'xxxA987FBC9-4BED-3078-CF07-9141BA07C9F3', + 'AAAAAAAA-1111-2222-AAAG', + 'AAAAAAAA-1111-2222-AAAG-111111111111', + 'A987FBC9-4BED-4078-8F07-9141BA07C9F3', + 'A987FBC9-4BED-5078-AF07-9141BA07C9F3', ], }); test({ - validator: "isUUID", + validator: 'isUUID', args: [2], - valid: ["A987FBC9-4BED-2078-CF07-9141BA07C9F3"], + valid: ['A987FBC9-4BED-2078-CF07-9141BA07C9F3'], invalid: [ - "", - "xxxA987FBC9-4BED-3078-CF07-9141BA07C9F3", - "11111", - "AAAAAAAA-1111-1111-AAAG-111111111111", - "A987FBC9-4BED-4078-8F07-9141BA07C9F3", - "A987FBC9-4BED-5078-AF07-9141BA07C9F3", + '', + 'xxxA987FBC9-4BED-3078-CF07-9141BA07C9F3', + '11111', + 'AAAAAAAA-1111-1111-AAAG-111111111111', + 'A987FBC9-4BED-4078-8F07-9141BA07C9F3', + 'A987FBC9-4BED-5078-AF07-9141BA07C9F3', ], }); test({ - validator: "isUUID", + validator: 'isUUID', args: [3], - valid: ["A987FBC9-4BED-3078-CF07-9141BA07C9F3"], + valid: ['A987FBC9-4BED-3078-CF07-9141BA07C9F3'], invalid: [ - "", - "xxxA987FBC9-4BED-3078-CF07-9141BA07C9F3", - "934859", - "AAAAAAAA-1111-1111-AAAG-111111111111", - "A987FBC9-4BED-4078-8F07-9141BA07C9F3", - "A987FBC9-4BED-5078-AF07-9141BA07C9F3", + '', + 'xxxA987FBC9-4BED-3078-CF07-9141BA07C9F3', + '934859', + 'AAAAAAAA-1111-1111-AAAG-111111111111', + 'A987FBC9-4BED-4078-8F07-9141BA07C9F3', + 'A987FBC9-4BED-5078-AF07-9141BA07C9F3', ], }); test({ - validator: "isUUID", + validator: 'isUUID', args: [4], valid: [ - "713ae7e3-cb32-45f9-adcb-7c4fa86b90c1", - "625e63f3-58f5-40b7-83a1-a72ad31acffb", - "57b73598-8764-4ad0-a76a-679bb6640eb1", - "9c858901-8a57-4791-81fe-4c455b099bc9", + '713ae7e3-cb32-45f9-adcb-7c4fa86b90c1', + '625e63f3-58f5-40b7-83a1-a72ad31acffb', + '57b73598-8764-4ad0-a76a-679bb6640eb1', + '9c858901-8a57-4791-81fe-4c455b099bc9', ], invalid: [ - "", - "xxxA987FBC9-4BED-3078-CF07-9141BA07C9F3", - "934859", - "AAAAAAAA-1111-1111-AAAG-111111111111", - "A987FBC9-4BED-5078-AF07-9141BA07C9F3", - "A987FBC9-4BED-3078-CF07-9141BA07C9F3", + '', + 'xxxA987FBC9-4BED-3078-CF07-9141BA07C9F3', + '934859', + 'AAAAAAAA-1111-1111-AAAG-111111111111', + 'A987FBC9-4BED-5078-AF07-9141BA07C9F3', + 'A987FBC9-4BED-3078-CF07-9141BA07C9F3', ], }); test({ - validator: "isUUID", + validator: 'isUUID', args: [5], valid: [ - "987FBC97-4BED-5078-AF07-9141BA07C9F3", - "987FBC97-4BED-5078-BF07-9141BA07C9F3", - "987FBC97-4BED-5078-8F07-9141BA07C9F3", - "987FBC97-4BED-5078-9F07-9141BA07C9F3", + '987FBC97-4BED-5078-AF07-9141BA07C9F3', + '987FBC97-4BED-5078-BF07-9141BA07C9F3', + '987FBC97-4BED-5078-8F07-9141BA07C9F3', + '987FBC97-4BED-5078-9F07-9141BA07C9F3', ], invalid: [ - "", - "xxxA987FBC9-4BED-3078-CF07-9141BA07C9F3", - "934859", - "AAAAAAAA-1111-1111-AAAG-111111111111", - "9c858901-8a57-4791-81fe-4c455b099bc9", - "A987FBC9-4BED-3078-CF07-9141BA07C9F3", + '', + 'xxxA987FBC9-4BED-3078-CF07-9141BA07C9F3', + '934859', + 'AAAAAAAA-1111-1111-AAAG-111111111111', + '9c858901-8a57-4791-81fe-4c455b099bc9', + 'A987FBC9-4BED-3078-CF07-9141BA07C9F3', ], }); test({ - validator: "isUUID", + validator: 'isUUID', args: [6], valid: [], invalid: [ - "987FBC97-4BED-1078-AF07-9141BA07C9F3", - "987FBC97-4BED-2078-AF07-9141BA07C9F3", - "987FBC97-4BED-3078-AF07-9141BA07C9F3", - "987FBC97-4BED-4078-AF07-9141BA07C9F3", - "987FBC97-4BED-5078-AF07-9141BA07C9F3", + '987FBC97-4BED-1078-AF07-9141BA07C9F3', + '987FBC97-4BED-2078-AF07-9141BA07C9F3', + '987FBC97-4BED-3078-AF07-9141BA07C9F3', + '987FBC97-4BED-4078-AF07-9141BA07C9F3', + '987FBC97-4BED-5078-AF07-9141BA07C9F3', ], }); }); - it("should validate a string that is in another string or array", () => { + it('should validate a string that is in another string or array', () => { test({ - validator: "isIn", - args: ["foobar"], - valid: ["foo", "bar", "foobar", ""], - invalid: ["foobarbaz", "barfoo"], + validator: 'isIn', + args: ['foobar'], + valid: ['foo', 'bar', 'foobar', ''], + invalid: ['foobarbaz', 'barfoo'], }); test({ - validator: "isIn", - args: [["foo", "bar"]], - valid: ["foo", "bar"], - invalid: ["foobar", "barfoo", ""], + validator: 'isIn', + args: [['foo', 'bar']], + valid: ['foo', 'bar'], + invalid: ['foobar', 'barfoo', ''], }); test({ - validator: "isIn", - args: [["1", "2", "3"]], - valid: ["1", "2", "3"], - invalid: ["4", ""], + validator: 'isIn', + args: [['1', '2', '3']], + valid: ['1', '2', '3'], + invalid: ['4', ''], }); test({ - validator: "isIn", - args: [["1", "2", "3", { foo: "bar" }, () => 5, { toString: "test" }]], - valid: ["1", "2", "3", ""], - invalid: ["4"], + validator: 'isIn', + args: [['1', '2', '3', { foo: 'bar' }, () => 5, { toString: 'test' }]], + valid: ['1', '2', '3', ''], + invalid: ['4'], }); - test({ validator: "isIn", invalid: ["foo", ""] }); + test({ validator: 'isIn', invalid: ['foo', ''] }); }); - it("should validate a string that is in another object", () => { + it('should validate a string that is in another object', () => { test({ - validator: "isIn", + validator: 'isIn', args: [{ foo: 1, bar: 2, foobar: 3 }], - valid: ["foo", "bar", "foobar"], - invalid: ["foobarbaz", "barfoo", ""], + valid: ['foo', 'bar', 'foobar'], + invalid: ['foobarbaz', 'barfoo', ''], }); test({ - validator: "isIn", + validator: 'isIn', args: [{ 1: 3, 2: 0, 3: 1 }], - valid: ["1", "2", "3"], - invalid: ["4", ""], + valid: ['1', '2', '3'], + invalid: ['4', ''], }); }); - it("should validate dates against an end date", () => { + it('should validate dates against an end date', () => { test({ - validator: "isBefore", - args: ["08/04/2011"], - valid: ["2010-07-02", "2010-08-04", new Date(0).toString()], - invalid: ["08/04/2011", new Date(2011, 9, 10).toString()], + validator: 'isBefore', + args: ['08/04/2011'], + valid: ['2010-07-02', '2010-08-04', new Date(0).toString()], + invalid: ['08/04/2011', new Date(2011, 9, 10).toString()], }); test({ - validator: "isBefore", + validator: 'isBefore', args: [new Date(2011, 7, 4).toString()], - valid: ["2010-07-02", "2010-08-04", new Date(0).toString()], - invalid: ["08/04/2011", new Date(2011, 9, 10).toString()], + valid: ['2010-07-02', '2010-08-04', new Date(0).toString()], + invalid: ['08/04/2011', new Date(2011, 9, 10).toString()], }); test({ - validator: "isBefore", + validator: 'isBefore', valid: [ - "2000-08-04", + '2000-08-04', new Date(0).toString(), new Date(Date.now() - 86400000).toString(), ], - invalid: ["2100-07-02", new Date(2217, 10, 10).toString()], - }); - test({ - validator: "isBefore", - args: ["2011-08-03"], - valid: ["1999-12-31"], - invalid: ["invalid date"], - }); - test({ - validator: "isBefore", - args: ["invalid date"], - invalid: ["invalid date", "1999-12-31"], - }); - }); - - it("should validate IBAN", () => { - test({ - validator: "isIBAN", - valid: [ - "SC52BAHL01031234567890123456USD", - "LC14BOSL123456789012345678901234", - "MT31MALT01100000000000000000123", - "SV43ACAT00000000000000123123", - "EG800002000156789012345180002", - "BE71 0961 2345 6769", - "FR76 3000 6000 0112 3456 7890 189", - "DE91 1000 0000 0123 4567 89", - "GR96 0810 0010 0000 0123 4567 890", - "RO09 BCYP 0000 0012 3456 7890", - "SA44 2000 0001 2345 6789 1234", - "ES79 2100 0813 6101 2345 6789", - "CH56 0483 5012 3456 7800 9", - "GB98 MIDL 0700 9312 3456 78", - "IL170108000000012612345", - "IT60X0542811101000000123456", - "JO71CBJO0000000000001234567890", - "TR320010009999901234567890", - "BR1500000000000010932840814P2", - "LB92000700000000123123456123", - "IR200170000000339545727003", - "MZ97123412341234123412341", - "MA64011519000001205000534921", - ], - invalid: [ - "XX22YYY1234567890123", - "FR14 2004 1010 0505 0001 3", - "FR7630006000011234567890189@", - "FR7630006000011234567890189😅", - "FR763000600001123456!!🤨7890189@", + invalid: ['2100-07-02', new Date(2217, 10, 10).toString()], + }); + test({ + validator: 'isBefore', + args: ['2011-08-03'], + valid: ['1999-12-31'], + invalid: ['invalid date'], + }); + test({ + validator: 'isBefore', + args: ['invalid date'], + invalid: ['invalid date', '1999-12-31'], + }); + }); + + it('should validate IBAN', () => { + test({ + validator: 'isIBAN', + valid: [ + 'SC52BAHL01031234567890123456USD', + 'LC14BOSL123456789012345678901234', + 'MT31MALT01100000000000000000123', + 'SV43ACAT00000000000000123123', + 'EG800002000156789012345180002', + 'BE71 0961 2345 6769', + 'FR76 3000 6000 0112 3456 7890 189', + 'DE91 1000 0000 0123 4567 89', + 'GR96 0810 0010 0000 0123 4567 890', + 'RO09 BCYP 0000 0012 3456 7890', + 'SA44 2000 0001 2345 6789 1234', + 'ES79 2100 0813 6101 2345 6789', + 'CH56 0483 5012 3456 7800 9', + 'GB98 MIDL 0700 9312 3456 78', + 'IL170108000000012612345', + 'IT60X0542811101000000123456', + 'JO71CBJO0000000000001234567890', + 'TR320010009999901234567890', + 'BR1500000000000010932840814P2', + 'LB92000700000000123123456123', + 'IR200170000000339545727003', + 'MZ97123412341234123412341', + 'MA64011519000001205000534921', + ], + invalid: [ + 'XX22YYY1234567890123', + 'FR14 2004 1010 0505 0001 3', + 'FR7630006000011234567890189@', + 'FR7630006000011234567890189😅', + 'FR763000600001123456!!🤨7890189@', ], }); test({ - validator: "isIBAN", - args: [{ whitelist: ["DK", "GB"] }], - valid: ["DK5000400440116243", "GB29NWBK60161331926819"], + validator: 'isIBAN', + args: [{ whitelist: ['DK', 'GB'] }], + valid: ['DK5000400440116243', 'GB29NWBK60161331926819'], invalid: [ - "BE71 0961 2345 6769", - "FR76 3000 6000 0112 3456 7890 189", - "DE91 1000 0000 0123 4567 89", - "GR96 0810 0010 0000 0123 4567 890", - "RO09 BCYP 0000 0012 3456 7890", - "SA44 2000 0001 2345 6789 1234", - "ES79 2100 0813 6101 2345 6789", - "XX22YYY1234567890123", - "FR14 2004 1010 0505 0001 3", - "FR7630006000011234567890189@", - "FR7630006000011234567890189😅", - "FR763000600001123456!!🤨7890189@", + 'BE71 0961 2345 6769', + 'FR76 3000 6000 0112 3456 7890 189', + 'DE91 1000 0000 0123 4567 89', + 'GR96 0810 0010 0000 0123 4567 890', + 'RO09 BCYP 0000 0012 3456 7890', + 'SA44 2000 0001 2345 6789 1234', + 'ES79 2100 0813 6101 2345 6789', + 'XX22YYY1234567890123', + 'FR14 2004 1010 0505 0001 3', + 'FR7630006000011234567890189@', + 'FR7630006000011234567890189😅', + 'FR763000600001123456!!🤨7890189@', ], }); test({ - validator: "isIBAN", - args: [{ whitelist: ["XX", "AA"] }], + validator: 'isIBAN', + args: [{ whitelist: ['XX', 'AA'] }], invalid: [ - "DK5000400440116243", - "GB29NWBK60161331926819", - "BE71 0961 2345 6769", - "FR76 3000 6000 0112 3456 7890 189", - "DE91 1000 0000 0123 4567 89", - "GR96 0810 0010 0000 0123 4567 890", - "RO09 BCYP 0000 0012 3456 7890", - "SA44 2000 0001 2345 6789 1234", - "ES79 2100 0813 6101 2345 6789", - "XX22YYY1234567890123", - "FR14 2004 1010 0505 0001 3", - "FR7630006000011234567890189@", - "FR7630006000011234567890189😅", - "FR763000600001123456!!🤨7890189@", + 'DK5000400440116243', + 'GB29NWBK60161331926819', + 'BE71 0961 2345 6769', + 'FR76 3000 6000 0112 3456 7890 189', + 'DE91 1000 0000 0123 4567 89', + 'GR96 0810 0010 0000 0123 4567 890', + 'RO09 BCYP 0000 0012 3456 7890', + 'SA44 2000 0001 2345 6789 1234', + 'ES79 2100 0813 6101 2345 6789', + 'XX22YYY1234567890123', + 'FR14 2004 1010 0505 0001 3', + 'FR7630006000011234567890189@', + 'FR7630006000011234567890189😅', + 'FR763000600001123456!!🤨7890189@', ], }); test({ - validator: "isIBAN", - args: [{ blacklist: ["IT"] }], + validator: 'isIBAN', + args: [{ blacklist: ['IT'] }], valid: [ - "SC52BAHL01031234567890123456USD", - "LC14BOSL123456789012345678901234", - "MT31MALT01100000000000000000123", - "SV43ACAT00000000000000123123", - "EG800002000156789012345180002", - "BE71 0961 2345 6769", - "FR76 3000 6000 0112 3456 7890 189", - "DE91 1000 0000 0123 4567 89", - "GR96 0810 0010 0000 0123 4567 890", - "RO09 BCYP 0000 0012 3456 7890", - "SA44 2000 0001 2345 6789 1234", - "ES79 2100 0813 6101 2345 6789", - "CH56 0483 5012 3456 7800 9", - "GB98 MIDL 0700 9312 3456 78", - "IL170108000000012612345", - "JO71CBJO0000000000001234567890", - "TR320010009999901234567890", - "BR1500000000000010932840814P2", - "LB92000700000000123123456123", - "IR200170000000339545727003", - "MZ97123412341234123412341", - ], - invalid: [ - "XX22YYY1234567890123", - "FR14 2004 1010 0505 0001 3", - "FR7630006000011234567890189@", - "FR7630006000011234567890189😅", - "FR763000600001123456!!🤨7890189@", - "IT60X0542811101000000123456", - ], - }); - }); - - it("should validate BIC codes", () => { - test({ - validator: "isBIC", - valid: [ - "SBICKEN1345", - "SBICKEN1", - "SBICKENY", - "SBICKEN1YYP", - "SBICXKN1YYP", + 'SC52BAHL01031234567890123456USD', + 'LC14BOSL123456789012345678901234', + 'MT31MALT01100000000000000000123', + 'SV43ACAT00000000000000123123', + 'EG800002000156789012345180002', + 'BE71 0961 2345 6769', + 'FR76 3000 6000 0112 3456 7890 189', + 'DE91 1000 0000 0123 4567 89', + 'GR96 0810 0010 0000 0123 4567 890', + 'RO09 BCYP 0000 0012 3456 7890', + 'SA44 2000 0001 2345 6789 1234', + 'ES79 2100 0813 6101 2345 6789', + 'CH56 0483 5012 3456 7800 9', + 'GB98 MIDL 0700 9312 3456 78', + 'IL170108000000012612345', + 'JO71CBJO0000000000001234567890', + 'TR320010009999901234567890', + 'BR1500000000000010932840814P2', + 'LB92000700000000123123456123', + 'IR200170000000339545727003', + 'MZ97123412341234123412341', + ], + invalid: [ + 'XX22YYY1234567890123', + 'FR14 2004 1010 0505 0001 3', + 'FR7630006000011234567890189@', + 'FR7630006000011234567890189😅', + 'FR763000600001123456!!🤨7890189@', + 'IT60X0542811101000000123456', + ], + }); + }); + + it('should validate BIC codes', () => { + test({ + validator: 'isBIC', + valid: [ + 'SBICKEN1345', + 'SBICKEN1', + 'SBICKENY', + 'SBICKEN1YYP', + 'SBICXKN1YYP', ], invalid: [ - "SBIC23NXXX", - "S23CKENXXXX", - "SBICKENXX", - "SBICKENXX9", - "SBICKEN13458", - "SBICKEN", - "SBICXK", + 'SBIC23NXXX', + 'S23CKENXXXX', + 'SBICKENXX', + 'SBICKENXX9', + 'SBICKEN13458', + 'SBICKEN', + 'SBICXK', ], }); }); - it("should validate that integer strings are divisible by a number", () => { + it('should validate that integer strings are divisible by a number', () => { test({ - validator: "isDivisibleBy", + validator: 'isDivisibleBy', args: [2], - valid: ["2", "4", "100", "1000"], - invalid: ["1", "2.5", "101", "foo", "", "2020-01-06T14:31:00.135Z"], + valid: ['2', '4', '100', '1000'], + invalid: ['1', '2.5', '101', 'foo', '', '2020-01-06T14:31:00.135Z'], }); }); - it("should validate luhn numbers", () => { + it('should validate luhn numbers', () => { test({ - validator: "isLuhnNumber", + validator: 'isLuhnNumber', valid: [ - "0", - "5421", - "01234567897", - "0123456789012345678906", - "0123456789012345678901234567891", - "123456789012345678906", - "375556917985515", - "36050234196908", - "4716461583322103", - "4716-2210-5188-5662", - "4929 7226 5379 7141", + '0', + '5421', + '01234567897', + '0123456789012345678906', + '0123456789012345678901234567891', + '123456789012345678906', + '375556917985515', + '36050234196908', + '4716461583322103', + '4716-2210-5188-5662', + '4929 7226 5379 7141', ], invalid: [ - "", - "1", - "5422", - "foo", - "prefix6234917882863855", - "623491788middle2863855", - "6234917882863855suffix", + '', + '1', + '5422', + 'foo', + 'prefix6234917882863855', + '623491788middle2863855', + '6234917882863855suffix', ], }); }); - it("should validate credit cards", () => { + it('should validate credit cards', () => { test({ - validator: "isCreditCard", + validator: 'isCreditCard', valid: [ - "375556917985515", - "36050234196908", - "4716461583322103", - "4716-2210-5188-5662", - "4929 7226 5379 7141", - "5398228707871527", - "6283875070985593", - "6263892624162870", - "6234917882863855", - "6234698580215388", - "6226050967750613", - "6246281879460688", - "2222155765072228", - "2225855203075256", - "2720428011723762", - "2718760626256570", - "6765780016990268", - "4716989580001715211", - "8171999927660000", - "8171999900000000021", + '375556917985515', + '36050234196908', + '4716461583322103', + '4716-2210-5188-5662', + '4929 7226 5379 7141', + '5398228707871527', + '6283875070985593', + '6263892624162870', + '6234917882863855', + '6234698580215388', + '6226050967750613', + '6246281879460688', + '2222155765072228', + '2225855203075256', + '2720428011723762', + '2718760626256570', + '6765780016990268', + '4716989580001715211', + '8171999927660000', + '8171999900000000021', ], invalid: [ - "foo", - "foo", - "5398228707871528", - "2718760626256571", - "2721465526338453", - "2220175103860763", - "375556917985515999999993", - "899999996234917882863855", - "prefix6234917882863855", - "623491788middle2863855", - "6234917882863855suffix", - "4716989580001715213", + 'foo', + 'foo', + '5398228707871528', + '2718760626256571', + '2721465526338453', + '2220175103860763', + '375556917985515999999993', + '899999996234917882863855', + 'prefix6234917882863855', + '623491788middle2863855', + '6234917882863855suffix', + '4716989580001715213', ], }); }); - it("should validate credit cards without a proper provider", () => { + it('should validate credit cards without a proper provider', () => { test({ - validator: "isCreditCard", - args: [{ provider: "Plorf" }], + validator: 'isCreditCard', + args: [{ provider: 'Plorf' }], error: [ - "foo", + 'foo', // valid cc # - "375556917985515", - "4716-2210-5188-5662", - "375556917985515999999993", - "6234917882863855suffix", - ], - }); - }); - - it("should validate AmEx provided credit cards", () => { - test({ - validator: "isCreditCard", - args: [{ provider: "AmEx" }], - valid: ["375556917985515"], - invalid: [ - "foo", - "2222155765072228", - "2225855203075256", - "2720428011723762", - "2718760626256570", - "36050234196908", - "375556917985515999999993", - "4716461583322103", - "4716-2210-5188-5662", - "4716989580001715211", - "4929 7226 5379 7141", - "5398228707871527", - "6234917882863855suffix", - "6283875070985593", - "6263892624162870", - "6234917882863855", - "6234698580215388", - "6226050967750613", - "6246281879460688", - "6283875070985593", - "6765780016990268", - "8171999927660000", - "8171999900000000021", - ], - }); - }); - - it("should validate Diners Club provided credit cards", () => { - test({ - validator: "isCreditCard", - args: [{ provider: "DinersClub" }], - valid: ["36050234196908"], - invalid: [ - "foo", - "2222155765072228", - "2225855203075256", - "2720428011723762", - "2718760626256570", - "375556917985515", - "375556917985515999999993", - "4716461583322103", - "4716-2210-5188-5662", - "4716989580001715211", - "4929 7226 5379 7141", - "5398228707871527", - "6234917882863855suffix", - "6283875070985593", - "6263892624162870", - "6234917882863855", - "6234698580215388", - "6226050967750613", - "6246281879460688", - "6283875070985593", - "6765780016990268", - "8171999927660000", - "8171999900000000021", - ], - }); - }); - - it("should validate Discover provided credit cards", () => { - test({ - validator: "isCreditCard", - args: [{ provider: "Discover" }], - valid: ["6011111111111117", "6011000990139424"], - invalid: [ - "foo", - "2222155765072228", - "2225855203075256", - "2720428011723762", - "2718760626256570", - "36050234196908", - "375556917985515", - "375556917985515999999993", - "4716461583322103", - "4716-2210-5188-5662", - "4716989580001715211", - "4929 7226 5379 7141", - "5398228707871527", - "6234917882863855suffix", - "6283875070985593", - "6263892624162870", - "6234917882863855", - "6234698580215388", - "6226050967750613", - "6246281879460688", - "6283875070985593", - "6765780016990268", - "8171999927660000", - "8171999900000000021", - ], - }); - }); - - it("should validate JCB provided credit cards", () => { - test({ - validator: "isCreditCard", - args: [{ provider: "JCB" }], - valid: ["3530111333300000", "3566002020360505"], - invalid: [ - "foo", - "2222155765072228", - "2225855203075256", - "2720428011723762", - "2718760626256570", - "36050234196908", - "375556917985515", - "375556917985515999999993", - "4716461583322103", - "4716-2210-5188-5662", - "4716989580001715211", - "4929 7226 5379 7141", - "5398228707871527", - "6234917882863855suffix", - "6283875070985593", - "6263892624162870", - "6234917882863855", - "6234698580215388", - "6226050967750613", - "6246281879460688", - "6283875070985593", - "6765780016990268", - "8171999927660000", - "8171999900000000021", - ], - }); - }); - - it("should validate Mastercard provided credit cards", () => { - test({ - validator: "isCreditCard", - args: [{ provider: "Mastercard" }], - valid: [ - "2222155765072228", - "2225855203075256", - "2718760626256570", - "2720428011723762", - "5398228707871527", - ], - invalid: [ - "foo", - "36050234196908", - "375556917985515", - "375556917985515999999993", - "4716461583322103", - "4716-2210-5188-5662", - "4716989580001715211", - "4929 7226 5379 7141", - "6234917882863855suffix", - "6283875070985593", - "6263892624162870", - "6234917882863855", - "6234698580215388", - "6226050967750613", - "6246281879460688", - "6283875070985593", - "6765780016990268", - "8171999927660000", - "8171999900000000021", - ], - }); - }); - - it("should validate Union Pay provided credit cards", () => { - test({ - validator: "isCreditCard", - args: [{ provider: "UnionPay" }], - valid: [ - "6226050967750613", - "6234917882863855", - "6234698580215388", - "6246281879460688", - "6263892624162870", - "6283875070985593", - "6765780016990268", - "8171999927660000", - "8171999900000000021", - ], - invalid: [ - "foo", - "2222155765072228", - "2225855203075256", - "2720428011723762", - "2718760626256570", - "36050234196908", - "375556917985515", - "375556917985515999999993", - "4716461583322103", - "4716-2210-5188-5662", - "4716989580001715211", - "4929 7226 5379 7141", - "5398228707871527", - "6234917882863855suffix", - ], - }); - }); - - it("should validate Visa provided credit cards", () => { - test({ - validator: "isCreditCard", - args: [{ provider: "Visa" }], - valid: [ - "4716-2210-5188-5662", - "4716461583322103", - "4716989580001715211", - "4929 7226 5379 7141", - ], - invalid: [ - "foo", - "2222155765072228", - "2225855203075256", - "2720428011723762", - "2718760626256570", - "36050234196908", - "375556917985515", - "375556917985515999999993", - "5398228707871527", - "6234917882863855suffix", - "6283875070985593", - "6263892624162870", - "6234917882863855", - "6234698580215388", - "6226050967750613", - "6246281879460688", - "6283875070985593", - "6765780016990268", - "8171999927660000", - "8171999900000000021", - ], - }); - }); - - it("should validate identity cards", () => { + '375556917985515', + '4716-2210-5188-5662', + '375556917985515999999993', + '6234917882863855suffix', + ], + }); + }); + + it('should validate AmEx provided credit cards', () => { + test({ + validator: 'isCreditCard', + args: [{ provider: 'AmEx' }], + valid: ['375556917985515'], + invalid: [ + 'foo', + '2222155765072228', + '2225855203075256', + '2720428011723762', + '2718760626256570', + '36050234196908', + '375556917985515999999993', + '4716461583322103', + '4716-2210-5188-5662', + '4716989580001715211', + '4929 7226 5379 7141', + '5398228707871527', + '6234917882863855suffix', + '6283875070985593', + '6263892624162870', + '6234917882863855', + '6234698580215388', + '6226050967750613', + '6246281879460688', + '6283875070985593', + '6765780016990268', + '8171999927660000', + '8171999900000000021', + ], + }); + }); + + it('should validate Diners Club provided credit cards', () => { + test({ + validator: 'isCreditCard', + args: [{ provider: 'DinersClub' }], + valid: ['36050234196908'], + invalid: [ + 'foo', + '2222155765072228', + '2225855203075256', + '2720428011723762', + '2718760626256570', + '375556917985515', + '375556917985515999999993', + '4716461583322103', + '4716-2210-5188-5662', + '4716989580001715211', + '4929 7226 5379 7141', + '5398228707871527', + '6234917882863855suffix', + '6283875070985593', + '6263892624162870', + '6234917882863855', + '6234698580215388', + '6226050967750613', + '6246281879460688', + '6283875070985593', + '6765780016990268', + '8171999927660000', + '8171999900000000021', + ], + }); + }); + + it('should validate Discover provided credit cards', () => { + test({ + validator: 'isCreditCard', + args: [{ provider: 'Discover' }], + valid: ['6011111111111117', '6011000990139424'], + invalid: [ + 'foo', + '2222155765072228', + '2225855203075256', + '2720428011723762', + '2718760626256570', + '36050234196908', + '375556917985515', + '375556917985515999999993', + '4716461583322103', + '4716-2210-5188-5662', + '4716989580001715211', + '4929 7226 5379 7141', + '5398228707871527', + '6234917882863855suffix', + '6283875070985593', + '6263892624162870', + '6234917882863855', + '6234698580215388', + '6226050967750613', + '6246281879460688', + '6283875070985593', + '6765780016990268', + '8171999927660000', + '8171999900000000021', + ], + }); + }); + + it('should validate JCB provided credit cards', () => { + test({ + validator: 'isCreditCard', + args: [{ provider: 'JCB' }], + valid: ['3530111333300000', '3566002020360505'], + invalid: [ + 'foo', + '2222155765072228', + '2225855203075256', + '2720428011723762', + '2718760626256570', + '36050234196908', + '375556917985515', + '375556917985515999999993', + '4716461583322103', + '4716-2210-5188-5662', + '4716989580001715211', + '4929 7226 5379 7141', + '5398228707871527', + '6234917882863855suffix', + '6283875070985593', + '6263892624162870', + '6234917882863855', + '6234698580215388', + '6226050967750613', + '6246281879460688', + '6283875070985593', + '6765780016990268', + '8171999927660000', + '8171999900000000021', + ], + }); + }); + + it('should validate Mastercard provided credit cards', () => { + test({ + validator: 'isCreditCard', + args: [{ provider: 'Mastercard' }], + valid: [ + '2222155765072228', + '2225855203075256', + '2718760626256570', + '2720428011723762', + '5398228707871527', + ], + invalid: [ + 'foo', + '36050234196908', + '375556917985515', + '375556917985515999999993', + '4716461583322103', + '4716-2210-5188-5662', + '4716989580001715211', + '4929 7226 5379 7141', + '6234917882863855suffix', + '6283875070985593', + '6263892624162870', + '6234917882863855', + '6234698580215388', + '6226050967750613', + '6246281879460688', + '6283875070985593', + '6765780016990268', + '8171999927660000', + '8171999900000000021', + ], + }); + }); + + it('should validate Union Pay provided credit cards', () => { + test({ + validator: 'isCreditCard', + args: [{ provider: 'UnionPay' }], + valid: [ + '6226050967750613', + '6234917882863855', + '6234698580215388', + '6246281879460688', + '6263892624162870', + '6283875070985593', + '6765780016990268', + '8171999927660000', + '8171999900000000021', + ], + invalid: [ + 'foo', + '2222155765072228', + '2225855203075256', + '2720428011723762', + '2718760626256570', + '36050234196908', + '375556917985515', + '375556917985515999999993', + '4716461583322103', + '4716-2210-5188-5662', + '4716989580001715211', + '4929 7226 5379 7141', + '5398228707871527', + '6234917882863855suffix', + ], + }); + }); + + it('should validate Visa provided credit cards', () => { + test({ + validator: 'isCreditCard', + args: [{ provider: 'Visa' }], + valid: [ + '4716-2210-5188-5662', + '4716461583322103', + '4716989580001715211', + '4929 7226 5379 7141', + ], + invalid: [ + 'foo', + '2222155765072228', + '2225855203075256', + '2720428011723762', + '2718760626256570', + '36050234196908', + '375556917985515', + '375556917985515999999993', + '5398228707871527', + '6234917882863855suffix', + '6283875070985593', + '6263892624162870', + '6234917882863855', + '6234698580215388', + '6226050967750613', + '6246281879460688', + '6283875070985593', + '6765780016990268', + '8171999927660000', + '8171999900000000021', + ], + }); + }); + + it('should validate identity cards', () => { const fixtures = [ { - locale: "zh-HK", + locale: 'zh-HK', valid: [ - "OV290326[A]", - "Q803337[0]", - "Z0977986", - "W520128(7)", - "A494866[4]", - "A494866(4)", - "Z867821A", - "ag293013(9)", - "k348609(5)", + 'OV290326[A]', + 'Q803337[0]', + 'Z0977986', + 'W520128(7)', + 'A494866[4]', + 'A494866(4)', + 'Z867821A', + 'ag293013(9)', + 'k348609(5)', ], invalid: [ - "A1234567890", - "98765432", - "O962472(9)", - "M4578601", - "X731324[8]", - "C503134(5)", - "RH265886(3)", + 'A1234567890', + '98765432', + 'O962472(9)', + 'M4578601', + 'X731324[8]', + 'C503134(5)', + 'RH265886(3)', ], }, { - locale: "LK", + locale: 'LK', valid: [ - "722222222v", - "722222222V", - "993151225x", - "993151225X", - "188888388x", - "935632124V", - "199931512253", - "200023125632", + '722222222v', + '722222222V', + '993151225x', + '993151225X', + '188888388x', + '935632124V', + '199931512253', + '200023125632', ], invalid: [ - "023125648V", - "023345621v", - "021354211X", - "055321231x", - "02135465462", - "199931512253X", + '023125648V', + '023345621v', + '021354211X', + '055321231x', + '02135465462', + '199931512253X', ], }, { - locale: "PL", + locale: 'PL', valid: [ - "99012229019", - "09210215408", - "20313034701", - "86051575214", - "77334586883", - "54007481320", - "06566860643", - "77552478861", + '99012229019', + '09210215408', + '20313034701', + '86051575214', + '77334586883', + '54007481320', + '06566860643', + '77552478861', ], invalid: [ - "aa", - "5", - "195", - "", - " ", - "12345678901", - "99212229019", - "09210215402", - "20313534701", - "86241579214", + 'aa', + '5', + '195', + '', + ' ', + '12345678901', + '99212229019', + '09210215402', + '20313534701', + '86241579214', ], }, { - locale: "ES", + locale: 'ES', valid: [ - "99999999R", - "12345678Z", - "01234567L", - "01234567l", - "X1234567l", - "x1234567l", - "X1234567L", - "Y1234567X", - "Z1234567R", + '99999999R', + '12345678Z', + '01234567L', + '01234567l', + 'X1234567l', + 'x1234567l', + 'X1234567L', + 'Y1234567X', + 'Z1234567R', ], invalid: [ - "123456789", - "12345678A", - "12345 678Z", - "12345678-Z", - "1234*6789", - "1234*678Z", - "12345678!", - "1234567L", - "A1234567L", - "X1234567A", - "Y1234567B", - "Z1234567C", + '123456789', + '12345678A', + '12345 678Z', + '12345678-Z', + '1234*6789', + '1234*678Z', + '12345678!', + '1234567L', + 'A1234567L', + 'X1234567A', + 'Y1234567B', + 'Z1234567C', ], }, { - locale: "FI", + locale: 'FI', valid: [ - "131052-308T", // People born in 1900s - "131052A308T", // People born in 2000s - "131052+308T", // People born in 1800s - "131052-313Y", + '131052-308T', // People born in 1900s + '131052A308T', // People born in 2000s + '131052+308T', // People born in 1800s + '131052-313Y', ], - invalid: ["131052308T", "131052-308T ", "131052-308A"], + invalid: ['131052308T', '131052-308T ', '131052-308A'], }, { - locale: "IN", - valid: ["298448863364", "2984 4886 3364"], + locale: 'IN', + valid: ['298448863364', '2984 4886 3364'], invalid: [ - "99999999R", - "12345678Z", - "01234567L", - "01234567l", - "X1234567l", - "x1234567l", - "X1234567L", + '99999999R', + '12345678Z', + '01234567L', + '01234567l', + 'X1234567l', + 'x1234567l', + 'X1234567L', ], }, { - locale: "IR", + locale: 'IR', valid: [ - "0499370899", - "0790419904", - "0084575948", - "0963695398", - "0684159414", - "0067749828", - "0650451252", - "1583250689", - "4032152314", - "0076229645", - "4271467685", - "0200203241", + '0499370899', + '0790419904', + '0084575948', + '0963695398', + '0684159414', + '0067749828', + '0650451252', + '1583250689', + '4032152314', + '0076229645', + '4271467685', + '0200203241', ], invalid: [ - "1260293040", - "0000000001", - "1999999999", - "9999999991", - "AAAAAAAAAA", - "0684159415", + '1260293040', + '0000000001', + '1999999999', + '9999999991', + 'AAAAAAAAAA', + '0684159415', ], }, - { - locale: "IT", - valid: ["CR43675TM", "CA79382RA"], - invalid: ["CA00000AA", "CB2342TG", "CS123456A", "C1236EC"], - }, - { - locale: "NO", - valid: [ - "09053426694", - "26028338723", - "08031470790", - "12051539514", - "02077448074", - "14035638319", - "13031379673", - "29126214926", + { + locale: 'IT', + valid: ['CR43675TM', 'CA79382RA'], + invalid: ['CA00000AA', 'CB2342TG', 'CS123456A', 'C1236EC'], + }, + { + locale: 'NO', + valid: [ + '09053426694', + '26028338723', + '08031470790', + '12051539514', + '02077448074', + '14035638319', + '13031379673', + '29126214926', ], - invalid: ["09053426699", "00000000000", "26028338724", "92031470790"], + invalid: ['09053426699', '00000000000', '26028338724', '92031470790'], }, { - locale: "TH", - valid: ["1101230000001", "1101230000060"], + locale: 'TH', + valid: ['1101230000001', '1101230000060'], invalid: [ - "abc", - "1101230", - "11012300000011", - "aaaaaaaaaaaaa", - "110123abcd001", - "1101230000007", - "0101123450000", - "0101123450004", - "9101123450008", - ], - }, - { - locale: "he-IL", - valid: [ - "219472156", - "219486610", - "219488962", - "219566726", - "219640216", - "219645041", - "334795465", - "335211686", - "335240479", - "335472171", - "336999842", - "337090443", - ], - invalid: [ - "123456789", - "12345678A", - "12345 678Z", - "12345678-Z", - "1234*6789", - "1234*678Z", - "12345678!", - "1234567L", - "A1234567L", - "X1234567A", - "Y1234567B", - "Z1234567C", - "219772156", - "219487710", - "334705465", - "336000842", - ], - }, - { - locale: "ar-LY", - valid: ["119803455876", "120024679875", "219624876201", "220103480657"], - invalid: [ - "987654320123", - "123-456-7890", - "012345678912", - "1234567890", - "AFJBHUYTREWR", - "C4V6B1X0M5T6", - "9876543210123", - ], - }, - { - locale: "ar-TN", - valid: [ - "09958092", - "09151092", - "65126506", - "79378815", - "58994407", - "73089789", - "73260311", - ], - invalid: [ - "123456789546", - "123456789", - "023456789", - "12345678A", - "12345", - "1234578A", - "123 578A", - "12345 678Z", - "12345678-Z", - "1234*6789", - "1234*678Z", - "GE9800as98", - "X231071922", - "1234*678Z", - "12345678!", - ], - }, - { - locale: "zh-CN", - valid: [ - "235407195106112745", - "210203197503102721", - "520323197806058856", - "110101491001001", - ], - invalid: [ - "160323197806058856", - "010203197503102721", - "520323297806058856", - "520323197802318856", - "235407195106112742", - "010101491001001", - "110101491041001", - "160101491001001", - "110101940231001", - "xx1234567", - "135407195106112742", - "123456789546", - "123456789", - "023456789", - "12345678A", - "12345", - "1234578A", - "123 578A", - "12345 678Z", - "12345678-Z", - "1234*6789", - "1234*678Z", - "GE9800as98", - "X231071922", - "1234*678Z", - "12345678!", - "235407207006112742", - ], - }, - { - locale: "zh-TW", - valid: [ - "B176944193", - "K101189797", - "F112866121", - "A219758834", - "A244144802", - "A146047171", - "Q170219004", - "Z277018381", - "X231071923", - ], - invalid: [ - "123456789", - "A185034995", - "X431071923", - "GE9800as98", - "X231071922", - "1234*678Z", - "12345678!", - "1234567L", - "A1234567L", - "X1234567A", - "Y1234567B", - "Z1234567C", - "219772156", - "219487710", - "334705465", - "336000842", + 'abc', + '1101230', + '11012300000011', + 'aaaaaaaaaaaaa', + '110123abcd001', + '1101230000007', + '0101123450000', + '0101123450004', + '9101123450008', + ], + }, + { + locale: 'he-IL', + valid: [ + '219472156', + '219486610', + '219488962', + '219566726', + '219640216', + '219645041', + '334795465', + '335211686', + '335240479', + '335472171', + '336999842', + '337090443', + ], + invalid: [ + '123456789', + '12345678A', + '12345 678Z', + '12345678-Z', + '1234*6789', + '1234*678Z', + '12345678!', + '1234567L', + 'A1234567L', + 'X1234567A', + 'Y1234567B', + 'Z1234567C', + '219772156', + '219487710', + '334705465', + '336000842', + ], + }, + { + locale: 'ar-LY', + valid: ['119803455876', '120024679875', '219624876201', '220103480657'], + invalid: [ + '987654320123', + '123-456-7890', + '012345678912', + '1234567890', + 'AFJBHUYTREWR', + 'C4V6B1X0M5T6', + '9876543210123', + ], + }, + { + locale: 'ar-TN', + valid: [ + '09958092', + '09151092', + '65126506', + '79378815', + '58994407', + '73089789', + '73260311', + ], + invalid: [ + '123456789546', + '123456789', + '023456789', + '12345678A', + '12345', + '1234578A', + '123 578A', + '12345 678Z', + '12345678-Z', + '1234*6789', + '1234*678Z', + 'GE9800as98', + 'X231071922', + '1234*678Z', + '12345678!', + ], + }, + { + locale: 'zh-CN', + valid: [ + '235407195106112745', + '210203197503102721', + '520323197806058856', + '110101491001001', + ], + invalid: [ + '160323197806058856', + '010203197503102721', + '520323297806058856', + '520323197802318856', + '235407195106112742', + '010101491001001', + '110101491041001', + '160101491001001', + '110101940231001', + 'xx1234567', + '135407195106112742', + '123456789546', + '123456789', + '023456789', + '12345678A', + '12345', + '1234578A', + '123 578A', + '12345 678Z', + '12345678-Z', + '1234*6789', + '1234*678Z', + 'GE9800as98', + 'X231071922', + '1234*678Z', + '12345678!', + '235407207006112742', + ], + }, + { + locale: 'zh-TW', + valid: [ + 'B176944193', + 'K101189797', + 'F112866121', + 'A219758834', + 'A244144802', + 'A146047171', + 'Q170219004', + 'Z277018381', + 'X231071923', + ], + invalid: [ + '123456789', + 'A185034995', + 'X431071923', + 'GE9800as98', + 'X231071922', + '1234*678Z', + '12345678!', + '1234567L', + 'A1234567L', + 'X1234567A', + 'Y1234567B', + 'Z1234567C', + '219772156', + '219487710', + '334705465', + '336000842', ], }, ]; @@ -4803,7 +4803,7 @@ describe("Validators", () => { fixtures.forEach((fixture) => { if (fixture.valid) allValid = allValid.concat(fixture.valid); test({ - validator: "isIdentityCard", + validator: 'isIdentityCard', valid: fixture.valid, invalid: fixture.invalid, args: [fixture.locale], @@ -4812,403 +4812,403 @@ describe("Validators", () => { // Test generics test({ - validator: "isIdentityCard", + validator: 'isIdentityCard', valid: [...allValid], - invalid: ["foo"], - args: ["any"], + invalid: ['foo'], + args: ['any'], }); }); - it("should error on invalid locale", () => { + it('should error on invalid locale', () => { test({ - validator: "isIdentityCard", - args: ["is-NOT"], - error: ["99999999R", "12345678Z"], + validator: 'isIdentityCard', + args: ['is-NOT'], + error: ['99999999R', '12345678Z'], }); }); - it("should validate ISINs", () => { + it('should validate ISINs', () => { test({ - validator: "isISIN", + validator: 'isISIN', valid: [ - "AU0000XVGZA3", - "DE000BAY0017", - "BE0003796134", - "SG1G55870362", - "GB0001411924", - "DE000WCH8881", - "PLLWBGD00016", - "US0378331005", + 'AU0000XVGZA3', + 'DE000BAY0017', + 'BE0003796134', + 'SG1G55870362', + 'GB0001411924', + 'DE000WCH8881', + 'PLLWBGD00016', + 'US0378331005', ], - invalid: ["DE000BAY0018", "PLLWBGD00019", "foo", "5398228707871528"], + invalid: ['DE000BAY0018', 'PLLWBGD00019', 'foo', '5398228707871528'], }); }); - it("should validate EANs", () => { + it('should validate EANs', () => { test({ - validator: "isEAN", + validator: 'isEAN', valid: [ - "9421023610112", - "1234567890128", - "4012345678901", - "9771234567003", - "9783161484100", - "73513537", - "00012345600012", - "10012345678902", - "20012345678909", + '9421023610112', + '1234567890128', + '4012345678901', + '9771234567003', + '9783161484100', + '73513537', + '00012345600012', + '10012345678902', + '20012345678909', ], - invalid: ["5901234123451", "079777681629", "0705632085948"], + invalid: ['5901234123451', '079777681629', '0705632085948'], }); }); - it("should validate ISSNs", () => { + it('should validate ISSNs', () => { test({ - validator: "isISSN", + validator: 'isISSN', valid: [ - "0378-5955", - "0000-0000", - "2434-561X", - "2434-561x", - "01896016", - "20905076", + '0378-5955', + '0000-0000', + '2434-561X', + '2434-561x', + '01896016', + '20905076', ], invalid: [ - "0378-5954", - "0000-0001", - "0378-123", - "037-1234", - "0", - "2434-561c", - "1684-5370", - "19960791", - "", + '0378-5954', + '0000-0001', + '0378-123', + '037-1234', + '0', + '2434-561c', + '1684-5370', + '19960791', + '', ], }); test({ - validator: "isISSN", + validator: 'isISSN', args: [{ case_sensitive: true }], - valid: ["2434-561X", "2434561X", "0378-5955", "03785955"], - invalid: ["2434-561x", "2434561x"], + valid: ['2434-561X', '2434561X', '0378-5955', '03785955'], + invalid: ['2434-561x', '2434561x'], }); test({ - validator: "isISSN", + validator: 'isISSN', args: [{ require_hyphen: true }], - valid: ["2434-561X", "2434-561x", "0378-5955"], - invalid: ["2434561X", "2434561x", "03785955"], + valid: ['2434-561X', '2434-561x', '0378-5955'], + invalid: ['2434561X', '2434561x', '03785955'], }); test({ - validator: "isISSN", + validator: 'isISSN', args: [{ case_sensitive: true, require_hyphen: true }], - valid: ["2434-561X", "0378-5955"], - invalid: ["2434-561x", "2434561X", "2434561x", "03785955"], + valid: ['2434-561X', '0378-5955'], + invalid: ['2434-561x', '2434561X', '2434561x', '03785955'], }); }); - it("should validate JSON", () => { + it('should validate JSON', () => { test({ - validator: "isJSON", - valid: ['{ "key": "value" }', "{}"], + validator: 'isJSON', + valid: ['{ "key": "value" }', '{}'], invalid: [ '{ key: "value" }', "{ 'key': 'value' }", - "null", - "1234", + 'null', + '1234', '"nope"', ], }); }); - it("should validate JSON with primitives", () => { + it('should validate JSON with primitives', () => { test({ - validator: "isJSON", + validator: 'isJSON', args: [{ allow_primitives: true }], - valid: ['{ "key": "value" }', "{}", "null", "false", "true"], + valid: ['{ "key": "value" }', '{}', 'null', 'false', 'true'], invalid: [ '{ key: "value" }', "{ 'key': 'value' }", '{ "key": value }', - "1234", + '1234', '"nope"', ], }); }); - it("should validate multibyte strings", () => { + it('should validate multibyte strings', () => { test({ - validator: "isMultibyte", + validator: 'isMultibyte', valid: [ - "ひらがな・カタカナ、.漢字", - "あいうえお foobar", - "test@example.com", - "1234abcDExyz", - "カタカナ", - "中文", + 'ひらがな・カタカナ、.漢字', + 'あいうえお foobar', + 'test@example.com', + '1234abcDExyz', + 'カタカナ', + '中文', ], - invalid: ["abc", "abc123", '<>@" *.'], + invalid: ['abc', 'abc123', '<>@" *.'], }); }); - it("should validate ascii strings", () => { + it('should validate ascii strings', () => { test({ - validator: "isAscii", - valid: ["foobar", "0987654321", "test@example.com", "1234abcDEF"], - invalid: ["foobar", "xyz098", "123456", "カタカナ"], + validator: 'isAscii', + valid: ['foobar', '0987654321', 'test@example.com', '1234abcDEF'], + invalid: ['foobar', 'xyz098', '123456', 'カタカナ'], }); }); - it("should validate full-width strings", () => { + it('should validate full-width strings', () => { test({ - validator: "isFullWidth", + validator: 'isFullWidth', valid: [ - "ひらがな・カタカナ、.漢字", - "3ー0 a@com", - "Fカタカナ゙ᆲ", - "Good=Parts", + 'ひらがな・カタカナ、.漢字', + '3ー0 a@com', + 'Fカタカナ゙ᆲ', + 'Good=Parts', ], - invalid: ["abc", "abc123", '!"#$%&()<>/+=-_? ~^|.,@`{}[]'], + invalid: ['abc', 'abc123', '!"#$%&()<>/+=-_? ~^|.,@`{}[]'], }); }); - it("should validate half-width strings", () => { + it('should validate half-width strings', () => { test({ - validator: "isHalfWidth", + validator: 'isHalfWidth', valid: [ '!"#$%&()<>/+=-_? ~^|.,@`{}[]', - "l-btn_02--active", - "abc123い", - "カタカナ゙ᆲ←", + 'l-btn_02--active', + 'abc123い', + 'カタカナ゙ᆲ←', ], - invalid: ["あいうえお", "0011"], + invalid: ['あいうえお', '0011'], }); }); - it("should validate variable-width strings", () => { + it('should validate variable-width strings', () => { test({ - validator: "isVariableWidth", + validator: 'isVariableWidth', valid: [ - "ひらがなカタカナ漢字ABCDE", - "3ー0123", - "Fカタカナ゙ᆲ", - "Good=Parts", + 'ひらがなカタカナ漢字ABCDE', + '3ー0123', + 'Fカタカナ゙ᆲ', + 'Good=Parts', ], invalid: [ - "abc", - "abc123", + 'abc', + 'abc123', '!"#$%&()<>/+=-_? ~^|.,@`{}[]', - "ひらがな・カタカナ、.漢字", - "123456", - "カタカナ゙ᆲ", - ], - }); - }); - - it("should validate surrogate pair strings", () => { - test({ - validator: "isSurrogatePair", - valid: ["𠮷野𠮷", "𩸽", "ABC千𥧄1-2-3"], - invalid: ["吉野竈", "鮪", "ABC1-2-3"], - }); - }); - - it("should validate Semantic Versioning Specification (SemVer) strings", () => { - test({ - validator: "isSemVer", - valid: [ - "0.0.4", - "1.2.3", - "10.20.30", - "1.1.2-prerelease+meta", - "1.1.2+meta", - "1.1.2+meta-valid", - "1.0.0-alpha", - "1.0.0-beta", - "1.0.0-alpha.beta", - "1.0.0-alpha.beta.1", - "1.0.0-alpha.1", - "1.0.0-alpha0.valid", - "1.0.0-alpha.0valid", - "1.0.0-alpha-a.b-c-somethinglong+build.1-aef.1-its-okay", - "1.0.0-rc.1+build.1", - "2.0.0-rc.1+build.123", - "1.2.3-beta", - "10.2.3-DEV-SNAPSHOT", - "1.2.3-SNAPSHOT-123", - "1.0.0", - "2.0.0", - "1.1.7", - "2.0.0+build.1848", - "2.0.1-alpha.1227", - "1.0.0-alpha+beta", - "1.2.3----RC-SNAPSHOT.12.9.1--.12+788", - "1.2.3----R-S.12.9.1--.12+meta", - "1.2.3----RC-SNAPSHOT.12.9.1--.12", - "1.0.0+0.build.1-rc.10000aaa-kk-0.1", - "99999999999999999999999.999999999999999999.99999999999999999", - "1.0.0-0A.is.legal", - ], - invalid: [ - "-invalid+invalid", - "-invalid.01", - "alpha", - "alpha.beta", - "alpha.beta.1", - "alpha.1", - "alpha+beta", - "alpha_beta", - "alpha.", - "alpha..", - "beta", - "1.0.0-alpha_beta", - "-alpha.", - "1.0.0-alpha..", - "1.0.0-alpha..1", - "1.0.0-alpha...1", - "1.0.0-alpha....1", - "1.0.0-alpha.....1", - "1.0.0-alpha......1", - "1.0.0-alpha.......1", - "01.1.1", - "1.01.1", - "1.1.01", - "1.2", - "1.2.3.DEV", - "1.2-SNAPSHOT", - "1.2.31.2.3----RC-SNAPSHOT.12.09.1--..12+788", - "1.2-RC-SNAPSHOT", - "-1.0.3-gamma+b7718", - "+justmeta", - "9.8.7+meta+meta", - "9.8.7-whatever+meta+meta", - "99999999999999999999999.999999999999999999.99999999999999999-", - "---RC-SNAPSHOT.12.09.1--------------------------------..12", - ], - }); - }); - - it("should validate base32 strings", () => { - test({ - validator: "isBase32", - valid: [ - "ZG======", - "JBSQ====", - "JBSWY===", - "JBSWY3A=", - "JBSWY3DP", - "JBSWY3DPEA======", - "K5SWYY3PNVSSA5DPEBXG6ZA=", - "K5SWYY3PNVSSA5DPEBXG6===", - ], - invalid: [ - "12345", - "", - "JBSWY3DPtesting123", - "ZG=====", - "Z======", - "Zm=8JBSWY3DP", - "=m9vYg==", - "Zm9vYm/y====", - ], - }); - }); - - it("should validate base32 strings with crockford alternative", () => { - test({ - validator: "isBase32", + 'ひらがな・カタカナ、.漢字', + '123456', + 'カタカナ゙ᆲ', + ], + }); + }); + + it('should validate surrogate pair strings', () => { + test({ + validator: 'isSurrogatePair', + valid: ['𠮷野𠮷', '𩸽', 'ABC千𥧄1-2-3'], + invalid: ['吉野竈', '鮪', 'ABC1-2-3'], + }); + }); + + it('should validate Semantic Versioning Specification (SemVer) strings', () => { + test({ + validator: 'isSemVer', + valid: [ + '0.0.4', + '1.2.3', + '10.20.30', + '1.1.2-prerelease+meta', + '1.1.2+meta', + '1.1.2+meta-valid', + '1.0.0-alpha', + '1.0.0-beta', + '1.0.0-alpha.beta', + '1.0.0-alpha.beta.1', + '1.0.0-alpha.1', + '1.0.0-alpha0.valid', + '1.0.0-alpha.0valid', + '1.0.0-alpha-a.b-c-somethinglong+build.1-aef.1-its-okay', + '1.0.0-rc.1+build.1', + '2.0.0-rc.1+build.123', + '1.2.3-beta', + '10.2.3-DEV-SNAPSHOT', + '1.2.3-SNAPSHOT-123', + '1.0.0', + '2.0.0', + '1.1.7', + '2.0.0+build.1848', + '2.0.1-alpha.1227', + '1.0.0-alpha+beta', + '1.2.3----RC-SNAPSHOT.12.9.1--.12+788', + '1.2.3----R-S.12.9.1--.12+meta', + '1.2.3----RC-SNAPSHOT.12.9.1--.12', + '1.0.0+0.build.1-rc.10000aaa-kk-0.1', + '99999999999999999999999.999999999999999999.99999999999999999', + '1.0.0-0A.is.legal', + ], + invalid: [ + '-invalid+invalid', + '-invalid.01', + 'alpha', + 'alpha.beta', + 'alpha.beta.1', + 'alpha.1', + 'alpha+beta', + 'alpha_beta', + 'alpha.', + 'alpha..', + 'beta', + '1.0.0-alpha_beta', + '-alpha.', + '1.0.0-alpha..', + '1.0.0-alpha..1', + '1.0.0-alpha...1', + '1.0.0-alpha....1', + '1.0.0-alpha.....1', + '1.0.0-alpha......1', + '1.0.0-alpha.......1', + '01.1.1', + '1.01.1', + '1.1.01', + '1.2', + '1.2.3.DEV', + '1.2-SNAPSHOT', + '1.2.31.2.3----RC-SNAPSHOT.12.09.1--..12+788', + '1.2-RC-SNAPSHOT', + '-1.0.3-gamma+b7718', + '+justmeta', + '9.8.7+meta+meta', + '9.8.7-whatever+meta+meta', + '99999999999999999999999.999999999999999999.99999999999999999-', + '---RC-SNAPSHOT.12.09.1--------------------------------..12', + ], + }); + }); + + it('should validate base32 strings', () => { + test({ + validator: 'isBase32', + valid: [ + 'ZG======', + 'JBSQ====', + 'JBSWY===', + 'JBSWY3A=', + 'JBSWY3DP', + 'JBSWY3DPEA======', + 'K5SWYY3PNVSSA5DPEBXG6ZA=', + 'K5SWYY3PNVSSA5DPEBXG6===', + ], + invalid: [ + '12345', + '', + 'JBSWY3DPtesting123', + 'ZG=====', + 'Z======', + 'Zm=8JBSWY3DP', + '=m9vYg==', + 'Zm9vYm/y====', + ], + }); + }); + + it('should validate base32 strings with crockford alternative', () => { + test({ + validator: 'isBase32', args: [{ crockford: true }], - valid: ["91JPRV3F41BPYWKCCGGG", "60", "64", "B5QQA833C5Q20S3F41MQ8"], + valid: ['91JPRV3F41BPYWKCCGGG', '60', '64', 'B5QQA833C5Q20S3F41MQ8'], invalid: [ - "91JPRV3F41BUPYWKCCGGG", - "B5QQA833C5Q20S3F41MQ8L", - "60I", - "B5QQA833OULIC5Q20S3F41MQ8", + '91JPRV3F41BUPYWKCCGGG', + 'B5QQA833C5Q20S3F41MQ8L', + '60I', + 'B5QQA833OULIC5Q20S3F41MQ8', ], }); }); - it("should validate base58 strings", () => { + it('should validate base58 strings', () => { test({ - validator: "isBase58", + validator: 'isBase58', valid: [ - "BukQL", - "3KMUV89zab", - "91GHkLMNtyo98", - "YyjKm3H", - "Mkhss145TRFg", - "7678765677", - "abcodpq", - "AAVHJKLPY", + 'BukQL', + '3KMUV89zab', + '91GHkLMNtyo98', + 'YyjKm3H', + 'Mkhss145TRFg', + '7678765677', + 'abcodpq', + 'AAVHJKLPY', ], invalid: [ - "0OPLJH", - "IMKLP23", - "KLMOmk986", - "LL1l1985hG", - "*MP9K", - "Zm=8JBSWY3DP", - ")()(=9292929MKL", + '0OPLJH', + 'IMKLP23', + 'KLMOmk986', + 'LL1l1985hG', + '*MP9K', + 'Zm=8JBSWY3DP', + ')()(=9292929MKL', ], }); }); - it("should validate base64 strings", () => { + it('should validate base64 strings', () => { test({ - validator: "isBase64", + validator: 'isBase64', valid: [ - "", - "Zg==", - "Zm8=", - "Zm9v", - "Zm9vYg==", - "Zm9vYmE=", - "Zm9vYmFy", - "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4=", - "Vml2YW11cyBmZXJtZW50dW0gc2VtcGVyIHBvcnRhLg==", - "U3VzcGVuZGlzc2UgbGVjdHVzIGxlbw==", - "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuMPNS1Ufof9EW/M98FNw" + - "UAKrwflsqVxaxQjBQnHQmiI7Vac40t8x7pIb8gLGV6wL7sBTJiPovJ0V7y7oc0Ye" + - "rhKh0Rm4skP2z/jHwwZICgGzBvA0rH8xlhUiTvcwDCJ0kc+fh35hNt8srZQM4619" + - "FTgB66Xmp4EtVyhpQV+t02g6NzK72oZI0vnAvqhpkxLeLiMCyrI416wHm5Tkukhx" + - "QmcL2a6hNOyu0ixX/x2kSFXApEnVrJ+/IxGyfyw8kf4N2IZpW5nEP847lpfj0SZZ" + - "Fwrd1mnfnDbYohX2zRptLy2ZUn06Qo9pkG5ntvFEPo9bfZeULtjYzIl6K8gJ2uGZ" + - "HQIDAQAB", + '', + 'Zg==', + 'Zm8=', + 'Zm9v', + 'Zm9vYg==', + 'Zm9vYmE=', + 'Zm9vYmFy', + 'TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4=', + 'Vml2YW11cyBmZXJtZW50dW0gc2VtcGVyIHBvcnRhLg==', + 'U3VzcGVuZGlzc2UgbGVjdHVzIGxlbw==', + 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuMPNS1Ufof9EW/M98FNw' + + 'UAKrwflsqVxaxQjBQnHQmiI7Vac40t8x7pIb8gLGV6wL7sBTJiPovJ0V7y7oc0Ye' + + 'rhKh0Rm4skP2z/jHwwZICgGzBvA0rH8xlhUiTvcwDCJ0kc+fh35hNt8srZQM4619' + + 'FTgB66Xmp4EtVyhpQV+t02g6NzK72oZI0vnAvqhpkxLeLiMCyrI416wHm5Tkukhx' + + 'QmcL2a6hNOyu0ixX/x2kSFXApEnVrJ+/IxGyfyw8kf4N2IZpW5nEP847lpfj0SZZ' + + 'Fwrd1mnfnDbYohX2zRptLy2ZUn06Qo9pkG5ntvFEPo9bfZeULtjYzIl6K8gJ2uGZ' + + 'HQIDAQAB', ], invalid: [ - "12345", - "Vml2YW11cyBmZXJtZtesting123", - "Zg=", - "Z===", - "Zm=8", - "=m9vYg==", - "Zm9vYmFy====", + '12345', + 'Vml2YW11cyBmZXJtZtesting123', + 'Zg=', + 'Z===', + 'Zm=8', + '=m9vYg==', + 'Zm9vYmFy====', ], }); test({ - validator: "isBase64", + validator: 'isBase64', args: [{ urlSafe: true }], valid: [ - "", - "bGFkaWVzIGFuZCBnZW50bGVtZW4sIHdlIGFyZSBmbG9hdGluZyBpbiBzcGFjZQ", - "1234", - "bXVtLW5ldmVyLXByb3Vk", - "PDw_Pz8-Pg", - "VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw", + '', + 'bGFkaWVzIGFuZCBnZW50bGVtZW4sIHdlIGFyZSBmbG9hdGluZyBpbiBzcGFjZQ', + '1234', + 'bXVtLW5ldmVyLXByb3Vk', + 'PDw_Pz8-Pg', + 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw', ], invalid: [ - " AA", - "\tAA", - "\rAA", - "\nAA", - "This+isa/bad+base64Url==", - "0K3RgtC+INC30LDQutC+0LTQuNGA0L7QstCw0L3QvdCw0Y8g0YHRgtGA0L7QutCw", + ' AA', + '\tAA', + '\rAA', + '\nAA', + 'This+isa/bad+base64Url==', + '0K3RgtC+INC30LDQutC+0LTQuNGA0L7QstCw0L3QvdCw0Y8g0YHRgtGA0L7QutCw', ], error: [null, undefined, {}, [], 42], }); - for (let i = 0, str = "", encoded; i < 1000; i++) { + for (let i = 0, str = '', encoded; i < 1000; i++) { str += String.fromCharCode((Math.random() * 26) | 97); // eslint-disable-line no-bitwise - encoded = Buffer.from(str).toString("base64"); + encoded = Buffer.from(str).toString('base64'); if (!validator.isBase64(encoded)) { let msg = format('validator.isBase64() failed with "%s"', encoded); throw new Error(msg); @@ -5216,20 +5216,20 @@ describe("Validators", () => { } }); - it("should validate hex-encoded MongoDB ObjectId", () => { + it('should validate hex-encoded MongoDB ObjectId', () => { test({ - validator: "isMongoId", - valid: ["507f1f77bcf86cd799439011"], + validator: 'isMongoId', + valid: ['507f1f77bcf86cd799439011'], invalid: [ - "507f1f77bcf86cd7994390", - "507f1f77bcf86cd79943901z", - "", - "507f1f77bcf86cd799439011 ", + '507f1f77bcf86cd7994390', + '507f1f77bcf86cd79943901z', + '', + '507f1f77bcf86cd799439011 ', ], }); }); - it("should define the module using an AMD-compatible loader", () => { + it('should define the module using an AMD-compatible loader', () => { let window = { validator: null, define(module) { @@ -5240,3115 +5240,3115 @@ describe("Validators", () => { let sandbox = vm.createContext(window); vm.runInContext(validator_js, sandbox); - assert.strictEqual(window.validator.trim(" foobar "), "foobar"); + assert.strictEqual(window.validator.trim(' foobar '), 'foobar'); }); - it("should bind validator to the window if no module loaders are available", () => { + it('should bind validator to the window if no module loaders are available', () => { let window = {}; let sandbox = vm.createContext(window); vm.runInContext(validator_js, sandbox); - assert.strictEqual(window.validator.trim(" foobar "), "foobar"); + assert.strictEqual(window.validator.trim(' foobar '), 'foobar'); }); - it("should validate mobile phone number", () => { + it('should validate mobile phone number', () => { let fixtures = [ { - locale: "am-AM", - valid: [ - "+37410324123", - "+37422298765", - "+37431276521", - "022698763", - "37491987654", - "+37494567890", - ], - invalid: [ - "12345", - "+37411498855", - "+37411498123", - "05614988556", - "", - "37456789000", - ], - }, - { - locale: "ar-AE", - valid: [ - "+971502674453", - "+971521247658", - "+971541255684", - "+971555454458", - "+971561498855", - "+971585215778", - "971585215778", - "0585215778", - "585215778", - ], - invalid: [ - "12345", - "+971511498855", - "+9715614988556", - "+9745614988556", - "", - "+9639626626262", - "+963332210972", - "0114152198", - "962796477263", - ], - }, - { - locale: "ar-BH", - valid: [ - "+97335078110", - "+97339534385", - "+97366331055", - "+97333146000", - "97335078110", - "35078110", - "66331055", + locale: 'am-AM', + valid: [ + '+37410324123', + '+37422298765', + '+37431276521', + '022698763', + '37491987654', + '+37494567890', + ], + invalid: [ + '12345', + '+37411498855', + '+37411498123', + '05614988556', + '', + '37456789000', + ], + }, + { + locale: 'ar-AE', + valid: [ + '+971502674453', + '+971521247658', + '+971541255684', + '+971555454458', + '+971561498855', + '+971585215778', + '971585215778', + '0585215778', + '585215778', + ], + invalid: [ + '12345', + '+971511498855', + '+9715614988556', + '+9745614988556', + '', + '+9639626626262', + '+963332210972', + '0114152198', + '962796477263', + ], + }, + { + locale: 'ar-BH', + valid: [ + '+97335078110', + '+97339534385', + '+97366331055', + '+97333146000', + '97335078110', + '35078110', + '66331055', ], - invalid: [ - "12345", - "+973350781101", - "+97379534385", - "+973035078110", - "", - "+9639626626262", - "+963332210972", - "0114152198", - "962796477263", - "035078110", - "16331055", - "hello", - "+9733507811a", - ], - }, - { - locale: "ar-EG", - valid: [ - "+201004513789", - "+201111453489", - "+201221204610", - "+201144621154", - "+201200124304", - "+201011201564", - "+201124679001", - "+201064790156", - "+201274652177", - "+201280134679", - "+201090124576", - "+201583728900", - "201599495596", - "201090124576", - "01090124576", - "01538920744", - "1593075993", - "1090124576", - ], - invalid: [ - "+221004513789", - "+201404513789", - "12345", - "", - "+9639626626262", - "+963332210972", - "0114152198", - "962796477263", - ], - }, - { - locale: "ar-JO", - valid: [ - "0796477263", - "0777866254", - "0786725261", - "+962796477263", - "+962777866254", - "+962786725261", - "962796477263", - "962777866254", - "962786725261", - ], - invalid: [ - "00962786725261", - "00962796477263", - "12345", - "", - "+9639626626262", - "+963332210972", - "0114152198", - ], - }, - { - locale: "ar-KW", - valid: [ - "96550000000", - "96560000000", - "96590000000", - "96541000000", - "+96550000000", - "+96550000220", - "+96551111220", - "+96541000000", - ], - invalid: [ - "+96570000220", - "00962786725261", - "00962796477263", - "12345", - "", - "+9639626626262", - "+963332210972", - "0114152198", - "+96540000000", - ], - }, - { - locale: "ar-LB", - valid: [ - "+96171234568", - "+9613123456", - "3456123", - "3123456", - "81978468", - "77675798", - ], - invalid: [ - "+961712345688888", - "00912220000", - "7767579888", - "+0921110000", - "+3123456888", - "021222200000", - "213333444444", - "", - "+212234", - "+21", - "02122333", - ], - }, - { - locale: "ar-LY", - valid: [ - "912220000", - "0923330000", - "218945550000", - "+218958880000", - "212220000", - "0212220000", - "+218212220000", + invalid: [ + '12345', + '+973350781101', + '+97379534385', + '+973035078110', + '', + '+9639626626262', + '+963332210972', + '0114152198', + '962796477263', + '035078110', + '16331055', + 'hello', + '+9733507811a', + ], + }, + { + locale: 'ar-EG', + valid: [ + '+201004513789', + '+201111453489', + '+201221204610', + '+201144621154', + '+201200124304', + '+201011201564', + '+201124679001', + '+201064790156', + '+201274652177', + '+201280134679', + '+201090124576', + '+201583728900', + '201599495596', + '201090124576', + '01090124576', + '01538920744', + '1593075993', + '1090124576', + ], + invalid: [ + '+221004513789', + '+201404513789', + '12345', + '', + '+9639626626262', + '+963332210972', + '0114152198', + '962796477263', + ], + }, + { + locale: 'ar-JO', + valid: [ + '0796477263', + '0777866254', + '0786725261', + '+962796477263', + '+962777866254', + '+962786725261', + '962796477263', + '962777866254', + '962786725261', + ], + invalid: [ + '00962786725261', + '00962796477263', + '12345', + '', + '+9639626626262', + '+963332210972', + '0114152198', + ], + }, + { + locale: 'ar-KW', + valid: [ + '96550000000', + '96560000000', + '96590000000', + '96541000000', + '+96550000000', + '+96550000220', + '+96551111220', + '+96541000000', + ], + invalid: [ + '+96570000220', + '00962786725261', + '00962796477263', + '12345', + '', + '+9639626626262', + '+963332210972', + '0114152198', + '+96540000000', + ], + }, + { + locale: 'ar-LB', + valid: [ + '+96171234568', + '+9613123456', + '3456123', + '3123456', + '81978468', + '77675798', + ], + invalid: [ + '+961712345688888', + '00912220000', + '7767579888', + '+0921110000', + '+3123456888', + '021222200000', + '213333444444', + '', + '+212234', + '+21', + '02122333', + ], + }, + { + locale: 'ar-LY', + valid: [ + '912220000', + '0923330000', + '218945550000', + '+218958880000', + '212220000', + '0212220000', + '+218212220000', ], invalid: [ - "9122220000", - "00912220000", - "09211110000", - "+0921110000", - "+2180921110000", - "021222200000", - "213333444444", - "", - "+212234", - "+21", - "02122333", + '9122220000', + '00912220000', + '09211110000', + '+0921110000', + '+2180921110000', + '021222200000', + '213333444444', + '', + '+212234', + '+21', + '02122333', ], }, { - locale: "ar-MA", + locale: 'ar-MA', valid: [ - "0522714782", - "0690851123", - "0708186135", - "+212522714782", - "+212690851123", - "+212708186135", - "00212522714782", - "00212690851123", - "00212708186135", + '0522714782', + '0690851123', + '0708186135', + '+212522714782', + '+212690851123', + '+212708186135', + '00212522714782', + '00212690851123', + '00212708186135', ], invalid: [ - "522714782", - "690851123", - "708186135", - "212522714782", - "212690851123", - "212708186135", - "0212522714782", - "0212690851123", - "0212708186135", - "", - "12345", - "0922714782", - "+212190851123", - "00212408186135", + '522714782', + '690851123', + '708186135', + '212522714782', + '212690851123', + '212708186135', + '0212522714782', + '0212690851123', + '0212708186135', + '', + '12345', + '0922714782', + '+212190851123', + '00212408186135', ], }, { - locale: "dz-BT", + locale: 'dz-BT', valid: [ - "+97517374354", - "+97517454971", - "77324646", - "016329712", - "97517265559", + '+97517374354', + '+97517454971', + '77324646', + '016329712', + '97517265559', ], - invalid: ["", "9898347255", "+96326626262", "963372", "0114152198"], + invalid: ['', '9898347255', '+96326626262', '963372', '0114152198'], }, { - locale: "ar-OM", - valid: ["+96891212121", "0096899999999", "93112211", "99099009"], + locale: 'ar-OM', + valid: ['+96891212121', '0096899999999', '93112211', '99099009'], invalid: [ - "+96890212121", - "0096890999999", - "0090999999", - "+9689021212", - "", - "+212234", - "+21", - "02122333", + '+96890212121', + '0096890999999', + '0090999999', + '+9689021212', + '', + '+212234', + '+21', + '02122333', ], }, { - locale: "ar-PS", - valid: ["+970563459876", "970592334218", "0566372345", "0598273583"], + locale: 'ar-PS', + valid: ['+970563459876', '970592334218', '0566372345', '0598273583'], invalid: [ - "+9759029487", - "97059123456789", - "598372348", - "97058aaaafjd", - "", - "05609123484", - "+97059", - "+970", - "97056", + '+9759029487', + '97059123456789', + '598372348', + '97058aaaafjd', + '', + '05609123484', + '+97059', + '+970', + '97056', ], }, { - locale: "ar-SY", + locale: 'ar-SY', valid: [ - "0944549710", - "+963944549710", - "956654379", - "0944549710", - "0962655597", + '0944549710', + '+963944549710', + '956654379', + '0944549710', + '0962655597', ], - invalid: ["12345", "", "+9639626626262", "+963332210972", "0114152198"], + invalid: ['12345', '', '+9639626626262', '+963332210972', '0114152198'], }, { - locale: "ar-SA", + locale: 'ar-SA', valid: [ - "0556578654", - "+966556578654", - "966556578654", - "596578654", - "572655597", + '0556578654', + '+966556578654', + '966556578654', + '596578654', + '572655597', ], - invalid: ["12345", "", "+9665626626262", "+96633221097", "0114152198"], + invalid: ['12345', '', '+9665626626262', '+96633221097', '0114152198'], }, { - locale: "ar-SD", - valid: ["0128652312", "+249919425113", "249123212345", "0993212345"], + locale: 'ar-SD', + valid: ['0128652312', '+249919425113', '249123212345', '0993212345'], invalid: [ - "12345", - "", - "+249972662622", - "+24946266262", - "+24933221097", - "0614152198", - "096554", + '12345', + '', + '+249972662622', + '+24946266262', + '+24933221097', + '0614152198', + '096554', ], }, { - locale: "ar-TN", - valid: ["23456789", "+21623456789", "21623456789"], - invalid: ["12345", "75200123", "+216512345678", "13520459", "85479520"], + locale: 'ar-TN', + valid: ['23456789', '+21623456789', '21623456789'], + invalid: ['12345', '75200123', '+216512345678', '13520459', '85479520'], }, { - locale: "bg-BG", - valid: ["+359897123456", "+359898888888", "0897123123"], - invalid: ["", "0898123", "+359212555666", "18001234567", "12125559999"], + locale: 'bg-BG', + valid: ['+359897123456', '+359898888888', '0897123123'], + invalid: ['', '0898123', '+359212555666', '18001234567', '12125559999'], }, { - locale: "bn-BD", + locale: 'bn-BD', valid: [ - "+8801794626846", - "01399098893", - "8801671163269", - "01717112029", - "8801898765432", - "+8801312345678", - "01494676946", + '+8801794626846', + '01399098893', + '8801671163269', + '01717112029', + '8801898765432', + '+8801312345678', + '01494676946', ], invalid: [ - "", - "0174626346", - "017943563469", - "18001234567", - "0131234567", + '', + '0174626346', + '017943563469', + '18001234567', + '0131234567', ], }, { - locale: "bs-BA", + locale: 'bs-BA', valid: [ - "060123456", - "061123456", - "062123456", - "063123456", - "0641234567", - "065123456", - "066123456", - "+38760123456", - "+38761123456", - "+38762123456", - "+38763123456", - "+387641234567", - "+38765123456", - "+38766123456", - "0038760123456", - "0038761123456", - "0038762123456", - "0038763123456", - "00387641234567", - "0038765123456", - "0038766123456", + '060123456', + '061123456', + '062123456', + '063123456', + '0641234567', + '065123456', + '066123456', + '+38760123456', + '+38761123456', + '+38762123456', + '+38763123456', + '+387641234567', + '+38765123456', + '+38766123456', + '0038760123456', + '0038761123456', + '0038762123456', + '0038763123456', + '00387641234567', + '0038765123456', + '0038766123456', ], invalid: [ - "0601234567", - "0611234567", - "06212345", - "06312345", - "064123456", - "0651234567", - "06612345", - "+3866123456", - "+3856123456", - "00038760123456", - "038761123456", + '0601234567', + '0611234567', + '06212345', + '06312345', + '064123456', + '0651234567', + '06612345', + '+3866123456', + '+3856123456', + '00038760123456', + '038761123456', ], }, { - locale: "cs-CZ", + locale: 'cs-CZ', valid: [ - "+420 123 456 789", - "+420 123456789", - "+420123456789", - "123 456 789", - "123456789", + '+420 123 456 789', + '+420 123456789', + '+420123456789', + '123 456 789', + '123456789', ], invalid: [ - "", - "+42012345678", - "+421 123 456 789", - "+420 023456789", - "+4201234567892", + '', + '+42012345678', + '+421 123 456 789', + '+420 023456789', + '+4201234567892', ], }, - { - locale: "sk-SK", - valid: [ - "+421 123 456 789", - "+421 123456789", - "+421123456789", - "123 456 789", - "123456789", - ], - invalid: [ - "", - "+42112345678", - "+422 123 456 789", - "+421 023456789", - "+4211234567892", - ], - }, - { - locale: "de-DE", - valid: [ - "+4915123456789", - "015123456789", - "015123456789", - "015623456789", - "015623456789", - "01601234567", - "016012345678", - "01621234567", - "01631234567", - "01701234567", - "017612345678", - ], - invalid: [ - "+4930405044550", - "34412345678", - "14412345678", - "16212345678", - "1761234567", - "16412345678", - "17012345678", - "+4912345678910", - "+49015123456789", - "015345678910", - "015412345678", - ], - }, - { - locale: "de-AT", - valid: [ - "+436761234567", - "06761234567", - "00436123456789", - "+436123456789", - "01999", - "+4372876", - "06434908989562345", - ], - invalid: ["167612345678", "1234", "064349089895623459"], - }, - { - locale: "hu-HU", - valid: ["06301234567", "+36201234567", "06701234567"], - invalid: ["1234", "06211234567", "+3620123456"], - }, - { - locale: "mz-MZ", - valid: [ - "+258849229754", - "258849229754", - "849229754", - "829229754", - "839229754", - "869229754", - "859229754", - "869229754", - "879229754", - "+258829229754", - "+258839229754", - "+258869229754", - "+258859229754", - "+258869229754", - "+258879229754", - "258829229754", - "258839229754", - "258869229754", - "258859229754", - "258869229754", - "258879229754", - ], - invalid: [ - "+248849229754", - "158849229754", - "249229754", - "819229754", - "899229754", - "889229754", - "89229754", - "8619229754", - "87922975411", - "257829229754", - "+255839229754", - "+2258869229754", - "+1258859229754", - "+2588692297541", - "+2588792519754", - "25882922975411", - ], - }, - { - locale: "pt-BR", - valid: [ - "+55 12 996551215", - "+55 15 97661234", - "+55 (12) 996551215", - "+55 (15) 97661234", - "55 (17) 96332-2155", - "55 (17) 6332-2155", - "55 15 976612345", - "55 15 75661234", - "+5512984567890", - "+551283456789", - "5512984567890", - "551283456789", - "015994569878", - "01593456987", - "022995678947", - "02299567894", - "(22)99567894", - "(22)9956-7894", - "(22) 99567894", - "(22) 9956-7894", - "(22)999567894", - "(22)99956-7894", - "(22) 999567894", - "(22) 99956-7894", - "(11) 94123-4567", - "(11) 91431-4567", - "+55 (11) 91431-4567", - "+55 11 91431-4567", - "+551191431-4567", - "5511914314567", - "5511912345678", - ], - invalid: [ - "0819876543", - "+55 15 7566123", - "+017 123456789", - "5501599623874", - "+55012962308", - "+55 015 1234-3214", - "+55 11 90431-4567", - "+55 (11) 90431-4567", - "+551190431-4567", - "5511904314567", - "5511902345678", - "(11) 90431-4567", - ], - }, - { - locale: "zh-CN", - valid: [ - "13523333233", - "13838389438", - "14899230918", - "14999230918", - "15323456787", - "15052052020", - "16237108167", - "008616238234822", - "+8616238234822", - "16565600001", - "17269427292", - "17469427292", - "18199617480", - "19151751717", - "19651751717", - "+8613238234822", - "+8613487234567", - "+8617823492338", - "+8617823492338", - "+8616637108167", - "+8616637108167", - "+8616712341234", - "+8619912341234", - "+8619812341234", - "+8619712341234", - "+8619612341234", - "+8619512341234", - "+8619312341234", - "+8619212341234", - "+8619112341234", - "+8617269427292", - "008618812341234", - "008618812341234", - "008617269427292", + { + locale: 'sk-SK', + valid: [ + '+421 123 456 789', + '+421 123456789', + '+421123456789', + '123 456 789', + '123456789', + ], + invalid: [ + '', + '+42112345678', + '+422 123 456 789', + '+421 023456789', + '+4211234567892', + ], + }, + { + locale: 'de-DE', + valid: [ + '+4915123456789', + '015123456789', + '015123456789', + '015623456789', + '015623456789', + '01601234567', + '016012345678', + '01621234567', + '01631234567', + '01701234567', + '017612345678', + ], + invalid: [ + '+4930405044550', + '34412345678', + '14412345678', + '16212345678', + '1761234567', + '16412345678', + '17012345678', + '+4912345678910', + '+49015123456789', + '015345678910', + '015412345678', + ], + }, + { + locale: 'de-AT', + valid: [ + '+436761234567', + '06761234567', + '00436123456789', + '+436123456789', + '01999', + '+4372876', + '06434908989562345', + ], + invalid: ['167612345678', '1234', '064349089895623459'], + }, + { + locale: 'hu-HU', + valid: ['06301234567', '+36201234567', '06701234567'], + invalid: ['1234', '06211234567', '+3620123456'], + }, + { + locale: 'mz-MZ', + valid: [ + '+258849229754', + '258849229754', + '849229754', + '829229754', + '839229754', + '869229754', + '859229754', + '869229754', + '879229754', + '+258829229754', + '+258839229754', + '+258869229754', + '+258859229754', + '+258869229754', + '+258879229754', + '258829229754', + '258839229754', + '258869229754', + '258859229754', + '258869229754', + '258879229754', + ], + invalid: [ + '+248849229754', + '158849229754', + '249229754', + '819229754', + '899229754', + '889229754', + '89229754', + '8619229754', + '87922975411', + '257829229754', + '+255839229754', + '+2258869229754', + '+1258859229754', + '+2588692297541', + '+2588792519754', + '25882922975411', + ], + }, + { + locale: 'pt-BR', + valid: [ + '+55 12 996551215', + '+55 15 97661234', + '+55 (12) 996551215', + '+55 (15) 97661234', + '55 (17) 96332-2155', + '55 (17) 6332-2155', + '55 15 976612345', + '55 15 75661234', + '+5512984567890', + '+551283456789', + '5512984567890', + '551283456789', + '015994569878', + '01593456987', + '022995678947', + '02299567894', + '(22)99567894', + '(22)9956-7894', + '(22) 99567894', + '(22) 9956-7894', + '(22)999567894', + '(22)99956-7894', + '(22) 999567894', + '(22) 99956-7894', + '(11) 94123-4567', + '(11) 91431-4567', + '+55 (11) 91431-4567', + '+55 11 91431-4567', + '+551191431-4567', + '5511914314567', + '5511912345678', + ], + invalid: [ + '0819876543', + '+55 15 7566123', + '+017 123456789', + '5501599623874', + '+55012962308', + '+55 015 1234-3214', + '+55 11 90431-4567', + '+55 (11) 90431-4567', + '+551190431-4567', + '5511904314567', + '5511902345678', + '(11) 90431-4567', + ], + }, + { + locale: 'zh-CN', + valid: [ + '13523333233', + '13838389438', + '14899230918', + '14999230918', + '15323456787', + '15052052020', + '16237108167', + '008616238234822', + '+8616238234822', + '16565600001', + '17269427292', + '17469427292', + '18199617480', + '19151751717', + '19651751717', + '+8613238234822', + '+8613487234567', + '+8617823492338', + '+8617823492338', + '+8616637108167', + '+8616637108167', + '+8616712341234', + '+8619912341234', + '+8619812341234', + '+8619712341234', + '+8619612341234', + '+8619512341234', + '+8619312341234', + '+8619212341234', + '+8619112341234', + '+8617269427292', + '008618812341234', + '008618812341234', + '008617269427292', // Reserve number segments in the future. - "92138389438", - "+8692138389438", - "008692138389438", - "98199649964", - "+8698099649964", - "008698099649964", + '92138389438', + '+8692138389438', + '008692138389438', + '98199649964', + '+8698099649964', + '008698099649964', ], invalid: [ - "12345", - "", - "12038389438", - "12838389438", - "013838389438", - "+86-13838389438", - "+08613811211114", - "+008613811211114", - "08613811211114", - "0086-13811211114", - "0086-138-1121-1114", - "Vml2YW11cyBmZXJtZtesting123", - "010-38238383", + '12345', + '', + '12038389438', + '12838389438', + '013838389438', + '+86-13838389438', + '+08613811211114', + '+008613811211114', + '08613811211114', + '0086-13811211114', + '0086-138-1121-1114', + 'Vml2YW11cyBmZXJtZtesting123', + '010-38238383', ], }, { - locale: "zh-TW", + locale: 'zh-TW', valid: [ - "0987123456", - "+886987123456", - "886987123456", - "+886-987123456", - "886-987123456", + '0987123456', + '+886987123456', + '886987123456', + '+886-987123456', + '886-987123456', ], - invalid: ["12345", "", "Vml2YW11cyBmZXJtZtesting123", "0-987123456"], + invalid: ['12345', '', 'Vml2YW11cyBmZXJtZtesting123', '0-987123456'], }, { - local: "en-LS", + local: 'en-LS', valid: [ - "+26622123456", - "+26628123456", - "+26657123456", - "+26658123456", - "+26659123456", - "+26627123456", - "+26652123456", + '+26622123456', + '+26628123456', + '+26657123456', + '+26658123456', + '+26659123456', + '+26627123456', + '+26652123456', ], invalid: [ - "+26612345678", - "", - "2664512-21", - "+2662212345678", - "someString", + '+26612345678', + '', + '2664512-21', + '+2662212345678', + 'someString', ], }, { - locale: "en-BM", - valid: ["+14417974653", "14413986653", "4415370973", "+14415005489"], + locale: 'en-BM', + valid: ['+14417974653', '14413986653', '4415370973', '+14415005489'], invalid: [ - "85763287", - "+14412020436", - "+14412236546", - "+14418245567", - "+14416546789", - "44087635627", - "+4418970973", - "", - "+1441897465", - "+1441897465 additional invalid string part", + '85763287', + '+14412020436', + '+14412236546', + '+14418245567', + '+14416546789', + '44087635627', + '+4418970973', + '', + '+1441897465', + '+1441897465 additional invalid string part', ], }, { - locale: "en-BS", + locale: 'en-BS', valid: [ - "+12421231234", - "2421231234", - "+1-2421231234", - "+1-242-123-1234", - "(242)-123-1234", - "+1 (242)-123-1234", - "242 123-1234", - "(242) 123 1234", + '+12421231234', + '2421231234', + '+1-2421231234', + '+1-242-123-1234', + '(242)-123-1234', + '+1 (242)-123-1234', + '242 123-1234', + '(242) 123 1234', ], invalid: [ - "85763287", - "+1 242 12 12 12 12", - "+1424123123", - "+14418245567", - "+14416546789", - "not a number", - "", + '85763287', + '+1 242 12 12 12 12', + '+1424123123', + '+14418245567', + '+14416546789', + 'not a number', + '', ], }, { - locale: "en-ZA", - valid: ["0821231234", "+27821231234", "27821231234"], + locale: 'en-ZA', + valid: ['0821231234', '+27821231234', '27821231234'], invalid: [ - "082123", - "08212312345", - "21821231234", - "+21821231234", - "+0821231234", + '082123', + '08212312345', + '21821231234', + '+21821231234', + '+0821231234', ], }, { - locale: "en-AU", - valid: ["61404111222", "+61411222333", "0417123456"], + locale: 'en-AU', + valid: ['61404111222', '+61411222333', '0417123456'], invalid: [ - "082123", - "08212312345", - "21821231234", - "+21821231234", - "+0821231234", - "04123456789", + '082123', + '08212312345', + '21821231234', + '+21821231234', + '+0821231234', + '04123456789', ], }, { - locale: "es-BO", + locale: 'es-BO', valid: [ - "+59175553635", - "+59162223685", - "+59179783890", - "+59160081890", - "79783890", - "60081890", + '+59175553635', + '+59162223685', + '+59179783890', + '+59160081890', + '79783890', + '60081890', ], invalid: [ - "082123", - "08212312345", - "21821231234", - "+21821231234", - "+59199783890", + '082123', + '08212312345', + '21821231234', + '+21821231234', + '+59199783890', ], }, { - locale: "en-GG", + locale: 'en-GG', valid: [ - "+441481123456", - "+441481789123", - "441481123456", - "441481789123", + '+441481123456', + '+441481789123', + '441481123456', + '441481789123', ], - invalid: ["999", "+441481123456789", "+447123456789"], + invalid: ['999', '+441481123456789', '+447123456789'], }, { - locale: "en-GH", + locale: 'en-GH', valid: [ - "0202345671", - "0502345671", - "0242345671", - "0542345671", - "0272345671", - "0572345671", - "0262345671", - "0562345671", - "0232345671", - "0282345671", - "+233202345671", - "+233502345671", - "+233242345671", - "+233542345671", - "+233272345671", - "+233572345671", - "+233262345671", - "+233562345671", - "+233232345671", - "+233282345671", - "+233592349493", - "0550298219", + '0202345671', + '0502345671', + '0242345671', + '0542345671', + '0272345671', + '0572345671', + '0262345671', + '0562345671', + '0232345671', + '0282345671', + '+233202345671', + '+233502345671', + '+233242345671', + '+233542345671', + '+233272345671', + '+233572345671', + '+233262345671', + '+233562345671', + '+233232345671', + '+233282345671', + '+233592349493', + '0550298219', ], - invalid: ["082123", "232345671", "0292345671", "+233292345671"], + invalid: ['082123', '232345671', '0292345671', '+233292345671'], }, { - locale: "en-GY", - valid: ["+5926121234", "06121234", "06726381", "+5926726381"], + locale: 'en-GY', + valid: ['+5926121234', '06121234', '06726381', '+5926726381'], invalid: [ - "5926121234", - "6121234", - "+592 6121234", - "05926121234", - "+592-6121234", + '5926121234', + '6121234', + '+592 6121234', + '05926121234', + '+592-6121234', ], }, { - locale: "en-HK", + locale: 'en-HK', valid: [ - "91234567", - "9123-4567", - "61234567", - "51234567", - "+85291234567", - "+852-91234567", - "+852-9123-4567", - "+852 9123 4567", - "9123 4567", - "852-91234567", + '91234567', + '9123-4567', + '61234567', + '51234567', + '+85291234567', + '+852-91234567', + '+852-9123-4567', + '+852 9123 4567', + '9123 4567', + '852-91234567', ], - invalid: ["999", "+852-912345678", "123456789", "+852-1234-56789"], + invalid: ['999', '+852-912345678', '123456789', '+852-1234-56789'], }, { - locale: "en-MO", + locale: 'en-MO', valid: [ - "61234567", - "+85361234567", - "+853-61234567", - "+853-6123-4567", - "+853 6123 4567", - "6123 4567", - "853-61234567", + '61234567', + '+85361234567', + '+853-61234567', + '+853-6123-4567', + '+853 6123 4567', + '6123 4567', + '853-61234567', ], invalid: [ - "999", - "12345678", - "612345678", - "+853-12345678", - "+853-22345678", - "+853-82345678", - "+853-612345678", - "+853-1234-5678", - "+853 1234 5678", - "+853-6123-45678", + '999', + '12345678', + '612345678', + '+853-12345678', + '+853-22345678', + '+853-82345678', + '+853-612345678', + '+853-1234-5678', + '+853 1234 5678', + '+853-6123-45678', ], }, { - locale: "en-IE", + locale: 'en-IE', valid: [ - "+353871234567", - "353831234567", - "353851234567", - "353861234567", - "353871234567", - "353881234567", - "353891234567", - "0871234567", - "0851234567", + '+353871234567', + '353831234567', + '353851234567', + '353861234567', + '353871234567', + '353881234567', + '353891234567', + '0871234567', + '0851234567', ], invalid: [ - "999", - "+353341234567", - "+33589484858", - "353841234567", - "353811234567", + '999', + '+353341234567', + '+33589484858', + '353841234567', + '353811234567', ], }, { - locale: "en-JM", - valid: ["+8761021234", "8761211234", "8763511274", "+8764511274"], + locale: 'en-JM', + valid: ['+8761021234', '8761211234', '8763511274', '+8764511274'], invalid: [ - "999", - "+876102123422", - "+8861021234", - "8761021212213", - "876102123", + '999', + '+876102123422', + '+8861021234', + '8761021212213', + '876102123', ], }, { - locale: "en-KE", + locale: 'en-KE', valid: [ - "+254728590432", - "+254733875610", - "254728590234", - "0733346543", - "0700459022", - "0110934567", - "+254110456794", - "254198452389", + '+254728590432', + '+254733875610', + '254728590234', + '0733346543', + '0700459022', + '0110934567', + '+254110456794', + '254198452389', ], - invalid: ["999", "+25489032", "123456789", "+254800723845"], + invalid: ['999', '+25489032', '123456789', '+254800723845'], }, { - locale: "fr-CF", + locale: 'fr-CF', valid: [ - "+23670850000", - "+23675038756", - "+23677859002", - "+23672854202", - "+23621854052", - "+23622854072", - "72234650", - "70045902", - "77934567", - "21456794", - "22452389", + '+23670850000', + '+23675038756', + '+23677859002', + '+23672854202', + '+23621854052', + '+23622854072', + '72234650', + '70045902', + '77934567', + '21456794', + '22452389', ], invalid: [ - "+23689032", - "123456789", - "+236723845987", - "022452389", - "+236772345678", - "+236700456794", + '+23689032', + '123456789', + '+236723845987', + '022452389', + '+236772345678', + '+236700456794', ], }, { - locale: "en-KI", - valid: ["+68673140000", "68673059999", "+68663000000", "68663019999"], + locale: 'en-KI', + valid: ['+68673140000', '68673059999', '+68663000000', '68663019999'], invalid: [ - "+68653000000", - "68664019999", - "+68619019999", - "686123456789", - "+686733445", + '+68653000000', + '68664019999', + '+68619019999', + '686123456789', + '+686733445', ], }, { - locale: "en-MT", - valid: ["+35699000000", "+35679000000", "99000000"], - invalid: ["356", "+35699000", "+35610000000"], + locale: 'en-MT', + valid: ['+35699000000', '+35679000000', '99000000'], + invalid: ['356', '+35699000', '+35610000000'], }, { - locale: "en-PH", + locale: 'en-PH', valid: [ - "+639275149120", - "+639275142327", - "+639003002023", - "09275149116", - "09194877624", + '+639275149120', + '+639275142327', + '+639003002023', + '09275149116', + '09194877624', ], invalid: [ - "12112-13-345", - "12345678901", - "sx23YW11cyBmZxxXJt123123", - "010-38238383", - "966684123123-2590", + '12112-13-345', + '12345678901', + 'sx23YW11cyBmZxxXJt123123', + '010-38238383', + '966684123123-2590', ], }, { - locale: "en-UG", + locale: 'en-UG', valid: [ - "+256728590432", - "+256733875610", - "256728590234", - "0773346543", - "0700459022", + '+256728590432', + '+256733875610', + '256728590234', + '0773346543', + '0700459022', ], invalid: [ - "999", - "+254728590432", - "+25489032", - "123456789", - "+254800723845", + '999', + '+254728590432', + '+25489032', + '123456789', + '+254800723845', ], }, { - locale: "en-RW", + locale: 'en-RW', valid: [ - "+250728590432", - "+250733875610", - "250738590234", - "0753346543", - "0780459022", + '+250728590432', + '+250733875610', + '250738590234', + '0753346543', + '0780459022', ], invalid: [ - "999", - "+254728590432", - "+25089032", - "123456789", - "+250800723845", + '999', + '+254728590432', + '+25089032', + '123456789', + '+250800723845', ], }, { - locale: "en-TZ", + locale: 'en-TZ', valid: [ - "+255728590432", - "+255733875610", - "255628590234", - "0673346543", - "0600459022", + '+255728590432', + '+255733875610', + '255628590234', + '0673346543', + '0600459022', ], invalid: [ - "999", - "+254728590432", - "+25589032", - "123456789", - "+255800723845", + '999', + '+254728590432', + '+25589032', + '123456789', + '+255800723845', ], }, { - locale: "en-MW", + locale: 'en-MW', valid: [ - "+265994563785", - "+265111785436", - "+265318596857", - "0320008744", - "01256258", - "0882541896", - "+265984563214", + '+265994563785', + '+265111785436', + '+265318596857', + '0320008744', + '01256258', + '0882541896', + '+265984563214', ], invalid: [ - "58563", - "+2658256258", - "0896328741", - "0708574896", - "+26570857489635", + '58563', + '+2658256258', + '0896328741', + '0708574896', + '+26570857489635', ], }, { - locale: "es-PE", + locale: 'es-PE', valid: [ - "+51912232764", - "+51923464567", - "+51968267382", - "+51908792973", - "974980472", - "908792973", - "+51974980472", + '+51912232764', + '+51923464567', + '+51968267382', + '+51908792973', + '974980472', + '908792973', + '+51974980472', ], invalid: [ - "999", - "+51812232764", - "+5181223276499", - "+25589032", - "123456789", + '999', + '+51812232764', + '+5181223276499', + '+25589032', + '123456789', ], }, { - locale: "fr-FR", + locale: 'fr-FR', valid: [ - "0612457898", - "+33612457898", - "33612457898", - "0712457898", - "+33712457898", - "33712457898", + '0612457898', + '+33612457898', + '33612457898', + '0712457898', + '+33712457898', + '33712457898', ], invalid: [ - "061245789", - "06124578980", - "0112457898", - "0212457898", - "0312457898", - "0412457898", - "0512457898", - "0812457898", - "0912457898", - "+34612457898", - "+336124578980", - "+3361245789", + '061245789', + '06124578980', + '0112457898', + '0212457898', + '0312457898', + '0412457898', + '0512457898', + '0812457898', + '0912457898', + '+34612457898', + '+336124578980', + '+3361245789', ], }, { - locale: "fr-BF", + locale: 'fr-BF', valid: [ - "+22661245789", - "+22665903092", - "+22672457898", - "+22673572346", - "061245789", - "071245783", + '+22661245789', + '+22665903092', + '+22672457898', + '+22673572346', + '061245789', + '071245783', ], invalid: [ - "0612457892", - "06124578980", - "0112457898", - "0212457898", - "0312457898", - "0412457898", - "0512457898", - "0812457898", - "0912457898", - "+22762457898", - "+226724578980", - "+22634523", + '0612457892', + '06124578980', + '0112457898', + '0212457898', + '0312457898', + '0412457898', + '0512457898', + '0812457898', + '0912457898', + '+22762457898', + '+226724578980', + '+22634523', ], }, { - locale: "fr-BJ", + locale: 'fr-BJ', valid: [ - "+22920215789", - "+22920293092", - "+22921307898", - "+22921736346", - "+22922416346", - "+22923836346", + '+22920215789', + '+22920293092', + '+22921307898', + '+22921736346', + '+22922416346', + '+22923836346', ], invalid: [ - "0612457892", - "01122921737346", - "+22762457898", - "+226724578980", - "+22634523", + '0612457892', + '01122921737346', + '+22762457898', + '+226724578980', + '+22634523', ], }, { - locale: "fr-CA", - valid: ["19876543210", "8005552222", "+15673628910"], + locale: 'fr-CA', + valid: ['19876543210', '8005552222', '+15673628910'], invalid: [ - "564785", - "0123456789", - "1437439210", - "+10345672645", - "11435213543", + '564785', + '0123456789', + '1437439210', + '+10345672645', + '11435213543', ], }, { - locale: "fr-CD", + locale: 'fr-CD', valid: [ - "+243818590432", - "+243893875610", - "243978590234", - "0813346543", - "0820459022", - "+243902590221", + '+243818590432', + '+243893875610', + '243978590234', + '0813346543', + '0820459022', + '+243902590221', ], invalid: [ - "243", - "+254818590432", - "+24389032", - "123456789", - "+243700723845", + '243', + '+254818590432', + '+24389032', + '123456789', + '+243700723845', ], }, { - locale: "fr-GF", + locale: 'fr-GF', valid: [ - "0612457898", - "+594612457898", - "594612457898", - "0712457898", - "+594712457898", - "594712457898", + '0612457898', + '+594612457898', + '594612457898', + '0712457898', + '+594712457898', + '594712457898', ], invalid: [ - "061245789", - "06124578980", - "0112457898", - "0212457898", - "0312457898", - "0412457898", - "0512457898", - "0812457898", - "0912457898", - "+54612457898", - "+5946124578980", - "+59461245789", + '061245789', + '06124578980', + '0112457898', + '0212457898', + '0312457898', + '0412457898', + '0512457898', + '0812457898', + '0912457898', + '+54612457898', + '+5946124578980', + '+59461245789', ], }, { - locale: "fr-GP", + locale: 'fr-GP', valid: [ - "0612457898", - "+590612457898", - "590612457898", - "0712457898", - "+590712457898", - "590712457898", + '0612457898', + '+590612457898', + '590612457898', + '0712457898', + '+590712457898', + '590712457898', ], invalid: [ - "061245789", - "06124578980", - "0112457898", - "0212457898", - "0312457898", - "0412457898", - "0512457898", - "0812457898", - "0912457898", - "+594612457898", - "+5906124578980", - "+59061245789", + '061245789', + '06124578980', + '0112457898', + '0212457898', + '0312457898', + '0412457898', + '0512457898', + '0812457898', + '0912457898', + '+594612457898', + '+5906124578980', + '+59061245789', ], }, { - locale: "fr-MQ", + locale: 'fr-MQ', valid: [ - "0612457898", - "+596612457898", - "596612457898", - "0712457898", - "+596712457898", - "596712457898", + '0612457898', + '+596612457898', + '596612457898', + '0712457898', + '+596712457898', + '596712457898', ], invalid: [ - "061245789", - "06124578980", - "0112457898", - "0212457898", - "0312457898", - "0412457898", - "0512457898", - "0812457898", - "0912457898", - "+594612457898", - "+5966124578980", - "+59661245789", + '061245789', + '06124578980', + '0112457898', + '0212457898', + '0312457898', + '0412457898', + '0512457898', + '0812457898', + '0912457898', + '+594612457898', + '+5966124578980', + '+59661245789', ], }, { - locale: "fr-RE", + locale: 'fr-RE', valid: [ - "0612457898", - "+262612457898", - "262612457898", - "0712457898", - "+262712457898", - "262712457898", - ], - invalid: [ - "061245789", - "06124578980", - "0112457898", - "0212457898", - "0312457898", - "0412457898", - "0512457898", - "0812457898", - "0912457898", - "+264612457898", - "+2626124578980", - "+26261245789", - ], - }, - { - locale: "fr-PF", - valid: [ - "87123456", - "88123456", - "89123456", - "+68987123456", - "+68988123456", - "+68989123456", - "68987123456", - "68988123456", - "68989123456", - ], - invalid: [ - "7123456", - "86123456", - "87 12 34 56", - "definitely not a number", - "01+68988123456", - "6898912345", - ], - }, - { - locale: "fr-WF", - valid: [ - "+681408500", - "+681499387", - "+681728590", - "+681808542", - "+681828540", - "+681832014", - "408500", - "499387", - "728590", - "808542", - "828540", - "832014", - ], - invalid: [ - "+68189032", - "123456789", - "+681723845987", - "022452389", - "+681772345678", - "+681700456794", - ], - }, - { - locale: "ka-GE", - valid: [ - "+995500011111", - "+995515352134", - "+995798526662", - "798526662", - "500011119", - "798526662", - "+995799766525", - ], - invalid: [ - "+99550001111", - "+9957997665250", - "+9959997665251", - "+995780011111", - "20000000000", - "68129485729", - "6589394827", - "298RI89572", - ], - }, - { - locale: "el-GR", - valid: [ - "+306944848966", - "306944848966", - "06904567890", - "6944848966", - "6904567890", - "6914567890", - "6934567890", - "6944567890", - "6954567890", - "6974567890", - "6984567890", - "6994567890", - "6854567890", - "6864567890", - "6874567890", - "6884567890", - "6894567890", - ], - invalid: [ - "2102323234", - "+302646041461", - "120000000", - "20000000000", - "68129485729", - "6589394827", - "298RI89572", - "6924567890", - "6964567890", - "6844567890", - "690456789", - "00690456789", - "not a number", - ], - }, - { - locale: "el-CY", + '0612457898', + '+262612457898', + '262612457898', + '0712457898', + '+262712457898', + '262712457898', + ], + invalid: [ + '061245789', + '06124578980', + '0112457898', + '0212457898', + '0312457898', + '0412457898', + '0512457898', + '0812457898', + '0912457898', + '+264612457898', + '+2626124578980', + '+26261245789', + ], + }, + { + locale: 'fr-PF', + valid: [ + '87123456', + '88123456', + '89123456', + '+68987123456', + '+68988123456', + '+68989123456', + '68987123456', + '68988123456', + '68989123456', + ], + invalid: [ + '7123456', + '86123456', + '87 12 34 56', + 'definitely not a number', + '01+68988123456', + '6898912345', + ], + }, + { + locale: 'fr-WF', + valid: [ + '+681408500', + '+681499387', + '+681728590', + '+681808542', + '+681828540', + '+681832014', + '408500', + '499387', + '728590', + '808542', + '828540', + '832014', + ], + invalid: [ + '+68189032', + '123456789', + '+681723845987', + '022452389', + '+681772345678', + '+681700456794', + ], + }, + { + locale: 'ka-GE', + valid: [ + '+995500011111', + '+995515352134', + '+995798526662', + '798526662', + '500011119', + '798526662', + '+995799766525', + ], + invalid: [ + '+99550001111', + '+9957997665250', + '+9959997665251', + '+995780011111', + '20000000000', + '68129485729', + '6589394827', + '298RI89572', + ], + }, + { + locale: 'el-GR', + valid: [ + '+306944848966', + '306944848966', + '06904567890', + '6944848966', + '6904567890', + '6914567890', + '6934567890', + '6944567890', + '6954567890', + '6974567890', + '6984567890', + '6994567890', + '6854567890', + '6864567890', + '6874567890', + '6884567890', + '6894567890', + ], + invalid: [ + '2102323234', + '+302646041461', + '120000000', + '20000000000', + '68129485729', + '6589394827', + '298RI89572', + '6924567890', + '6964567890', + '6844567890', + '690456789', + '00690456789', + 'not a number', + ], + }, + { + locale: 'el-CY', valid: [ - "96546247", - "96978927", - "+35799837145", - "+35799646792", - "96056927", - "99629593", - "99849980", - "3599701619", - "+3599148725", - "96537247", - "3596676533", + '96546247', + '96978927', + '+35799837145', + '+35799646792', + '96056927', + '99629593', + '99849980', + '3599701619', + '+3599148725', + '96537247', + '3596676533', ], - invalid: [ - "", - "somechars", - "9697892", - "998499803", - "33799837145", - "+3799646792", - "93056927", + invalid: [ + '', + 'somechars', + '9697892', + '998499803', + '33799837145', + '+3799646792', + '93056927', ], }, { - locale: "en-GB", - valid: ["447789345856", "+447861235675", "07888814488"], + locale: 'en-GB', + valid: ['447789345856', '+447861235675', '07888814488'], invalid: [ - "67699567", - "0773894868", - "077389f8688", - "+07888814488", - "0152456999", - "442073456754", - "+443003434751", - "05073456754", - "08001123123", + '67699567', + '0773894868', + '077389f8688', + '+07888814488', + '0152456999', + '442073456754', + '+443003434751', + '05073456754', + '08001123123', ], }, { - locale: "en-SG", + locale: 'en-SG', valid: [ - "32891278", - "87654321", - "98765432", - "+6587654321", - "+6598765432", - "+6565241234", + '32891278', + '87654321', + '98765432', + '+6587654321', + '+6598765432', + '+6565241234', ], invalid: [ - "332891231", - "987654321", - "876543219", - "8765432", - "9876543", - "12345678", - "+98765432", - "+9876543212", - "+15673628910", - "19876543210", - "8005552222", + '332891231', + '987654321', + '876543219', + '8765432', + '9876543', + '12345678', + '+98765432', + '+9876543212', + '+15673628910', + '19876543210', + '8005552222', ], }, { - locale: "en-US", + locale: 'en-US', valid: [ - "19876543210", - "8005552222", - "+15673628910", - "+1(567)3628910", - "+1(567)362-8910", - "+1(567) 362-8910", - "1(567)362-8910", - "1(567)362 8910", - "223-456-7890", + '19876543210', + '8005552222', + '+15673628910', + '+1(567)3628910', + '+1(567)362-8910', + '+1(567) 362-8910', + '1(567)362-8910', + '1(567)362 8910', + '223-456-7890', ], invalid: [ - "564785", - "0123456789", - "1437439210", - "+10345672645", - "11435213543", - "1(067)362-8910", - "1(167)362-8910", - "+2(267)362-8910", - "+3365520145", + '564785', + '0123456789', + '1437439210', + '+10345672645', + '11435213543', + '1(067)362-8910', + '1(167)362-8910', + '+2(267)362-8910', + '+3365520145', ], }, { - locale: "en-CA", - valid: ["19876543210", "8005552222", "+15673628910"], + locale: 'en-CA', + valid: ['19876543210', '8005552222', '+15673628910'], invalid: [ - "564785", - "0123456789", - "1437439210", - "+10345672645", - "11435213543", + '564785', + '0123456789', + '1437439210', + '+10345672645', + '11435213543', ], }, { - locale: "en-ZM", + locale: 'en-ZM', valid: [ - "0956684590", - "0966684590", - "0976684590", - "+260956684590", - "+260966684590", - "+260976684590", - "260976684590", + '0956684590', + '0966684590', + '0976684590', + '+260956684590', + '+260966684590', + '+260976684590', + '260976684590', ], invalid: [ - "12345", - "", - "Vml2YW11cyBmZXJtZtesting123", - "010-38238383", - "966684590", + '12345', + '', + 'Vml2YW11cyBmZXJtZtesting123', + '010-38238383', + '966684590', ], }, { - locale: ["en-ZW"], + locale: ['en-ZW'], valid: [ - "+263561890123", - "+263715558041", - "+263775551112", - "+263775551695", - "+263715556633", + '+263561890123', + '+263715558041', + '+263775551112', + '+263775551695', + '+263715556633', ], invalid: [ - "12345", - "", - "Vml2YW11cyBmZXJtZtesting123", - "+2631234567890", - "+2641234567", - "+263981234", - "4736338855", - "66338855", + '12345', + '', + 'Vml2YW11cyBmZXJtZtesting123', + '+2631234567890', + '+2641234567', + '+263981234', + '4736338855', + '66338855', ], }, { - locale: ["en-NA"], + locale: ['en-NA'], valid: [ - "+26466189012", - "+26461555804", - "+26461434221", - "+26487555169", - "+26481555663", + '+26466189012', + '+26461555804', + '+26461434221', + '+26487555169', + '+26481555663', ], invalid: [ - "12345", - "", - "Vml2YW11cyBmZXJtZtesting123", - "+2641234567890", - "+2641234567", - "+2648143422", - "+264981234", - "4736338855", - "66338855", + '12345', + '', + 'Vml2YW11cyBmZXJtZtesting123', + '+2641234567890', + '+2641234567', + '+2648143422', + '+264981234', + '4736338855', + '66338855', ], }, { - locale: "ru-RU", - valid: ["+79676338855", "79676338855", "89676338855", "9676338855"], + locale: 'ru-RU', + valid: ['+79676338855', '79676338855', '89676338855', '9676338855'], invalid: [ - "12345", - "", - "Vml2YW11cyBmZXJtZtesting123", - "010-38238383", - "+9676338855", - "19676338855", - "6676338855", - "+99676338855", + '12345', + '', + 'Vml2YW11cyBmZXJtZtesting123', + '010-38238383', + '+9676338855', + '19676338855', + '6676338855', + '+99676338855', ], }, { - locale: "si-LK", + locale: 'si-LK', valid: [ - "+94766661206", - "94713114340", - "0786642116", - "078 7642116", - "078-7642116", - "0749994567", + '+94766661206', + '94713114340', + '0786642116', + '078 7642116', + '078-7642116', + '0749994567', ], invalid: [ - "9912349956789", - "12345", - "1678123456", - "0731234567", - "0797878674", + '9912349956789', + '12345', + '1678123456', + '0731234567', + '0797878674', ], }, { - locale: "sr-RS", + locale: 'sr-RS', valid: [ - "0640133338", - "063333133", - "0668888878", - "+381645678912", - "+381611314000", - "0655885010", + '0640133338', + '063333133', + '0668888878', + '+381645678912', + '+381611314000', + '0655885010', ], invalid: [ - "12345", - "", - "Vml2YW11cyBmZXJtZtesting123", - "010-38238383", - "+9676338855", - "19676338855", - "6676338855", - "+99676338855", + '12345', + '', + 'Vml2YW11cyBmZXJtZtesting123', + '010-38238383', + '+9676338855', + '19676338855', + '6676338855', + '+99676338855', ], }, { - locale: "en-NZ", - valid: ["+6427987035", "642240512347", "0293981646", "029968425"], + locale: 'en-NZ', + valid: ['+6427987035', '642240512347', '0293981646', '029968425'], invalid: [ - "12345", - "", - "Vml2YW11cyBmZXJtZtesting123", - "+642956696123566", - "+02119620856", - "+9676338855", - "19676338855", - "6676338855", - "+99676338855", + '12345', + '', + 'Vml2YW11cyBmZXJtZtesting123', + '+642956696123566', + '+02119620856', + '+9676338855', + '19676338855', + '6676338855', + '+99676338855', ], }, { - locale: "en-MU", - valid: ["+23012341234", "12341234", "012341234"], + locale: 'en-MU', + valid: ['+23012341234', '12341234', '012341234'], invalid: [ - "41234", - "", - "+230", - "+2301", - "+23012", - "+230123", - "+2301234", - "+23012341", - "+230123412", - "+2301234123", - "+230123412341", - "+2301234123412", - "+23012341234123", + '41234', + '', + '+230', + '+2301', + '+23012', + '+230123', + '+2301234', + '+23012341', + '+230123412', + '+2301234123', + '+230123412341', + '+2301234123412', + '+23012341234123', ], }, { - locale: ["nb-NO", "nn-NO"], // for multiple locales + locale: ['nb-NO', 'nn-NO'], // for multiple locales valid: [ - "+4796338855", - "+4746338855", - "4796338855", - "4746338855", - "46338855", - "96338855", + '+4796338855', + '+4746338855', + '4796338855', + '4746338855', + '46338855', + '96338855', ], invalid: [ - "12345", - "", - "Vml2YW11cyBmZXJtZtesting123", - "+4676338855", - "19676338855", - "+4726338855", - "4736338855", - "66338855", + '12345', + '', + 'Vml2YW11cyBmZXJtZtesting123', + '+4676338855', + '19676338855', + '+4726338855', + '4736338855', + '66338855', ], }, { - locale: ["ne-NP"], + locale: ['ne-NP'], valid: [ - "+9779817385479", - "+9779717385478", - "+9779862002615", - "+9779853660020", + '+9779817385479', + '+9779717385478', + '+9779862002615', + '+9779853660020', ], invalid: [ - "12345", - "", - "Vml2YW11cyBmZXJtZtesting123", - "+97796123456789", - "+9771234567", - "+977981234", - "4736338855", - "66338855", + '12345', + '', + 'Vml2YW11cyBmZXJtZtesting123', + '+97796123456789', + '+9771234567', + '+977981234', + '4736338855', + '66338855', ], }, { - locale: "vi-VN", + locale: 'vi-VN', valid: [ - "0336012403", - "+84586012403", - "84981577798", - "0708001240", - "84813601243", - "0523803765", - "0863803732", - "0883805866", - "0892405867", - "+84888696413", - "0878123456", - "84781234567", - "0553803765", + '0336012403', + '+84586012403', + '84981577798', + '0708001240', + '84813601243', + '0523803765', + '0863803732', + '0883805866', + '0892405867', + '+84888696413', + '0878123456', + '84781234567', + '0553803765', ], invalid: [ - "12345", - "", - "Vml2YW11cyBmZXJtZtesting123", - "010-38238383", - "260976684590", - "01678912345", - "+841698765432", - "841626543219", - "0533803765", - "08712345678", - "+0321234567", + '12345', + '', + 'Vml2YW11cyBmZXJtZtesting123', + '010-38238383', + '260976684590', + '01678912345', + '+841698765432', + '841626543219', + '0533803765', + '08712345678', + '+0321234567', ], }, { - locale: "es-AR", + locale: 'es-AR', valid: [ - "5491143214321", - "+5491143214321", - "+5492414321432", - "5498418432143", + '5491143214321', + '+5491143214321', + '+5492414321432', + '5498418432143', ], invalid: [ - "1143214321", - "91143214321", - "+91143214321", - "549841004321432", - "549 11 43214321", - "549111543214321", - "5714003425432", - "549114a214321", - "54 9 11 4321-4321", + '1143214321', + '91143214321', + '+91143214321', + '549841004321432', + '549 11 43214321', + '549111543214321', + '5714003425432', + '549114a214321', + '54 9 11 4321-4321', ], }, { - locale: "es-CO", + locale: 'es-CO', valid: [ - "+573003321235", - "573003321235", - "3003321235", - "3213321235", - "3103321235", - "3243321235", - "573011140876", + '+573003321235', + '573003321235', + '3003321235', + '3213321235', + '3103321235', + '3243321235', + '573011140876', ], invalid: [ - "1234", - "+57443875615", - "57309875615", - "57109834567", - "5792434567", - "5702345689", - "5714003425432", - "5703013347567", - "069834567", - "969834567", - "579871235", - "574321235", - "5784321235", - "5784321235", - "9821235", - "0698345", - "3321235", - ], - }, - { - locale: "es-CL", - valid: ["+56733875615", "56928590234", "0928590294", "0208590294"], + '1234', + '+57443875615', + '57309875615', + '57109834567', + '5792434567', + '5702345689', + '5714003425432', + '5703013347567', + '069834567', + '969834567', + '579871235', + '574321235', + '5784321235', + '5784321235', + '9821235', + '0698345', + '3321235', + ], + }, + { + locale: 'es-CL', + valid: ['+56733875615', '56928590234', '0928590294', '0208590294'], invalid: [ - "1234", - "+5633875615", - "563875615", - "56109834567", - "56069834567", - ], - }, - { - locale: "es-EC", - valid: [ - "+593987654321", - "593987654321", - "0987654321", - "027332615", - "+59323456789", - ], - invalid: [ - "03321321", - "+593387561", - "59312345677", - "02344635", - "593123456789", - "081234567", - "+593912345678", - "+593902345678", - "+593287654321", - "593287654321", + '1234', + '+5633875615', + '563875615', + '56109834567', + '56069834567', + ], + }, + { + locale: 'es-EC', + valid: [ + '+593987654321', + '593987654321', + '0987654321', + '027332615', + '+59323456789', + ], + invalid: [ + '03321321', + '+593387561', + '59312345677', + '02344635', + '593123456789', + '081234567', + '+593912345678', + '+593902345678', + '+593287654321', + '593287654321', ], }, { - locale: "es-CR", + locale: 'es-CR', valid: [ - "+50688888888", - "+50665408090", - "+50640895069", - "25789563", - "85789563", + '+50688888888', + '+50665408090', + '+50640895069', + '25789563', + '85789563', ], invalid: [ - "+5081", - "+5067777777", - "+50188888888", - "+50e987643254", - "+506e4t4", - "-50688888888", - "50688888888", - "12345678", - "98765432", - "01234567", + '+5081', + '+5067777777', + '+50188888888', + '+50e987643254', + '+506e4t4', + '-50688888888', + '50688888888', + '12345678', + '98765432', + '01234567', ], }, { - locale: "es-CU", - valid: ["+5351234567", "005353216547", "51234567", "53214567"], - invalid: [ - "1234", - "+5341234567", - "0041234567", - "41234567", - "11234567", - "21234567", - "31234567", - "60303456", - "71234567", - "81234567", - "91234567", - "+5343216547", - "+5332165498", - "+53121234567", - "", - "abc", - "+535123457", - "56043029304", - ], - }, + locale: 'es-CU', + valid: ['+5351234567', '005353216547', '51234567', '53214567'], + invalid: [ + '1234', + '+5341234567', + '0041234567', + '41234567', + '11234567', + '21234567', + '31234567', + '60303456', + '71234567', + '81234567', + '91234567', + '+5343216547', + '+5332165498', + '+53121234567', + '', + 'abc', + '+535123457', + '56043029304', + ], + }, { - locale: "es-DO", - valid: [ - "+18096622563", - "+18295614488", - "+18495259567", - "8492283478", - "8092324576", - "8292387713", + locale: 'es-DO', + valid: [ + '+18096622563', + '+18295614488', + '+18495259567', + '8492283478', + '8092324576', + '8292387713', ], invalid: [ - "+18091", - "+1849777777", - "-18296643245", - "+18086643245", - "+18396643245", - "8196643245", - "+38492283478", - "6492283478", - "8192283478", + '+18091', + '+1849777777', + '-18296643245', + '+18086643245', + '+18396643245', + '8196643245', + '+38492283478', + '6492283478', + '8192283478', ], }, { - locale: "es-HN", + locale: 'es-HN', valid: [ - "+50495551876", - "+50488908787", - "+50493456789", - "+50489234567", - "+50488987896", - "+50497567389", - "+50427367389", - "+50422357389", - "+50431257389", - "+50430157389", + '+50495551876', + '+50488908787', + '+50493456789', + '+50489234567', + '+50488987896', + '+50497567389', + '+50427367389', + '+50422357389', + '+50431257389', + '+50430157389', ], invalid: [ - "12345", - "", - "Vml2YW11cyBmZXJtZtesting123", - "+34683456543", - "65478932", - "+50298787654", - "+504989874", - ], - }, - { - locale: "es-ES", - valid: [ - "+34654789321", - "654789321", - "+34714789321", - "714789321", - "+34744789321", - "744789321", - ], - invalid: [ - "12345", - "", - "Vml2YW11cyBmZXJtZtesting123", - "+3465478932", - "65478932", - "+346547893210", - "6547893210", - "+3470478932", - "7047893210", - "+34854789321", - "7547893219", - ], - }, - { - locale: "es-MX", - valid: [ - "+52019654789321", - "+52199654789321", - "+5201965478932", - "+5219654789321", - "52019654789321", - "52199654789321", - "5201965478932", - "5219654789321", - "87654789321", - "8654789321", - "0187654789321", - "18654789321", - ], - invalid: [ - "12345", - "", - "Vml2YW11cyBmZXJtZtesting123", - "+3465478932", - "65478932", - "+346547893210", - "+34704789321", - "704789321", - "+34754789321", + '12345', + '', + 'Vml2YW11cyBmZXJtZtesting123', + '+34683456543', + '65478932', + '+50298787654', + '+504989874', + ], + }, + { + locale: 'es-ES', + valid: [ + '+34654789321', + '654789321', + '+34714789321', + '714789321', + '+34744789321', + '744789321', + ], + invalid: [ + '12345', + '', + 'Vml2YW11cyBmZXJtZtesting123', + '+3465478932', + '65478932', + '+346547893210', + '6547893210', + '+3470478932', + '7047893210', + '+34854789321', + '7547893219', + ], + }, + { + locale: 'es-MX', + valid: [ + '+52019654789321', + '+52199654789321', + '+5201965478932', + '+5219654789321', + '52019654789321', + '52199654789321', + '5201965478932', + '5219654789321', + '87654789321', + '8654789321', + '0187654789321', + '18654789321', + ], + invalid: [ + '12345', + '', + 'Vml2YW11cyBmZXJtZtesting123', + '+3465478932', + '65478932', + '+346547893210', + '+34704789321', + '704789321', + '+34754789321', ], }, { - locale: "es-NI", + locale: 'es-NI', valid: [ - "+5051234567", - "+50512345678", - "5051234567", - "50512345678", - "+50555555555", + '+5051234567', + '+50512345678', + '5051234567', + '50512345678', + '+50555555555', ], invalid: [ - "1234", - "", - "1234567", - "12345678", - "+12345678", - "+505123456789", - "+50612345678", - "+50712345678", - "-50512345678", + '1234', + '', + '1234567', + '12345678', + '+12345678', + '+505123456789', + '+50612345678', + '+50712345678', + '-50512345678', ], }, { - locale: "es-PA", - valid: ["+5076784565", "+5074321557", "5073331112", "+50723431212"], + locale: 'es-PA', + valid: ['+5076784565', '+5074321557', '5073331112', '+50723431212'], invalid: [ - "+50755555", - "+207123456", - "2001236542", - "+507987643254", - "+507jjjghtf", + '+50755555', + '+207123456', + '2001236542', + '+507987643254', + '+507jjjghtf', ], }, { - locale: "es-PY", + locale: 'es-PY', valid: [ - "+595991372649", - "+595992847352", - "+595993847593", - "+595994857473", - "+595995348532", - "+595996435231", - "+595981847362", - "+595982435452", - "+595983948502", - "+595984342351", - "+595985403481", - "+595986384012", - "+595971435231", - "+595972103924", - "+595973438542", - "+595974425864", - "+595975425843", - "+595976342546", - "+595961435234", - "+595963425043", + '+595991372649', + '+595992847352', + '+595993847593', + '+595994857473', + '+595995348532', + '+595996435231', + '+595981847362', + '+595982435452', + '+595983948502', + '+595984342351', + '+595985403481', + '+595986384012', + '+595971435231', + '+595972103924', + '+595973438542', + '+595974425864', + '+595975425843', + '+595976342546', + '+595961435234', + '+595963425043', ], invalid: [ - "12345", - "", - "Vml2YW11cyBmZXJtZtesting123", - "65478932", - "+59599384712", - "+5959938471234", - "+595547893218", - "+591993546843", + '12345', + '', + 'Vml2YW11cyBmZXJtZtesting123', + '65478932', + '+59599384712', + '+5959938471234', + '+595547893218', + '+591993546843', ], }, { - locale: "es-SV", + locale: 'es-SV', valid: [ - "62136634", - "50361366631", - "+50361366634", - "+50361367217", - "+50361367460", - "+50371367632", - "+50371367767", - "+50371368314", - ], - invalid: [ - "+5032136663", - "21346663", - "+50321366663", - "12345", - "El salvador", - "this should fail", - "+5032222", - "+503 1111 1111", - "00 +503 1234 5678", + '62136634', + '50361366631', + '+50361366634', + '+50361367217', + '+50361367460', + '+50371367632', + '+50371367767', + '+50371368314', + ], + invalid: [ + '+5032136663', + '21346663', + '+50321366663', + '12345', + 'El salvador', + 'this should fail', + '+5032222', + '+503 1111 1111', + '00 +503 1234 5678', ], }, { - locale: "es-UY", - valid: ["+59899123456", "099123456", "+59894654321", "091111111"], + locale: 'es-UY', + valid: ['+59899123456', '099123456', '+59894654321', '091111111'], invalid: [ - "54321", - "montevideo", - "", - "+598099123456", - "090883338", - "099 999 999", - ], - }, - { - locale: "es-VE", - valid: ["+582125457765", "+582125458053", "+584125458053"], - invalid: ["+585129934395", "+58212993439", ""], - }, - { - locale: "et-EE", - valid: [ - "+372 512 34 567", - "372 512 34 567", - "+37251234567", - "51234567", - "81234567", - "+372842345678", + '54321', + 'montevideo', + '', + '+598099123456', + '090883338', + '099 999 999', + ], + }, + { + locale: 'es-VE', + valid: ['+582125457765', '+582125458053', '+584125458053'], + invalid: ['+585129934395', '+58212993439', ''], + }, + { + locale: 'et-EE', + valid: [ + '+372 512 34 567', + '372 512 34 567', + '+37251234567', + '51234567', + '81234567', + '+372842345678', ], invalid: [ - "12345", - "", - "NotANumber", - "+333 51234567", - "61234567", - "+51234567", - "+372 539 57 4", - "+372 900 1234", - "12345678", - ], - }, - { - locale: "pl-PL", - valid: [ - "+48512689767", - "+48 56 376 87 47", - "56 566 78 46", - "657562855", - "+48657562855", - "+48 887472765", - "+48 56 6572724", - "+48 67 621 5461", - "48 67 621 5461", - "+48 45 621 5461", - ], - invalid: [ - "+48 67 621 5461", - "+55657562855", - "3454535", - "teststring", - "", - "1800-88-8687", - "+6019-5830837", - "357562855", - "+48 44 621 5461", + '12345', + '', + 'NotANumber', + '+333 51234567', + '61234567', + '+51234567', + '+372 539 57 4', + '+372 900 1234', + '12345678', + ], + }, + { + locale: 'pl-PL', + valid: [ + '+48512689767', + '+48 56 376 87 47', + '56 566 78 46', + '657562855', + '+48657562855', + '+48 887472765', + '+48 56 6572724', + '+48 67 621 5461', + '48 67 621 5461', + '+48 45 621 5461', + ], + invalid: [ + '+48 67 621 5461', + '+55657562855', + '3454535', + 'teststring', + '', + '1800-88-8687', + '+6019-5830837', + '357562855', + '+48 44 621 5461', ], }, - { - locale: "fa-IR", - valid: [ - "+989123456789", - "989223456789", - "09323456789", - "09021456789", - "+98-990-345-6789", - "+98 938 345 6789", - "0938 345 6789", + { + locale: 'fa-IR', + valid: [ + '+989123456789', + '989223456789', + '09323456789', + '09021456789', + '+98-990-345-6789', + '+98 938 345 6789', + '0938 345 6789', ], invalid: [ - "", - "+989623456789", - "+981123456789", - "01234567890", - "09423456789", - "09823456789", - "9123456789", - "091234567890", - "0912345678", - "+98 912 3456 6789", - "0912 345 678", + '', + '+989623456789', + '+981123456789', + '01234567890', + '09423456789', + '09823456789', + '9123456789', + '091234567890', + '0912345678', + '+98 912 3456 6789', + '0912 345 678', ], }, { - locale: "fi-FI", + locale: 'fi-FI', valid: [ - "+358505557171", - "0455571", - "0505557171", - "358505557171", - "04412345", - "0457 123 45 67", - "+358457 123 45 67", - "+358 50 555 7171", - "0501234", - "+358501234", - "050 1234", - ], - invalid: [ - "12345", - "", - "045557", - "045555717112312332423423421", - "Vml2YW11cyBmZXJtZtesting123", - "010-38238383", - "+3-585-0555-7171", - "+9676338855", - "19676338855", - "6676338855", - "+99676338855", - "044123", - "019123456789012345678901", - ], - }, - { - locale: "fj-FJ", - valid: [ - "+6799898679", - "6793788679", - "+679 989 8679", - "679 989 8679", - "679 3456799", - "679908 8909", + '+358505557171', + '0455571', + '0505557171', + '358505557171', + '04412345', + '0457 123 45 67', + '+358457 123 45 67', + '+358 50 555 7171', + '0501234', + '+358501234', + '050 1234', + ], + invalid: [ + '12345', + '', + '045557', + '045555717112312332423423421', + 'Vml2YW11cyBmZXJtZtesting123', + '010-38238383', + '+3-585-0555-7171', + '+9676338855', + '19676338855', + '6676338855', + '+99676338855', + '044123', + '019123456789012345678901', + ], + }, + { + locale: 'fj-FJ', + valid: [ + '+6799898679', + '6793788679', + '+679 989 8679', + '679 989 8679', + '679 3456799', + '679908 8909', ], invalid: [ - "12345", - "", - "04555792", - "902w99900030900000000099", - "8uiuiuhhyy&GUU88d", - "010-38238383", - "19676338855", - "679 9 89 8679", - "6793 45679", - ], - }, - { - locale: "ms-MY", - valid: [ - "+60128228789", - "+60195830837", - "+6019-5830837", - "+6019-5830837", - "+6010-4357675", - "+60172012370", - "0128737867", - "0172012370", - "01468987837", - "01112347345", - "016-2838768", - "016 2838768", - ], - invalid: [ - "12345", - "601238788657", - "088387675", - "16-2838768", - "032551433", - "6088-387888", - "088-261987", - "1800-88-8687", - "088-320000", - "+01112353576", - "+0111419752", - ], - }, - { - locale: "fr-CM", - valid: [ - "+237677936141", - "237623456789", - "+237698124842", - "237693029202", - ], - invalid: [ - "NotANumber", - "+(703)-572-2920", - "+237 623 45 67 890", - "+2379981247429", + '12345', + '', + '04555792', + '902w99900030900000000099', + '8uiuiuhhyy&GUU88d', + '010-38238383', + '19676338855', + '679 9 89 8679', + '6793 45679', + ], + }, + { + locale: 'ms-MY', + valid: [ + '+60128228789', + '+60195830837', + '+6019-5830837', + '+6019-5830837', + '+6010-4357675', + '+60172012370', + '0128737867', + '0172012370', + '01468987837', + '01112347345', + '016-2838768', + '016 2838768', + ], + invalid: [ + '12345', + '601238788657', + '088387675', + '16-2838768', + '032551433', + '6088-387888', + '088-261987', + '1800-88-8687', + '088-320000', + '+01112353576', + '+0111419752', + ], + }, + { + locale: 'fr-CM', + valid: [ + '+237677936141', + '237623456789', + '+237698124842', + '237693029202', + ], + invalid: [ + 'NotANumber', + '+(703)-572-2920', + '+237 623 45 67 890', + '+2379981247429', ], }, { - locale: "ko-KR", + locale: 'ko-KR', valid: [ - "+82-010-1234-5678", - "+82-10-1234-5678", - "82-010-1234-5678", - "82-10-1234-5678", - "+82 10 1234 5678", - "010-123-5678", - "10-1234-5678", - "+82 10 1234 5678", - "011 1234 5678", - "+820112345678", - "01012345678", - "+82 016 1234 5678", - "82 19 1234 5678", - "+82 010 12345678", - ], - invalid: [ - "abcdefghi", - "+82 10 1234 567", - "+82 10o 1234 1234", - "+82 101 1234 5678", - "+82 10 12 5678", - "+011 7766 1234", - "011_7766_1234", - "+820 11 7766 1234", + '+82-010-1234-5678', + '+82-10-1234-5678', + '82-010-1234-5678', + '82-10-1234-5678', + '+82 10 1234 5678', + '010-123-5678', + '10-1234-5678', + '+82 10 1234 5678', + '011 1234 5678', + '+820112345678', + '01012345678', + '+82 016 1234 5678', + '82 19 1234 5678', + '+82 010 12345678', + ], + invalid: [ + 'abcdefghi', + '+82 10 1234 567', + '+82 10o 1234 1234', + '+82 101 1234 5678', + '+82 10 12 5678', + '+011 7766 1234', + '011_7766_1234', + '+820 11 7766 1234', ], }, { - locale: "ky-KG", + locale: 'ky-KG', valid: [ - "+7 727 123 4567", - "+7 714 2396102", - "77271234567", - "0271234567", + '+7 727 123 4567', + '+7 714 2396102', + '77271234567', + '0271234567', ], - invalid: ["02188565377", "09386932778", "0938693277vadggjdsaasdgj8"], + invalid: ['02188565377', '09386932778', '0938693277vadggjdsaasdgj8'], }, { - locale: "ja-JP", + locale: 'ja-JP', valid: [ - "09012345678", - "08012345678", - "07012345678", - "06012345678", - "090 1234 5678", - "+8190-1234-5678", - "+81 (0)90-1234-5678", - "+819012345678", - "+81-(0)90-1234-5678", - "+81 90 1234 5678", + '09012345678', + '08012345678', + '07012345678', + '06012345678', + '090 1234 5678', + '+8190-1234-5678', + '+81 (0)90-1234-5678', + '+819012345678', + '+81-(0)90-1234-5678', + '+81 90 1234 5678', ], invalid: [ - "12345", - "", - "045555717112312332423423421", - "Vml2YW11cyBmZXJtZtesting123", - "+3-585-0555-7171", - "0 1234 5689", - "16 1234 5689", - "03_1234_5689", - "0312345678", - "0721234567", - "06 1234 5678", - "072 123 4567", - "0729 12 3456", - "07296 1 2345", - "072961 2345", - "03-1234-5678", - "+81312345678", - "+816-1234-5678", - "+81 090 1234 5678", - "+8109012345678", - "+81-090-1234-5678", - "90 1234 5678", - ], + '12345', + '', + '045555717112312332423423421', + 'Vml2YW11cyBmZXJtZtesting123', + '+3-585-0555-7171', + '0 1234 5689', + '16 1234 5689', + '03_1234_5689', + '0312345678', + '0721234567', + '06 1234 5678', + '072 123 4567', + '0729 12 3456', + '07296 1 2345', + '072961 2345', + '03-1234-5678', + '+81312345678', + '+816-1234-5678', + '+81 090 1234 5678', + '+8109012345678', + '+81-090-1234-5678', + '90 1234 5678', + ], }, { - locale: "ir-IR", - valid: ["09023818688", "09123809999", "+989023818688", "+989103923523"], + locale: 'ir-IR', + valid: ['09023818688', '09123809999', '+989023818688', '+989103923523'], invalid: [ - "19023818688", - "323254", - "+903232323257", - "++3567868", - "0902381888832", - ], - }, - { - locale: "it-IT", + '19023818688', + '323254', + '+903232323257', + '++3567868', + '0902381888832', + ], + }, + { + locale: 'it-IT', valid: [ - "370 3175423", - "333202925", - "+39 310 7688449", - "+39 3339847632", - ], - invalid: ["011 7387545", "12345", "+45 345 6782395"], - }, - { - locale: "fr-BE", - valid: [ - "0470123456", - "+32470123456", - "32470123456", - "0421234567", - "+32421234567", - "32421234567", - ], - invalid: [ - "12345", - "+3212345", - "3212345", - "04701234567", - "+3204701234567", - "3204701234567", - "0212345678", - "+320212345678", - "320212345678", - "021234567", - "+3221234567", - "3221234567", - ], - }, - { - locale: "nl-BE", - valid: [ - "0470123456", - "+32470123456", - "32470123456", - "0421234567", - "+32421234567", - "32421234567", - ], - invalid: [ - "12345", - "+3212345", - "3212345", - "04701234567", - "+3204701234567", - "3204701234567", - "0212345678", - "+320212345678", - "320212345678", - "021234567", - "+3221234567", - "3221234567", - ], - }, - { - locale: "nl-NL", - valid: [ - "0670123456", - "0612345678", - "31612345678", - "31670123456", - "+31612345678", - "+31670123456", - "+31(0)612345678", - "0031612345678", - "0031(0)612345678", - ], - invalid: [ - "12345", - "+3112345", - "3112345", - "06701234567", - "012345678", - "+3104701234567", - "3104701234567", - "0212345678", - "021234567", - "+3121234567", - "3121234567", - "+310212345678", - "310212345678", - ], - }, - { - locale: "nl-AW", - valid: [ - "2975612345", - "2976412345", - "+2975612345", - "+2975912345", - "+2976412345", - "+2977312345", - "+2977412345", - "+2979912345", - ], - invalid: [ - "12345", - "+2972345", - "2972345", - "06701234567", - "012345678", - "+2974701234567", - "2974701234567", - "0297345678", - "029734567", - "+2971234567", - "2971234567", - "+297212345678", - "297212345678", - "number", - ], - }, - { - locale: "ro-MD", - valid: [ - "+37360375781", - "+37361945673", - "+37362387563", - "+37368447788", - "+37369000101", - "+37367568910", - "+37376758294", - "+37378457892", - "+37379067436", - "37362387563", - "37368447788", - "37369000101", - "37367568910", - ], - invalid: [ - "", - "+37363373381", - "+37364310581", - "+37365578199", - "+37371088636", - "Vml2YW11cyBmZXJtZtesting123", - "123456", - "740123456", - "+40640123456", - "+40210123456", - ], - }, - { - locale: "ro-RO", - valid: [ - "+40740123456", - "+40 740123456", - "+40740 123 456", - "+40740.123.456", - "+40740-123-456", - "40740123456", - "40 740123456", - "40740 123 456", - "40740.123.456", - "40740-123-456", - "0740123456", - "0740/123456", - "0740 123 456", - "0740.123.456", - "0740-123-456", - ], - invalid: [ - "", - "Vml2YW11cyBmZXJtZtesting123", - "123456", - "740123456", - "+40640123456", - "+40210123456", - "+0765351689", - "+0711419752", - ], - }, - { - locale: "id-ID", - valid: [ - "0811 778 998", - "0811 7785 9983", - "0812 7784 9984", - "0813 7782 9982", - "0821 1234 1234", - "0822 1234 1234", - "0823 1234 1234", - "0852 1234 6764", - "0853 1234 6764", - "0851 1234 6764", - "0814 7782 9982", - "0815 7782 9982", - "0816 7782 9982", - "0855 7782 9982", - "0856 7782 9982", - "0857 7782 9982", - "0858 7782 9982", - "0817 7785 9983", - "0818 7784 9984", - "0819 7782 9982", - "0859 1234 1234", - "0877 1234 1234", - "0878 1234 1234", - "0895 7785 9983", - "0896 7784 9984", - "0897 7782 9982", - "0898 1234 1234", - "0899 1234 1234", - "0881 7785 9983", - "0882 7784 9984", - "0883 7782 9982", - "0884 1234 1234", - "0886 1234 1234", - "0887 1234 1234", - "0888 7785 9983", - "0889 7784 9984", - "0828 7784 9984", - "0838 7784 9984", - "0831 7784 9984", - "0832 7784 9984", - "0833 7784 9984", - "089931236181900", - "62811 778 998", - "62811778998", - "628993123618190", - "62898 740123456", - "62899 7401 2346", - "+62811 778 998", - "+62811778998", - "+62812 9650 3508", - "08197231819", - "085361008008", - "+62811787391", - ], - invalid: [ - "0899312361819001", - "0217123456", - "622178878890", - "6221 740123456", - "0341 8123456", - "0778 89800910", - "0741 123456", - "+6221740123456", - "+65740 123 456", - "", - "ASDFGJKLmZXJtZtesting123", - "123456", - "740123456", - "+65640123456", - "+64210123456", - ], - }, - { - locale: "lt-LT", - valid: ["+37051234567", "851234567"], - invalid: [ - "+65740 123 456", - "", - "ASDFGJKLmZXJtZtesting123", - "123456", - "740123456", - "+65640123456", - "+64210123456", - ], - }, - { - locale: "uk-UA", - valid: ["+380982345679", "380982345679", "80982345679", "0982345679"], - invalid: [ - "+30982345679", - "982345679", - "+380 98 234 5679", - "+380-98-234-5679", - "", - "ASDFGJKLmZXJtZtesting123", - "123456", - "740123456", - ], - }, - { - locale: "uz-UZ", - valid: [ - "+998664835244", - "998664835244", - "664835244", - "+998957124555", - "998957124555", - "957124555", - ], - invalid: [ - "+998644835244", - "998644835244", - "644835244", - "+99664835244", - "ASDFGJKLmZXJtZtesting123", - "123456789", - "870123456", - "", - "+998", - "998", - ], + '370 3175423', + '333202925', + '+39 310 7688449', + '+39 3339847632', + ], + invalid: ['011 7387545', '12345', '+45 345 6782395'], + }, + { + locale: 'fr-BE', + valid: [ + '0470123456', + '+32470123456', + '32470123456', + '0421234567', + '+32421234567', + '32421234567', + ], + invalid: [ + '12345', + '+3212345', + '3212345', + '04701234567', + '+3204701234567', + '3204701234567', + '0212345678', + '+320212345678', + '320212345678', + '021234567', + '+3221234567', + '3221234567', + ], + }, + { + locale: 'nl-BE', + valid: [ + '0470123456', + '+32470123456', + '32470123456', + '0421234567', + '+32421234567', + '32421234567', + ], + invalid: [ + '12345', + '+3212345', + '3212345', + '04701234567', + '+3204701234567', + '3204701234567', + '0212345678', + '+320212345678', + '320212345678', + '021234567', + '+3221234567', + '3221234567', + ], + }, + { + locale: 'nl-NL', + valid: [ + '0670123456', + '0612345678', + '31612345678', + '31670123456', + '+31612345678', + '+31670123456', + '+31(0)612345678', + '0031612345678', + '0031(0)612345678', + ], + invalid: [ + '12345', + '+3112345', + '3112345', + '06701234567', + '012345678', + '+3104701234567', + '3104701234567', + '0212345678', + '021234567', + '+3121234567', + '3121234567', + '+310212345678', + '310212345678', + ], + }, + { + locale: 'nl-AW', + valid: [ + '2975612345', + '2976412345', + '+2975612345', + '+2975912345', + '+2976412345', + '+2977312345', + '+2977412345', + '+2979912345', + ], + invalid: [ + '12345', + '+2972345', + '2972345', + '06701234567', + '012345678', + '+2974701234567', + '2974701234567', + '0297345678', + '029734567', + '+2971234567', + '2971234567', + '+297212345678', + '297212345678', + 'number', + ], + }, + { + locale: 'ro-MD', + valid: [ + '+37360375781', + '+37361945673', + '+37362387563', + '+37368447788', + '+37369000101', + '+37367568910', + '+37376758294', + '+37378457892', + '+37379067436', + '37362387563', + '37368447788', + '37369000101', + '37367568910', + ], + invalid: [ + '', + '+37363373381', + '+37364310581', + '+37365578199', + '+37371088636', + 'Vml2YW11cyBmZXJtZtesting123', + '123456', + '740123456', + '+40640123456', + '+40210123456', + ], + }, + { + locale: 'ro-RO', + valid: [ + '+40740123456', + '+40 740123456', + '+40740 123 456', + '+40740.123.456', + '+40740-123-456', + '40740123456', + '40 740123456', + '40740 123 456', + '40740.123.456', + '40740-123-456', + '0740123456', + '0740/123456', + '0740 123 456', + '0740.123.456', + '0740-123-456', + ], + invalid: [ + '', + 'Vml2YW11cyBmZXJtZtesting123', + '123456', + '740123456', + '+40640123456', + '+40210123456', + '+0765351689', + '+0711419752', + ], + }, + { + locale: 'id-ID', + valid: [ + '0811 778 998', + '0811 7785 9983', + '0812 7784 9984', + '0813 7782 9982', + '0821 1234 1234', + '0822 1234 1234', + '0823 1234 1234', + '0852 1234 6764', + '0853 1234 6764', + '0851 1234 6764', + '0814 7782 9982', + '0815 7782 9982', + '0816 7782 9982', + '0855 7782 9982', + '0856 7782 9982', + '0857 7782 9982', + '0858 7782 9982', + '0817 7785 9983', + '0818 7784 9984', + '0819 7782 9982', + '0859 1234 1234', + '0877 1234 1234', + '0878 1234 1234', + '0895 7785 9983', + '0896 7784 9984', + '0897 7782 9982', + '0898 1234 1234', + '0899 1234 1234', + '0881 7785 9983', + '0882 7784 9984', + '0883 7782 9982', + '0884 1234 1234', + '0886 1234 1234', + '0887 1234 1234', + '0888 7785 9983', + '0889 7784 9984', + '0828 7784 9984', + '0838 7784 9984', + '0831 7784 9984', + '0832 7784 9984', + '0833 7784 9984', + '089931236181900', + '62811 778 998', + '62811778998', + '628993123618190', + '62898 740123456', + '62899 7401 2346', + '+62811 778 998', + '+62811778998', + '+62812 9650 3508', + '08197231819', + '085361008008', + '+62811787391', + ], + invalid: [ + '0899312361819001', + '0217123456', + '622178878890', + '6221 740123456', + '0341 8123456', + '0778 89800910', + '0741 123456', + '+6221740123456', + '+65740 123 456', + '', + 'ASDFGJKLmZXJtZtesting123', + '123456', + '740123456', + '+65640123456', + '+64210123456', + ], + }, + { + locale: 'lt-LT', + valid: ['+37051234567', '851234567'], + invalid: [ + '+65740 123 456', + '', + 'ASDFGJKLmZXJtZtesting123', + '123456', + '740123456', + '+65640123456', + '+64210123456', + ], + }, + { + locale: 'uk-UA', + valid: ['+380982345679', '380982345679', '80982345679', '0982345679'], + invalid: [ + '+30982345679', + '982345679', + '+380 98 234 5679', + '+380-98-234-5679', + '', + 'ASDFGJKLmZXJtZtesting123', + '123456', + '740123456', + ], + }, + { + locale: 'uz-UZ', + valid: [ + '+998664835244', + '998664835244', + '664835244', + '+998957124555', + '998957124555', + '957124555', + ], + invalid: [ + '+998644835244', + '998644835244', + '644835244', + '+99664835244', + 'ASDFGJKLmZXJtZtesting123', + '123456789', + '870123456', + '', + '+998', + '998', + ], }, { - locale: "da-DK", + locale: 'da-DK', valid: [ - "12345678", - "12 34 56 78", - "45 12345678", - "4512345678", - "45 12 34 56 78", - "+45 12 34 56 78", + '12345678', + '12 34 56 78', + '45 12345678', + '4512345678', + '45 12 34 56 78', + '+45 12 34 56 78', ], invalid: [ - "", - "+45010203", - "ASDFGJKLmZXJtZtesting123", - "123456", - "12 34 56", - "123 123 12", + '', + '+45010203', + 'ASDFGJKLmZXJtZtesting123', + '123456', + '12 34 56', + '123 123 12', ], }, { - locale: "sv-SE", + locale: 'sv-SE', valid: [ - "+46701234567", - "46701234567", - "0721234567", - "073-1234567", - "0761-234567", - "079-123 45 67", + '+46701234567', + '46701234567', + '0721234567', + '073-1234567', + '0761-234567', + '079-123 45 67', ], invalid: [ - "12345", - "+4670123456", - "+46301234567", - "+0731234567", - "0731234 56", - "+7312345678", - "", + '12345', + '+4670123456', + '+46301234567', + '+0731234567', + '0731234 56', + '+7312345678', + '', ], }, { - locale: "fo-FO", + locale: 'fo-FO', valid: [ - "123456", - "12 34 56", - "298 123456", - "298123456", - "298 12 34 56", - "+298 12 34 56", + '123456', + '12 34 56', + '298 123456', + '298123456', + '298 12 34 56', + '+298 12 34 56', ], invalid: [ - "", - "+4501020304", - "ASDFGJKLmZXJtZtesting123", - "12345678", - "12 34 56 78", + '', + '+4501020304', + 'ASDFGJKLmZXJtZtesting123', + '12345678', + '12 34 56 78', ], }, { - locale: "kl-GL", + locale: 'kl-GL', valid: [ - "123456", - "12 34 56", - "299 123456", - "299123456", - "299 12 34 56", - "+299 12 34 56", + '123456', + '12 34 56', + '299 123456', + '299123456', + '299 12 34 56', + '+299 12 34 56', ], invalid: [ - "", - "+4501020304", - "ASDFGJKLmZXJtZtesting123", - "12345678", - "12 34 56 78", + '', + '+4501020304', + 'ASDFGJKLmZXJtZtesting123', + '12345678', + '12 34 56 78', ], }, { - locale: "kk-KZ", - valid: ["+77254716212", "77254716212", "87254716212", "7254716212"], + locale: 'kk-KZ', + valid: ['+77254716212', '77254716212', '87254716212', '7254716212'], invalid: [ - "12345", - "", - "ASDFGJKLmZXJtZtesting123", - "010-38238383", - "+9676338855", - "19676338855", - "6676338855", - "+99676338855", + '12345', + '', + 'ASDFGJKLmZXJtZtesting123', + '010-38238383', + '+9676338855', + '19676338855', + '6676338855', + '+99676338855', ], }, { - locale: "be-BY", + locale: 'be-BY', valid: [ - "+375241234567", - "+375251234567", - "+375291234567", - "+375331234567", - "+375441234567", - "375331234567", + '+375241234567', + '+375251234567', + '+375291234567', + '+375331234567', + '+375441234567', + '375331234567', ], invalid: [ - "12345", - "", - "ASDFGJKLmZXJtZtesting123", - "010-38238383", - "+9676338855", - "19676338855", - "6676338855", - "+99676338855", + '12345', + '', + 'ASDFGJKLmZXJtZtesting123', + '010-38238383', + '+9676338855', + '19676338855', + '6676338855', + '+99676338855', ], }, { - locale: "th-TH", - valid: ["0912345678", "+66912345678", "66912345678"], - invalid: ["99123456789", "12345", "67812345623", "081234567891"], + locale: 'th-TH', + valid: ['0912345678', '+66912345678', '66912345678'], + invalid: ['99123456789', '12345', '67812345623', '081234567891'], }, { - locale: "tk-TM", + locale: 'tk-TM', valid: [ - "+99312495154", - "99312130136", - "+99312918407", - "99312183399", - "812391717", + '+99312495154', + '99312130136', + '+99312918407', + '99312183399', + '812391717', ], - invalid: ["12345", "+99412495154", "99412495154", "998900066506"], + invalid: ['12345', '+99412495154', '99412495154', '998900066506'], }, { - locale: "en-SL", - valid: ["+23274560591", "23274560591", "074560591"], + locale: 'en-SL', + valid: ['+23274560591', '23274560591', '074560591'], invalid: [ - "0745605912", - "12345", - "232745605917", - "0797878674", - "23274560591 ", + '0745605912', + '12345', + '232745605917', + '0797878674', + '23274560591 ', ], }, { - locale: "en-BW", + locale: 'en-BW', valid: [ - "+26772868545", - "+26776368790", - "+26774560512", - "26774560591", - "26778560512", - "74560512", - "76710284", + '+26772868545', + '+26776368790', + '+26774560512', + '26774560591', + '26778560512', + '74560512', + '76710284', ], invalid: [ - "0799375902", - "12345", - "+2670745605448", - "2670745605482", - "+26779685451", - "+26770685451", - "267074560", - "2670ab5608", - "+267074560", - "70560512", - "79710284", + '0799375902', + '12345', + '+2670745605448', + '2670745605482', + '+26779685451', + '+26770685451', + '267074560', + '2670ab5608', + '+267074560', + '70560512', + '79710284', ], }, { - locale: "az-AZ", + locale: 'az-AZ', valid: [ - "+994707007070", - "0707007070", - "+994502111111", - "0505436743", - "0554328772", - "0104328772", - "0993301022", - "+994776007139", - "+994106007139", + '+994707007070', + '0707007070', + '+994502111111', + '0505436743', + '0554328772', + '0104328772', + '0993301022', + '+994776007139', + '+994106007139', ], invalid: [ - "wrong-number", - "", - "994707007070", - "++9945005050", - "556007070", - "1234566", - "+994778008080a", + 'wrong-number', + '', + '994707007070', + '++9945005050', + '556007070', + '1234566', + '+994778008080a', ], }, { - locale: "de-LU", - valid: ["601123456", "+352601123456"], + locale: 'de-LU', + valid: ['601123456', '+352601123456'], invalid: [ - "NaN", - "791234", - "+352791234", - "26791234", - "+35226791234", - "+112039812", - "+352703123456", - "1234", + 'NaN', + '791234', + '+352791234', + '26791234', + '+35226791234', + '+112039812', + '+352703123456', + '1234', ], }, { - locale: "it-SM", + locale: 'it-SM', valid: [ - "612345", - "05496123456", - "+37861234567", - "+390549612345678", - "+37805496123456789", + '612345', + '05496123456', + '+37861234567', + '+390549612345678', + '+37805496123456789', ], - invalid: ["61234567890", "6123", "1234567", "+49123456", "NotANumber"], + invalid: ['61234567890', '6123', '1234567', '+49123456', 'NotANumber'], }, { - locale: "so-SO", + locale: 'so-SO', valid: [ - "+252601234567", - "+252650101010", - "+252794567120", - "252650647388", - "252751234567", - "0601234567", - "0609876543", + '+252601234567', + '+252650101010', + '+252794567120', + '252650647388', + '252751234567', + '0601234567', + '0609876543', ], invalid: [ - "", - "not a number", - "+2526012345678", - "25260123456", - "+252705555555", - "+0601234567", - "06945454545", + '', + 'not a number', + '+2526012345678', + '25260123456', + '+252705555555', + '+0601234567', + '06945454545', ], }, { - locale: "sq-AL", - valid: ["067123456", "+35567123456"], + locale: 'sq-AL', + valid: ['067123456', '+35567123456'], invalid: [ - "67123456", - "06712345", - "06712345678", - "065123456", - "057123456", - "NotANumber", + '67123456', + '06712345', + '06712345678', + '065123456', + '057123456', + 'NotANumber', ], }, { - locale: "ca-AD", - valid: ["+376312345", "312345"], - invalid: ["31234", "31234567", "512345", "NotANumber"], + locale: 'ca-AD', + valid: ['+376312345', '312345'], + invalid: ['31234', '31234567', '512345', 'NotANumber'], }, { - locale: "pt-AO", - valid: ["+244911123432", "+244123091232"], + locale: 'pt-AO', + valid: ['+244911123432', '+244123091232'], invalid: [ - "+2449111234321", - "31234", - "31234567", - "512345", - "NotANumber", + '+2449111234321', + '31234', + '31234567', + '512345', + 'NotANumber', ], }, { - locale: "lv-LV", - valid: ["+37121234567", "37121234567"], + locale: 'lv-LV', + valid: ['+37121234567', '37121234567'], invalid: [ - "+37201234567", - "+3754321", - "3712123456", - "+371212345678", - "NotANumber", + '+37201234567', + '+3754321', + '3712123456', + '+371212345678', + 'NotANumber', ], }, { - locale: "mg-MG", + locale: 'mg-MG', valid: [ - "+261204269174", - "261204269174", - "0204269174", - "0209269174", - "0374269174", - "4269174", + '+261204269174', + '261204269174', + '0204269174', + '0209269174', + '0374269174', + '4269174', ], invalid: [ - "0261204269174", - "+261 20 4 269174", - "+261 20 4269174", - "020 4269174", - "204269174", - "0404269174", - "NotANumber", + '0261204269174', + '+261 20 4 269174', + '+261 20 4269174', + '020 4269174', + '204269174', + '0404269174', + 'NotANumber', ], }, { - locale: "mn-MN", + locale: 'mn-MN', valid: [ - "+97699112222", - "97696112222", - "97695112222", - "01197691112222", - "0097688112222", - "+97677112222", - "+97694112222", - "+97681112222", + '+97699112222', + '97696112222', + '97695112222', + '01197691112222', + '0097688112222', + '+97677112222', + '+97694112222', + '+97681112222', ], invalid: [ - "+97888112222", - "+97977112222", - "+97094112222", - "+97281112222", - "02297681112222", + '+97888112222', + '+97977112222', + '+97094112222', + '+97281112222', + '02297681112222', ], }, { - locale: "my-MM", + locale: 'my-MM', valid: [ - "+959750202595", - "09750202595", - "9750202595", - "+959260000966", - "09256000323", - "09276000323", - "09426000323", - "09456000323", - "09761234567", - "09791234567", - "09961234567", - "09771234567", - "09660000234", + '+959750202595', + '09750202595', + '9750202595', + '+959260000966', + '09256000323', + '09276000323', + '09426000323', + '09456000323', + '09761234567', + '09791234567', + '09961234567', + '09771234567', + '09660000234', ], invalid: [ - "59750202595", - "+9597502025", - "08943234524", - "09950000966", - "959240000966", - "09246000323", - "09466000323", - "09951234567", - "09801234567", - "09650000234", + '59750202595', + '+9597502025', + '08943234524', + '09950000966', + '959240000966', + '09246000323', + '09466000323', + '09951234567', + '09801234567', + '09650000234', ], }, { - locale: "en-PG", + locale: 'en-PG', valid: [ - "+67570123456", - "67570123456", - "+67571123456", - "+67572123456", - "+67573123456", - "+67574123456", - "+67575123456", - "+67576123456", - "+67577123456", - "+67578123456", - "+67579123456", - "+67581123456", - "+67588123456", + '+67570123456', + '67570123456', + '+67571123456', + '+67572123456', + '+67573123456', + '+67574123456', + '+67575123456', + '+67576123456', + '+67577123456', + '+67578123456', + '+67579123456', + '+67581123456', + '+67588123456', ], invalid: [ - "", - "not a number", - "12345", - "+675123456789", - "+67580123456", - "+67569123456", - "+67582123456", - "+6757012345", + '', + 'not a number', + '12345', + '+675123456789', + '+67580123456', + '+67569123456', + '+67582123456', + '+6757012345', ], }, { - locale: "en-AG", + locale: 'en-AG', valid: [ - "12687151234", - "+12687151234", - "+12684641234", - "12684641234", - "+12687211234", - "+12687302468", - "+12687642456", - "+12687763333", + '12687151234', + '+12687151234', + '+12684641234', + '12684641234', + '+12687211234', + '+12687302468', + '+12687642456', + '+12687763333', ], invalid: [ - "2687151234", - "+12687773333", - "+126846412333", - "+12684641", - "+12687123456", - "+12687633456", + '2687151234', + '+12687773333', + '+126846412333', + '+12684641', + '+12687123456', + '+12687633456', ], }, { - locale: "en-AI", + locale: 'en-AI', valid: [ - "+12642351234", - "12642351234", - "+12644612222", - "+12645366326", - "+12645376326", - "+12647246326", - "+12647726326", + '+12642351234', + '12642351234', + '+12644612222', + '+12645366326', + '+12645376326', + '+12647246326', + '+12647726326', ], invalid: [ - "", - "not a number", - "+22642351234", - "+12902351234", - "+12642331234", - "+1264235", - "22642353456", - "+12352643456", + '', + 'not a number', + '+22642351234', + '+12902351234', + '+12642331234', + '+1264235', + '22642353456', + '+12352643456', ], }, - { - locale: "en-KN", - valid: [ - "+18694699040", - "18694699040", - "+18697652917", - "18697652917", - "18694658472", - "+18696622969", - "+18694882224", + { + locale: 'en-KN', + valid: [ + '+18694699040', + '18694699040', + '+18697652917', + '18697652917', + '18694658472', + '+18696622969', + '+18694882224', ], invalid: [ - "", - "+18694238545", - "+1 8694882224", - "8694658472", - "+186946990", - "+1869469904", - "1869469904", + '', + '+18694238545', + '+1 8694882224', + '8694658472', + '+186946990', + '+1869469904', + '1869469904', ], }, { - locale: "en-PK", + locale: 'en-PK', valid: [ - "+923412877421", - "+923001234567", - "00923001234567", - "923001234567", - "03001234567", + '+923412877421', + '+923001234567', + '00923001234567', + '923001234567', + '03001234567', ], invalid: [ - "+3001234567", - "+933001234567", - "+924001234567", - "+92300123456720", - "030012345672", - "30012345673", - "0030012345673", - "3001234567", + '+3001234567', + '+933001234567', + '+924001234567', + '+92300123456720', + '030012345672', + '30012345673', + '0030012345673', + '3001234567', ], }, { - locale: ["tg-TJ"], + locale: ['tg-TJ'], valid: [ - "+992553388551", - "+992553322551", - "992553388551", - "992553322551", + '+992553388551', + '+992553322551', + '992553388551', + '992553322551', ], invalid: [ - "12345", - "", - "Vml2YW11cyBmZXJtZtesting123", - "+995563388559", - "+9955633559", - "19676338855", - "+992263388505", - "9923633885", - "99255363885", - "66338855", + '12345', + '', + 'Vml2YW11cyBmZXJtZtesting123', + '+995563388559', + '+9955633559', + '19676338855', + '+992263388505', + '9923633885', + '99255363885', + '66338855', ], }, { - locale: "dv-MV", + locale: 'dv-MV', valid: [ - "+9609112345", - "+9609958973", - "+9607258963", - "+9607958463", - "9609112345", - "9609958973", - "9607212963", - "9607986963", - "9112345", - "9958973", - "7258963", - "7958963", + '+9609112345', + '+9609958973', + '+9607258963', + '+9607958463', + '9609112345', + '9609958973', + '9607212963', + '9607986963', + '9112345', + '9958973', + '7258963', + '7958963', ], invalid: [ - "+96059234567", - "+96045789", - "7812463784", - "NotANumber", - "+9607112345", - "+9609012345", - "+609012345", - "+96071123456", - "3412345", - "9603412345", + '+96059234567', + '+96045789', + '7812463784', + 'NotANumber', + '+9607112345', + '+9609012345', + '+609012345', + '+96071123456', + '3412345', + '9603412345', ], }, { - locale: "ar-YE", - valid: ["737198225", "733111355", "+967700990270"], + locale: 'ar-YE', + valid: ['737198225', '733111355', '+967700990270'], invalid: [ - "+5032136663", - "21346663", - "+50321366663", - "12345", - "Yemen", - "this should fail", - "+5032222", - "+503 1111 1111", - "00 +503 1234 5678", + '+5032136663', + '21346663', + '+50321366663', + '12345', + 'Yemen', + 'this should fail', + '+5032222', + '+503 1111 1111', + '00 +503 1234 5678', ], }, { - locale: "ar-EH", + locale: 'ar-EH', valid: [ - "+212-5288-12312", - "+212-5288 12312", - "+212 5288 12312", - "212528912312", - "+212528912312", - "+212528812312", + '+212-5288-12312', + '+212-5288 12312', + '+212 5288 12312', + '212528912312', + '+212528912312', + '+212528812312', ], invalid: [ - "212528812312123", - "+212-5290-12312", - "++212528812312", - "12345", - "Wester Sahara", - "this should fail", - "212 5288---12312", - "+503 1111 1111", - "00 +503 1234 5678", + '212528812312123', + '+212-5290-12312', + '++212528812312', + '12345', + 'Wester Sahara', + 'this should fail', + '212 5288---12312', + '+503 1111 1111', + '00 +503 1234 5678', ], }, { - locale: "fa-AF", - valid: ["0511231231", "+93511231231", "+93281234567"], + locale: 'fa-AF', + valid: ['0511231231', '+93511231231', '+93281234567'], invalid: [ - "212528812312123", - "+212-5290-12312", - "++212528812312", - "12345", - "Afghanistan", - "this should fail", - "212 5288---12312", - "+503 1111 1111", - "00 +503 1234 5678", + '212528812312123', + '+212-5290-12312', + '++212528812312', + '12345', + 'Afghanistan', + 'this should fail', + '212 5288---12312', + '+503 1111 1111', + '00 +503 1234 5678', ], }, { - locale: "en-SS", - valid: [ - "+211928530422", - "+211913384561", - "+211972879174", - "+211952379334", - "0923346543", - "0950459022", - "0970934567", - "211979841238", - "211929843238", - "211959840238", + locale: 'en-SS', + valid: [ + '+211928530422', + '+211913384561', + '+211972879174', + '+211952379334', + '0923346543', + '0950459022', + '0970934567', + '211979841238', + '211929843238', + '211959840238', ], invalid: [ - "911", - "+211999", - "123456789909", - "South Sudan", - "21195 840 238", - "+211981234567", - "+211931234567", - "+211901234567", - "+211991234567", + '911', + '+211999', + '123456789909', + 'South Sudan', + '21195 840 238', + '+211981234567', + '+211931234567', + '+211901234567', + '+211991234567', ], }, ]; @@ -8361,14 +8361,14 @@ describe("Validators", () => { if (Array.isArray(fixture.locale)) { test({ - validator: "isMobilePhone", + validator: 'isMobilePhone', valid: fixture.valid, invalid: fixture.invalid, args: [fixture.locale], }); } else { test({ - validator: "isMobilePhone", + validator: 'isMobilePhone', valid: fixture.valid, invalid: fixture.invalid, args: [fixture.locale], @@ -8377,42 +8377,42 @@ describe("Validators", () => { }); test({ - validator: "isMobilePhone", + validator: 'isMobilePhone', valid: allValid, invalid: [ - "", - "asdf", - "1", - "ASDFGJKLmZXJtZtesting123", - "Vml2YW11cyBmZXJtZtesting123", + '', + 'asdf', + '1', + 'ASDFGJKLmZXJtZtesting123', + 'Vml2YW11cyBmZXJtZtesting123', ], - args: ["any"], + args: ['any'], }); // strict mode test({ - validator: "isMobilePhone", - valid: ["+254728530234", "+299 12 34 56", "+94766660206"], + validator: 'isMobilePhone', + valid: ['+254728530234', '+299 12 34 56', '+94766660206'], invalid: [ - "254728530234", - "0728530234", - "+728530234", - "766667206", - "0766670206", + '254728530234', + '0728530234', + '+728530234', + '766667206', + '0766670206', ], - args: ["any", { strictMode: true }], + args: ['any', { strictMode: true }], }); // falsey locale defaults to 'any' test({ - validator: "isMobilePhone", + validator: 'isMobilePhone', valid: allValid, invalid: [ - "", - "asdf", - "1", - "ASDFGJKLmZXJtZtesting123", - "Vml2YW11cyBmZXJtZtesting123", + '', + 'asdf', + '1', + 'ASDFGJKLmZXJtZtesting123', + 'Vml2YW11cyBmZXJtZtesting123', ], args: [], }); @@ -8420,1753 +8420,1753 @@ describe("Validators", () => { // de-CH, fr-CH, it-CH test({ - validator: "isMobilePhone", + validator: 'isMobilePhone', valid: [ - "+41751112233", - "+41761112233", - "+41771112233", - "+41781112233", - "+41791112233", - "+411122112211", + '+41751112233', + '+41761112233', + '+41771112233', + '+41781112233', + '+41791112233', + '+411122112211', ], - invalid: ["+41041112233"], + invalid: ['+41041112233'], args: [], }); - it("should error on invalid locale", () => { + it('should error on invalid locale', () => { test({ - validator: "isMobilePhone", - args: [{ locale: ["is-NOT"] }], - error: ["+123456789", "012345"], + validator: 'isMobilePhone', + args: [{ locale: ['is-NOT'] }], + error: ['+123456789', '012345'], }); }); - it("should validate currency", () => { + it('should validate currency', () => { // -$##,###.## (en-US, en-CA, en-AU, en-NZ, en-HK) test({ - validator: "isCurrency", - valid: [ - "-$10,123.45", - "$10,123.45", - "$10123.45", - "10,123.45", - "10123.45", - "10,123", - "1,123,456", - "1123456", - "1.39", - ".03", - "0.10", - "$0.10", - "-$0.01", - "-$.99", - "$100,234,567.89", - "$10,123", - "10,123", - "-10123", - ], - invalid: [ - "1.234", - "$1.1", - "$ 32.50", - "500$", - ".0001", - "$.001", - "$0.001", - "12,34.56", - "123456,123,123456", - "123,4", - ",123", - "$-,123", - "$", - ".", - ",", - "00", - "$-", - "$-,.", - "-", - "-$", - "", - "- $", + validator: 'isCurrency', + valid: [ + '-$10,123.45', + '$10,123.45', + '$10123.45', + '10,123.45', + '10123.45', + '10,123', + '1,123,456', + '1123456', + '1.39', + '.03', + '0.10', + '$0.10', + '-$0.01', + '-$.99', + '$100,234,567.89', + '$10,123', + '10,123', + '-10123', + ], + invalid: [ + '1.234', + '$1.1', + '$ 32.50', + '500$', + '.0001', + '$.001', + '$0.001', + '12,34.56', + '123456,123,123456', + '123,4', + ',123', + '$-,123', + '$', + '.', + ',', + '00', + '$-', + '$-,.', + '-', + '-$', + '', + '- $', ], }); // -$##,###.## (en-US, en-CA, en-AU, en-NZ, en-HK) test({ - validator: "isCurrency", + validator: 'isCurrency', args: [ { allow_decimal: false, }, ], valid: [ - "-$10,123", - "$10,123", - "$10123", - "10,123", - "10123", - "10,123", - "1,123,456", - "1123456", - "1", - "0", - "$0", - "-$0", - "$100,234,567", - "$10,123", - "10,123", - "-10123", - ], - invalid: [ - "-$10,123.45", - "$10,123.45", - "$10123.45", - "10,123.45", - "10123.45", - "1.39", - ".03", - "0.10", - "$0.10", - "-$0.01", - "-$.99", - "$100,234,567.89", - "1.234", - "$1.1", - "$ 32.50", - ".0001", - "$.001", - "$0.001", - "12,34.56", - "123,4", - ",123", - "$-,123", - "$", - ".", - ",", - "00", - "$-", - "$-,.", - "-", - "-$", - "", - "- $", + '-$10,123', + '$10,123', + '$10123', + '10,123', + '10123', + '10,123', + '1,123,456', + '1123456', + '1', + '0', + '$0', + '-$0', + '$100,234,567', + '$10,123', + '10,123', + '-10123', + ], + invalid: [ + '-$10,123.45', + '$10,123.45', + '$10123.45', + '10,123.45', + '10123.45', + '1.39', + '.03', + '0.10', + '$0.10', + '-$0.01', + '-$.99', + '$100,234,567.89', + '1.234', + '$1.1', + '$ 32.50', + '.0001', + '$.001', + '$0.001', + '12,34.56', + '123,4', + ',123', + '$-,123', + '$', + '.', + ',', + '00', + '$-', + '$-,.', + '-', + '-$', + '', + '- $', ], }); // -$##,###.## (en-US, en-CA, en-AU, en-NZ, en-HK) test({ - validator: "isCurrency", + validator: 'isCurrency', args: [ { require_decimal: true, }, ], valid: [ - "-$10,123.45", - "$10,123.45", - "$10123.45", - "10,123.45", - "10123.45", - "10,123.00", - "1.39", - ".03", - "0.10", - "$0.10", - "-$0.01", - "-$.99", - "$100,234,567.89", - ], - invalid: [ - "$10,123", - "10,123", - "-10123", - "1,123,456", - "1123456", - "1.234", - "$1.1", - "$ 32.50", - "500$", - ".0001", - "$.001", - "$0.001", - "12,34.56", - "123456,123,123456", - "123,4", - ",123", - "$-,123", - "$", - ".", - ",", - "00", - "$-", - "$-,.", - "-", - "-$", - "", - "- $", + '-$10,123.45', + '$10,123.45', + '$10123.45', + '10,123.45', + '10123.45', + '10,123.00', + '1.39', + '.03', + '0.10', + '$0.10', + '-$0.01', + '-$.99', + '$100,234,567.89', + ], + invalid: [ + '$10,123', + '10,123', + '-10123', + '1,123,456', + '1123456', + '1.234', + '$1.1', + '$ 32.50', + '500$', + '.0001', + '$.001', + '$0.001', + '12,34.56', + '123456,123,123456', + '123,4', + ',123', + '$-,123', + '$', + '.', + ',', + '00', + '$-', + '$-,.', + '-', + '-$', + '', + '- $', ], }); // -$##,###.## (en-US, en-CA, en-AU, en-NZ, en-HK) test({ - validator: "isCurrency", + validator: 'isCurrency', args: [ { digits_after_decimal: [1, 3], }, ], valid: [ - "-$10,123.4", - "$10,123.454", - "$10123.452", - "10,123.453", - "10123.450", - "10,123", - "1,123,456", - "1123456", - "1.3", - ".030", - "0.100", - "$0.1", - "-$0.0", - "-$.9", - "$100,234,567.893", - "$10,123", - "10,123.123", - "-10123.1", - ], - invalid: [ - "1.23", - "$1.13322", - "$ 32.50", - "500$", - ".0001", - "$.01", - "$0.01", - "12,34.56", - "123456,123,123456", - "123,4", - ",123", - "$-,123", - "$", - ".", - ",", - "00", - "$-", - "$-,.", - "-", - "-$", - "", - "- $", + '-$10,123.4', + '$10,123.454', + '$10123.452', + '10,123.453', + '10123.450', + '10,123', + '1,123,456', + '1123456', + '1.3', + '.030', + '0.100', + '$0.1', + '-$0.0', + '-$.9', + '$100,234,567.893', + '$10,123', + '10,123.123', + '-10123.1', + ], + invalid: [ + '1.23', + '$1.13322', + '$ 32.50', + '500$', + '.0001', + '$.01', + '$0.01', + '12,34.56', + '123456,123,123456', + '123,4', + ',123', + '$-,123', + '$', + '.', + ',', + '00', + '$-', + '$-,.', + '-', + '-$', + '', + '- $', ], }); // -$##,###.## with $ required (en-US, en-CA, en-AU, en-NZ, en-HK) test({ - validator: "isCurrency", + validator: 'isCurrency', args: [ { require_symbol: true, }, ], valid: [ - "-$10,123.45", - "$10,123.45", - "$10123.45", - "$10,123.45", - "$10,123", - "$1,123,456", - "$1123456", - "$1.39", - "$.03", - "$0.10", - "$0.10", - "-$0.01", - "-$.99", - "$100,234,567.89", - "$10,123", - "-$10123", - ], - invalid: [ - "1.234", - "$1.234", - "1.1", - "$1.1", - "$ 32.50", - " 32.50", - "500", - "10,123,456", - ".0001", - "$.001", - "$0.001", - "1,234.56", - "123456,123,123456", - "$123456,123,123456", - "123.4", - "$123.4", - ",123", - "$,123", - "$-,123", - "$", - ".", - "$.", - ",", - "$,", - "00", - "$00", - "$-", - "$-,.", - "-", - "-$", - "", - "$ ", - "- $", + '-$10,123.45', + '$10,123.45', + '$10123.45', + '$10,123.45', + '$10,123', + '$1,123,456', + '$1123456', + '$1.39', + '$.03', + '$0.10', + '$0.10', + '-$0.01', + '-$.99', + '$100,234,567.89', + '$10,123', + '-$10123', + ], + invalid: [ + '1.234', + '$1.234', + '1.1', + '$1.1', + '$ 32.50', + ' 32.50', + '500', + '10,123,456', + '.0001', + '$.001', + '$0.001', + '1,234.56', + '123456,123,123456', + '$123456,123,123456', + '123.4', + '$123.4', + ',123', + '$,123', + '$-,123', + '$', + '.', + '$.', + ',', + '$,', + '00', + '$00', + '$-', + '$-,.', + '-', + '-$', + '', + '$ ', + '- $', ], }); // ¥-##,###.## (zh-CN) test({ - validator: "isCurrency", + validator: 'isCurrency', args: [ { - symbol: "¥", + symbol: '¥', negative_sign_before_digits: true, }, ], valid: [ - "123,456.78", - "-123,456.78", - "¥6,954,231", - "¥-6,954,231", - "¥10.03", - "¥-10.03", - "10.03", - "1.39", - ".03", - "0.10", - "¥-10567.01", - "¥0.01", - "¥1,234,567.89", - "¥10,123", - "¥-10,123", - "¥-10,123.45", - "10,123", - "10123", - "¥-100", - ], - invalid: [ - "1.234", - "¥1.1", - "5,00", - ".0001", - "¥.001", - "¥0.001", - "12,34.56", - "123456,123,123456", - "123 456", - ",123", - "¥-,123", - "", - " ", - "¥", - "¥-", - "¥-,.", - "-", - "- ¥", - "-¥", - ], - }); - - test({ - validator: "isCurrency", + '123,456.78', + '-123,456.78', + '¥6,954,231', + '¥-6,954,231', + '¥10.03', + '¥-10.03', + '10.03', + '1.39', + '.03', + '0.10', + '¥-10567.01', + '¥0.01', + '¥1,234,567.89', + '¥10,123', + '¥-10,123', + '¥-10,123.45', + '10,123', + '10123', + '¥-100', + ], + invalid: [ + '1.234', + '¥1.1', + '5,00', + '.0001', + '¥.001', + '¥0.001', + '12,34.56', + '123456,123,123456', + '123 456', + ',123', + '¥-,123', + '', + ' ', + '¥', + '¥-', + '¥-,.', + '-', + '- ¥', + '-¥', + ], + }); + + test({ + validator: 'isCurrency', args: [ { negative_sign_after_digits: true, }, ], valid: [ - "$10,123.45-", - "$10,123.45", - "$10123.45", - "10,123.45", - "10123.45", - "10,123", - "1,123,456", - "1123456", - "1.39", - ".03", - "0.10", - "$0.10", - "$0.01-", - "$.99-", - "$100,234,567.89", - "$10,123", - "10,123", - "10123-", - ], - invalid: [ - "-123", - "1.234", - "$1.1", - "$ 32.50", - "500$", - ".0001", - "$.001", - "$0.001", - "12,34.56", - "123456,123,123456", - "123,4", - ",123", - "$-,123", - "$", - ".", - ",", - "00", - "$-", - "$-,.", - "-", - "-$", - "", - "- $", + '$10,123.45-', + '$10,123.45', + '$10123.45', + '10,123.45', + '10123.45', + '10,123', + '1,123,456', + '1123456', + '1.39', + '.03', + '0.10', + '$0.10', + '$0.01-', + '$.99-', + '$100,234,567.89', + '$10,123', + '10,123', + '10123-', + ], + invalid: [ + '-123', + '1.234', + '$1.1', + '$ 32.50', + '500$', + '.0001', + '$.001', + '$0.001', + '12,34.56', + '123456,123,123456', + '123,4', + ',123', + '$-,123', + '$', + '.', + ',', + '00', + '$-', + '$-,.', + '-', + '-$', + '', + '- $', ], }); // ¥##,###.## with no negatives (zh-CN) test({ - validator: "isCurrency", + validator: 'isCurrency', args: [ { - symbol: "¥", + symbol: '¥', allow_negatives: false, }, ], valid: [ - "123,456.78", - "¥6,954,231", - "¥10.03", - "10.03", - "1.39", - ".03", - "0.10", - "¥0.01", - "¥1,234,567.89", - "¥10,123", - "10,123", - "10123", - "¥100", - ], - invalid: [ - "1.234", - "-123,456.78", - "¥-6,954,231", - "¥-10.03", - "¥-10567.01", - "¥1.1", - "¥-10,123", - "¥-10,123.45", - "5,00", - "¥-100", - ".0001", - "¥.001", - "¥-.001", - "¥0.001", - "12,34.56", - "123456,123,123456", - "123 456", - ",123", - "¥-,123", - "", - " ", - "¥", - "¥-", - "¥-,.", - "-", - "- ¥", - "-¥", + '123,456.78', + '¥6,954,231', + '¥10.03', + '10.03', + '1.39', + '.03', + '0.10', + '¥0.01', + '¥1,234,567.89', + '¥10,123', + '10,123', + '10123', + '¥100', + ], + invalid: [ + '1.234', + '-123,456.78', + '¥-6,954,231', + '¥-10.03', + '¥-10567.01', + '¥1.1', + '¥-10,123', + '¥-10,123.45', + '5,00', + '¥-100', + '.0001', + '¥.001', + '¥-.001', + '¥0.001', + '12,34.56', + '123456,123,123456', + '123 456', + ',123', + '¥-,123', + '', + ' ', + '¥', + '¥-', + '¥-,.', + '-', + '- ¥', + '-¥', ], }); // R ## ###,## and R-10 123,25 (el-ZA) test({ - validator: "isCurrency", + validator: 'isCurrency', args: [ { - symbol: "R", + symbol: 'R', negative_sign_before_digits: true, - thousands_separator: " ", - decimal_separator: ",", + thousands_separator: ' ', + decimal_separator: ',', allow_negative_sign_placeholder: true, }, ], valid: [ - "123 456,78", - "-10 123", - "R-10 123", - "R 6 954 231", - "R10,03", - "10,03", - "1,39", - ",03", - "0,10", - "R10567,01", - "R0,01", - "R1 234 567,89", - "R10 123", - "R 10 123", - "R 10123", - "R-10123", - "10 123", - "10123", - ], - invalid: [ - "1,234", - "R -10123", - "R- 10123", - "R,1", - ",0001", - "R,001", - "R0,001", - "12 34,56", - "123456 123 123456", - " 123", - "- 123", - "123 ", - "", - " ", - "R", - "R- .1", - "R-", - "-", - "-R 10123", - "R00", - "R -", - "-R", + '123 456,78', + '-10 123', + 'R-10 123', + 'R 6 954 231', + 'R10,03', + '10,03', + '1,39', + ',03', + '0,10', + 'R10567,01', + 'R0,01', + 'R1 234 567,89', + 'R10 123', + 'R 10 123', + 'R 10123', + 'R-10123', + '10 123', + '10123', + ], + invalid: [ + '1,234', + 'R -10123', + 'R- 10123', + 'R,1', + ',0001', + 'R,001', + 'R0,001', + '12 34,56', + '123456 123 123456', + ' 123', + '- 123', + '123 ', + '', + ' ', + 'R', + 'R- .1', + 'R-', + '-', + '-R 10123', + 'R00', + 'R -', + '-R', ], }); // -€ ##.###,## (it-IT) test({ - validator: "isCurrency", + validator: 'isCurrency', args: [ { - symbol: "€", - thousands_separator: ".", - decimal_separator: ",", + symbol: '€', + thousands_separator: '.', + decimal_separator: ',', allow_space_after_symbol: true, }, ], valid: [ - "123.456,78", - "-123.456,78", - "€6.954.231", - "-€6.954.231", - "€ 896.954.231", - "-€ 896.954.231", - "16.954.231", - "-16.954.231", - "€10,03", - "-€10,03", - "10,03", - "-10,03", - "-1,39", - ",03", - "0,10", - "-€10567,01", - "-€ 10567,01", - "€ 0,01", - "€1.234.567,89", - "€10.123", - "10.123", - "-€10.123", - "€ 10.123", - "€10.123", - "€ 10123", - "10.123", - "-10123", - ], - invalid: [ - "1,234", - "€ 1,1", - "50#,50", - "123,@€ ", - "€€500", - ",0001", - "€ ,001", - "€0,001", - "12.34,56", - "123456.123.123456", - "€123€", - "", - " ", - "€", - " €", - "€ ", - "€€", - " 123", - "- 123", - ".123", - "-€.123", - "123 ", - "€-", - "- €", - "€ - ", - "-", - "- ", - "-€", + '123.456,78', + '-123.456,78', + '€6.954.231', + '-€6.954.231', + '€ 896.954.231', + '-€ 896.954.231', + '16.954.231', + '-16.954.231', + '€10,03', + '-€10,03', + '10,03', + '-10,03', + '-1,39', + ',03', + '0,10', + '-€10567,01', + '-€ 10567,01', + '€ 0,01', + '€1.234.567,89', + '€10.123', + '10.123', + '-€10.123', + '€ 10.123', + '€10.123', + '€ 10123', + '10.123', + '-10123', + ], + invalid: [ + '1,234', + '€ 1,1', + '50#,50', + '123,@€ ', + '€€500', + ',0001', + '€ ,001', + '€0,001', + '12.34,56', + '123456.123.123456', + '€123€', + '', + ' ', + '€', + ' €', + '€ ', + '€€', + ' 123', + '- 123', + '.123', + '-€.123', + '123 ', + '€-', + '- €', + '€ - ', + '-', + '- ', + '-€', ], }); // -##.###,## € (el-GR) test({ - validator: "isCurrency", + validator: 'isCurrency', args: [ { - symbol: "€", - thousands_separator: ".", + symbol: '€', + thousands_separator: '.', symbol_after_digits: true, - decimal_separator: ",", + decimal_separator: ',', allow_space_after_digits: true, }, ], valid: [ - "123.456,78", - "-123.456,78", - "6.954.231 €", - "-6.954.231 €", - "896.954.231", - "-896.954.231", - "16.954.231", - "-16.954.231", - "10,03€", - "-10,03€", - "10,03", - "-10,03", - "1,39", - ",03", - "-,03", - "-,03 €", - "-,03€", - "0,10", - "10567,01€", - "0,01 €", - "1.234.567,89€", - "10.123€", - "10.123", - "10.123€", - "10.123 €", - "10123 €", - "10.123", - "10123", - ], - invalid: [ - "1,234", - "1,1 €", - ",0001", - ",001 €", - "0,001€", - "12.34,56", - "123456.123.123456", - "€123€", - "", - " ", - "€", - " €", - "€ ", - " 123", - "- 123", - ".123", - "-.123€", - "-.123 €", - "123 ", - "-€", - "- €", - "-", - "- ", + '123.456,78', + '-123.456,78', + '6.954.231 €', + '-6.954.231 €', + '896.954.231', + '-896.954.231', + '16.954.231', + '-16.954.231', + '10,03€', + '-10,03€', + '10,03', + '-10,03', + '1,39', + ',03', + '-,03', + '-,03 €', + '-,03€', + '0,10', + '10567,01€', + '0,01 €', + '1.234.567,89€', + '10.123€', + '10.123', + '10.123€', + '10.123 €', + '10123 €', + '10.123', + '10123', + ], + invalid: [ + '1,234', + '1,1 €', + ',0001', + ',001 €', + '0,001€', + '12.34,56', + '123456.123.123456', + '€123€', + '', + ' ', + '€', + ' €', + '€ ', + ' 123', + '- 123', + '.123', + '-.123€', + '-.123 €', + '123 ', + '-€', + '- €', + '-', + '- ', ], }); // kr. -##.###,## (da-DK) test({ - validator: "isCurrency", + validator: 'isCurrency', args: [ { - symbol: "kr.", + symbol: 'kr.', negative_sign_before_digits: true, - thousands_separator: ".", - decimal_separator: ",", + thousands_separator: '.', + decimal_separator: ',', allow_space_after_symbol: true, }, ], valid: [ - "123.456,78", - "-10.123", - "kr. -10.123", - "kr.-10.123", - "kr. 6.954.231", - "kr.10,03", - "kr. -10,03", - "10,03", - "1,39", - ",03", - "0,10", - "kr. 10567,01", - "kr. 0,01", - "kr. 1.234.567,89", - "kr. -1.234.567,89", - "10.123", - "kr. 10.123", - "kr.10.123", - "10123", - "10.123", - "kr.-10123", - ], - invalid: [ - "1,234", - "kr. -10123", - "kr.,1", - ",0001", - "kr. ,001", - "kr.0,001", - "12.34,56", - "123456.123.123456", - ".123", - "kr.-.123", - "kr. -.123", - "- 123", - "123 ", - "", - " ", - "kr.", - " kr.", - "kr. ", - "kr.-", - "kr. -", - "kr. - ", - " - ", - "-", - "- kr.", - "-kr.", + '123.456,78', + '-10.123', + 'kr. -10.123', + 'kr.-10.123', + 'kr. 6.954.231', + 'kr.10,03', + 'kr. -10,03', + '10,03', + '1,39', + ',03', + '0,10', + 'kr. 10567,01', + 'kr. 0,01', + 'kr. 1.234.567,89', + 'kr. -1.234.567,89', + '10.123', + 'kr. 10.123', + 'kr.10.123', + '10123', + '10.123', + 'kr.-10123', + ], + invalid: [ + '1,234', + 'kr. -10123', + 'kr.,1', + ',0001', + 'kr. ,001', + 'kr.0,001', + '12.34,56', + '123456.123.123456', + '.123', + 'kr.-.123', + 'kr. -.123', + '- 123', + '123 ', + '', + ' ', + 'kr.', + ' kr.', + 'kr. ', + 'kr.-', + 'kr. -', + 'kr. - ', + ' - ', + '-', + '- kr.', + '-kr.', ], }); // kr. ##.###,## with no negatives (da-DK) test({ - validator: "isCurrency", + validator: 'isCurrency', args: [ { - symbol: "kr.", + symbol: 'kr.', allow_negatives: false, negative_sign_before_digits: true, - thousands_separator: ".", - decimal_separator: ",", + thousands_separator: '.', + decimal_separator: ',', allow_space_after_symbol: true, }, ], valid: [ - "123.456,78", - "10.123", - "kr. 10.123", - "kr.10.123", - "kr. 6.954.231", - "kr.10,03", - "kr. 10,03", - "10,03", - "1,39", - ",03", - "0,10", - "kr. 10567,01", - "kr. 0,01", - "kr. 1.234.567,89", - "kr.1.234.567,89", - "10.123", - "kr. 10.123", - "kr.10.123", - "10123", - "10.123", - "kr.10123", - ], - invalid: [ - "1,234", - "-10.123", - "kr. -10.123", - "kr. -1.234.567,89", - "kr.-10123", - "kr. -10123", - "kr.-10.123", - "kr. -10,03", - "kr.,1", - ",0001", - "kr. ,001", - "kr.0,001", - "12.34,56", - "123456.123.123456", - ".123", - "kr.-.123", - "kr. -.123", - "- 123", - "123 ", - "", - " ", - "kr.", - " kr.", - "kr. ", - "kr.-", - "kr. -", - "kr. - ", - " - ", - "-", - "- kr.", - "-kr.", + '123.456,78', + '10.123', + 'kr. 10.123', + 'kr.10.123', + 'kr. 6.954.231', + 'kr.10,03', + 'kr. 10,03', + '10,03', + '1,39', + ',03', + '0,10', + 'kr. 10567,01', + 'kr. 0,01', + 'kr. 1.234.567,89', + 'kr.1.234.567,89', + '10.123', + 'kr. 10.123', + 'kr.10.123', + '10123', + '10.123', + 'kr.10123', + ], + invalid: [ + '1,234', + '-10.123', + 'kr. -10.123', + 'kr. -1.234.567,89', + 'kr.-10123', + 'kr. -10123', + 'kr.-10.123', + 'kr. -10,03', + 'kr.,1', + ',0001', + 'kr. ,001', + 'kr.0,001', + '12.34,56', + '123456.123.123456', + '.123', + 'kr.-.123', + 'kr. -.123', + '- 123', + '123 ', + '', + ' ', + 'kr.', + ' kr.', + 'kr. ', + 'kr.-', + 'kr. -', + 'kr. - ', + ' - ', + '-', + '- kr.', + '-kr.', ], }); // ($##,###.##) (en-US, en-HK) test({ - validator: "isCurrency", + validator: 'isCurrency', args: [ { parens_for_negatives: true, }, ], valid: [ - "1,234", - "(1,234)", - "($6,954,231)", - "$10.03", - "(10.03)", - "($10.03)", - "1.39", - ".03", - "(.03)", - "($.03)", - "0.10", - "$10567.01", - "($0.01)", - "$1,234,567.89", - "$10,123", - "(10,123)", - "10123", - ], - invalid: [ - "1.234", - "($1.1)", - "-$1.10", - "$ 32.50", - "500$", - ".0001", - "$.001", - "($0.001)", - "12,34.56", - "123456,123,123456", - "( 123)", - ",123", - "$-,123", - "", - " ", - " ", - " ", - "$", - "$ ", - " $", - " 123", - "(123) ", - ".", - ",", - "00", - "$-", - "$ - ", - "$- ", - " - ", - "-", - "- $", - "-$", - "()", - "( )", - "( -)", - "( - )", - "( - )", - "(-)", - "(-$)", + '1,234', + '(1,234)', + '($6,954,231)', + '$10.03', + '(10.03)', + '($10.03)', + '1.39', + '.03', + '(.03)', + '($.03)', + '0.10', + '$10567.01', + '($0.01)', + '$1,234,567.89', + '$10,123', + '(10,123)', + '10123', + ], + invalid: [ + '1.234', + '($1.1)', + '-$1.10', + '$ 32.50', + '500$', + '.0001', + '$.001', + '($0.001)', + '12,34.56', + '123456,123,123456', + '( 123)', + ',123', + '$-,123', + '', + ' ', + ' ', + ' ', + '$', + '$ ', + ' $', + ' 123', + '(123) ', + '.', + ',', + '00', + '$-', + '$ - ', + '$- ', + ' - ', + '-', + '- $', + '-$', + '()', + '( )', + '( -)', + '( - )', + '( - )', + '(-)', + '(-$)', ], }); // $##,###.## with no negatives (en-US, en-CA, en-AU, en-HK) test({ - validator: "isCurrency", + validator: 'isCurrency', args: [{ allow_negatives: false }], valid: [ - "$10,123.45", - "$10123.45", - "10,123.45", - "10123.45", - "10,123", - "1,123,456", - "1123456", - "1.39", - ".03", - "0.10", - "$0.10", - "$100,234,567.89", - "$10,123", - "10,123", - ], - invalid: [ - "1.234", - "-1.234", - "-10123", - "-$0.01", - "-$.99", - "$1.1", - "-$1.1", - "$ 32.50", - "500$", - ".0001", - "$.001", - "$0.001", - "12,34.56", - "123456,123,123456", - "-123456,123,123456", - "123,4", - ",123", - "$-,123", - "$", - ".", - ",", - "00", - "$-", - "$-,.", - "-", - "-$", - "", - "- $", - "-$10,123.45", + '$10,123.45', + '$10123.45', + '10,123.45', + '10123.45', + '10,123', + '1,123,456', + '1123456', + '1.39', + '.03', + '0.10', + '$0.10', + '$100,234,567.89', + '$10,123', + '10,123', + ], + invalid: [ + '1.234', + '-1.234', + '-10123', + '-$0.01', + '-$.99', + '$1.1', + '-$1.1', + '$ 32.50', + '500$', + '.0001', + '$.001', + '$0.001', + '12,34.56', + '123456,123,123456', + '-123456,123,123456', + '123,4', + ',123', + '$-,123', + '$', + '.', + ',', + '00', + '$-', + '$-,.', + '-', + '-$', + '', + '- $', + '-$10,123.45', ], }); // R$ ##,###.## (pt_BR) test({ - validator: "isCurrency", + validator: 'isCurrency', args: [ { - symbol: "R$", + symbol: 'R$', require_symbol: true, allow_space_after_symbol: true, symbol_after_digits: false, - thousands_separator: ".", - decimal_separator: ",", + thousands_separator: '.', + decimal_separator: ',', }, ], - valid: ["R$ 1.400,00", "R$ 400,00"], - invalid: ["$ 1.400,00", "$R 1.400,00"], + valid: ['R$ 1.400,00', 'R$ 400,00'], + invalid: ['$ 1.400,00', '$R 1.400,00'], }); }); - it("should validate Ethereum addresses", () => { + it('should validate Ethereum addresses', () => { test({ - validator: "isEthereumAddress", + validator: 'isEthereumAddress', valid: [ - "0x0000000000000000000000000000000000000001", - "0x683E07492fBDfDA84457C16546ac3f433BFaa128", - "0x88dA6B6a8D3590e88E0FcadD5CEC56A7C9478319", - "0x8a718a84ee7B1621E63E680371e0C03C417cCaF6", - "0xFCb5AFB808b5679b4911230Aa41FfCD0cd335b42", + '0x0000000000000000000000000000000000000001', + '0x683E07492fBDfDA84457C16546ac3f433BFaa128', + '0x88dA6B6a8D3590e88E0FcadD5CEC56A7C9478319', + '0x8a718a84ee7B1621E63E680371e0C03C417cCaF6', + '0xFCb5AFB808b5679b4911230Aa41FfCD0cd335b42', ], invalid: [ - "0xGHIJK05pwm37asdf5555QWERZCXV2345AoEuIdHt", - "0xFCb5AFB808b5679b4911230Aa41FfCD0cd335b422222", - "0xFCb5AFB808b5679b4911230Aa41FfCD0cd33", - "0b0110100001100101011011000110110001101111", - "683E07492fBDfDA84457C16546ac3f433BFaa128", - "1C6o5CDkLxjsVpnLSuqRs1UBFozXLEwYvU", + '0xGHIJK05pwm37asdf5555QWERZCXV2345AoEuIdHt', + '0xFCb5AFB808b5679b4911230Aa41FfCD0cd335b422222', + '0xFCb5AFB808b5679b4911230Aa41FfCD0cd33', + '0b0110100001100101011011000110110001101111', + '683E07492fBDfDA84457C16546ac3f433BFaa128', + '1C6o5CDkLxjsVpnLSuqRs1UBFozXLEwYvU', ], }); }); - it("should validate Bitcoin addresses", () => { + it('should validate Bitcoin addresses', () => { test({ - validator: "isBtcAddress", + validator: 'isBtcAddress', valid: [ - "1MUz4VMYui5qY1mxUiG8BQ1Luv6tqkvaiL", - "3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy", - "bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq", - "14qViLJfdGaP4EeHnDyJbEGQysnCpwk3gd", - "35bSzXvRKLpHsHMrzb82f617cV4Srnt7hS", - "17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemt", - "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4", + '1MUz4VMYui5qY1mxUiG8BQ1Luv6tqkvaiL', + '3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy', + 'bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq', + '14qViLJfdGaP4EeHnDyJbEGQysnCpwk3gd', + '35bSzXvRKLpHsHMrzb82f617cV4Srnt7hS', + '17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemt', + 'bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4', ], invalid: [ - "4J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy", - "0x56F0B8A998425c53c75C4A303D4eF987533c5597", - "pp8skudq3x5hzw8ew7vzsw8tn4k8wxsqsv0lt0mf3g", - "17VZNX1SN5NlKa8UQFxwQbFeFc3iqRYhem", - "BC1QW508D6QEJXTDG4Y5R3ZARVAYR0C5XW7KV8F3T4", + '4J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy', + '0x56F0B8A998425c53c75C4A303D4eF987533c5597', + 'pp8skudq3x5hzw8ew7vzsw8tn4k8wxsqsv0lt0mf3g', + '17VZNX1SN5NlKa8UQFxwQbFeFc3iqRYhem', + 'BC1QW508D6QEJXTDG4Y5R3ZARVAYR0C5XW7KV8F3T4', ], }); }); - it("should validate booleans", () => { + it('should validate booleans', () => { test({ - validator: "isBoolean", - valid: ["true", "false", "0", "1"], - invalid: ["1.0", "0.0", "true ", "False", "True", "yes"], + validator: 'isBoolean', + valid: ['true', 'false', '0', '1'], + invalid: ['1.0', '0.0', 'true ', 'False', 'True', 'yes'], }); }); - it("should validate booleans with option loose set to true", () => { + it('should validate booleans with option loose set to true', () => { test({ - validator: "isBoolean", + validator: 'isBoolean', args: [{ loose: true }], valid: [ - "true", - "True", - "TRUE", - "false", - "False", - "FALSE", - "0", - "1", - "yes", - "Yes", - "YES", - "no", - "No", - "NO", + 'true', + 'True', + 'TRUE', + 'false', + 'False', + 'FALSE', + '0', + '1', + 'yes', + 'Yes', + 'YES', + 'no', + 'No', + 'NO', ], - invalid: ["1.0", "0.0", "true ", " false"], + invalid: ['1.0', '0.0', 'true ', ' false'], }); }); - it("should validate ISO 639-1 language codes", () => { + it('should validate ISO 639-1 language codes', () => { test({ - validator: "isISO6391", - valid: ["ay", "az", "ba", "be", "bg"], - invalid: ["aj", "al", "pe", "pf", "abc", "123", ""], + validator: 'isISO6391', + valid: ['ay', 'az', 'ba', 'be', 'bg'], + invalid: ['aj', 'al', 'pe', 'pf', 'abc', '123', ''], }); }); const validISO8601 = [ - "2009-12T12:34", - "2009", - "2009-05-19", - "2009-05-19", - "20090519", - "2009123", - "2009-05", - "2009-123", - "2009-222", - "2009-001", - "2009-W01-1", - "2009-W51-1", - "2009-W511", - "2009-W33", - "2009W511", - "2009-05-19", - "2009-05-19 00:00", - "2009-05-19 14", - "2009-05-19 14:31", - "2009-05-19 14:39:22", - "2009-05-19T14:39Z", - "2009-W21-2", - "2009-W21-2T01:22", - "2009-139", - "2009-05-19 14:39:22-06:00", - "2009-05-19 14:39:22+0600", - "2009-05-19 14:39:22-01", - "20090621T0545Z", - "2007-04-06T00:00", - "2007-04-05T24:00", - "2010-02-18T16:23:48.5", - "2010-02-18T16:23:48,444", - "2010-02-18T16:23:48,3-06:00", - "2010-02-18T16:23.4", - "2010-02-18T16:23,25", - "2010-02-18T16:23.33+0600", - "2010-02-18T16.23334444", - "2010-02-18T16,2283", - "2009-05-19 143922.500", - "2009-05-19 1439,55", - "2009-10-10", - "2020-366", - "2000-366", + '2009-12T12:34', + '2009', + '2009-05-19', + '2009-05-19', + '20090519', + '2009123', + '2009-05', + '2009-123', + '2009-222', + '2009-001', + '2009-W01-1', + '2009-W51-1', + '2009-W511', + '2009-W33', + '2009W511', + '2009-05-19', + '2009-05-19 00:00', + '2009-05-19 14', + '2009-05-19 14:31', + '2009-05-19 14:39:22', + '2009-05-19T14:39Z', + '2009-W21-2', + '2009-W21-2T01:22', + '2009-139', + '2009-05-19 14:39:22-06:00', + '2009-05-19 14:39:22+0600', + '2009-05-19 14:39:22-01', + '20090621T0545Z', + '2007-04-06T00:00', + '2007-04-05T24:00', + '2010-02-18T16:23:48.5', + '2010-02-18T16:23:48,444', + '2010-02-18T16:23:48,3-06:00', + '2010-02-18T16:23.4', + '2010-02-18T16:23,25', + '2010-02-18T16:23.33+0600', + '2010-02-18T16.23334444', + '2010-02-18T16,2283', + '2009-05-19 143922.500', + '2009-05-19 1439,55', + '2009-10-10', + '2020-366', + '2000-366', ]; const invalidISO8601 = [ - "200905", - "2009367", - "2009-", - "2007-04-05T24:50", - "2009-000", - "2009-M511", - "2009M511", - "2009-05-19T14a39r", - "2009-05-19T14:3924", - "2009-0519", - "2009-05-1914:39", - "2009-05-19 14:", - "2009-05-19r14:39", - "2009-05-19 14a39a22", - "200912-01", - "2009-05-19 14:39:22+06a00", - "2009-05-19 146922.500", - "2010-02-18T16.5:23.35:48", - "2010-02-18T16:23.35:48", - "2010-02-18T16:23.35:48.45", - "2009-05-19 14.5.44", - "2010-02-18T16:23.33.600", - "2010-02-18T16,25:23:48,444", - "2010-13-1", - "nonsense2021-01-01T00:00:00Z", - "2021-01-01T00:00:00Znonsense", + '200905', + '2009367', + '2009-', + '2007-04-05T24:50', + '2009-000', + '2009-M511', + '2009M511', + '2009-05-19T14a39r', + '2009-05-19T14:3924', + '2009-0519', + '2009-05-1914:39', + '2009-05-19 14:', + '2009-05-19r14:39', + '2009-05-19 14a39a22', + '200912-01', + '2009-05-19 14:39:22+06a00', + '2009-05-19 146922.500', + '2010-02-18T16.5:23.35:48', + '2010-02-18T16:23.35:48', + '2010-02-18T16:23.35:48.45', + '2009-05-19 14.5.44', + '2010-02-18T16:23.33.600', + '2010-02-18T16,25:23:48,444', + '2010-13-1', + 'nonsense2021-01-01T00:00:00Z', + '2021-01-01T00:00:00Znonsense', ]; - it("should validate ISO 8601 dates", () => { + it('should validate ISO 8601 dates', () => { // from http://www.pelagodesign.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/ test({ - validator: "isISO8601", + validator: 'isISO8601', valid: validISO8601, invalid: invalidISO8601, }); }); - it("should validate ISO 8601 dates, with strict = true (regression)", () => { + it('should validate ISO 8601 dates, with strict = true (regression)', () => { test({ - validator: "isISO8601", + validator: 'isISO8601', args: [{ strict: true }], valid: validISO8601, invalid: invalidISO8601, }); }); - it("should validate ISO 8601 dates, with strict = true", () => { + it('should validate ISO 8601 dates, with strict = true', () => { test({ - validator: "isISO8601", + validator: 'isISO8601', args: [{ strict: true }], - valid: ["2000-02-29", "2009-123", "2009-222", "2020-366", "2400-366"], - invalid: ["2010-02-30", "2009-02-29", "2009-366", "2019-02-31"], + valid: ['2000-02-29', '2009-123', '2009-222', '2020-366', '2400-366'], + invalid: ['2010-02-30', '2009-02-29', '2009-366', '2019-02-31'], }); }); - it("should validate ISO 8601 dates, with strictSeparator = true", () => { + it('should validate ISO 8601 dates, with strictSeparator = true', () => { test({ - validator: "isISO8601", + validator: 'isISO8601', args: [{ strictSeparator: true }], valid: [ - "2009-12T12:34", - "2009", - "2009-05-19", - "2009-05-19", - "20090519", - "2009123", - "2009-05", - "2009-123", - "2009-222", - "2009-001", - "2009-W01-1", - "2009-W51-1", - "2009-W511", - "2009-W33", - "2009W511", - "2009-05-19", - "2009-05-19T14:39Z", - "2009-W21-2", - "2009-W21-2T01:22", - "2009-139", - "20090621T0545Z", - "2007-04-06T00:00", - "2007-04-05T24:00", - "2010-02-18T16:23:48.5", - "2010-02-18T16:23:48,444", - "2010-02-18T16:23:48,3-06:00", - "2010-02-18T16:23.4", - "2010-02-18T16:23,25", - "2010-02-18T16:23.33+0600", - "2010-02-18T16.23334444", - "2010-02-18T16,2283", - "2009-10-10", - "2020-366", - "2000-366", - ], - invalid: [ - "200905", - "2009367", - "2009-", - "2007-04-05T24:50", - "2009-000", - "2009-M511", - "2009M511", - "2009-05-19T14a39r", - "2009-05-19T14:3924", - "2009-0519", - "2009-05-1914:39", - "2009-05-19 14:", - "2009-05-19r14:39", - "2009-05-19 14a39a22", - "200912-01", - "2009-05-19 14:39:22+06a00", - "2009-05-19 146922.500", - "2010-02-18T16.5:23.35:48", - "2010-02-18T16:23.35:48", - "2010-02-18T16:23.35:48.45", - "2009-05-19 14.5.44", - "2010-02-18T16:23.33.600", - "2010-02-18T16,25:23:48,444", - "2010-13-1", - "2009-05-19 00:00", + '2009-12T12:34', + '2009', + '2009-05-19', + '2009-05-19', + '20090519', + '2009123', + '2009-05', + '2009-123', + '2009-222', + '2009-001', + '2009-W01-1', + '2009-W51-1', + '2009-W511', + '2009-W33', + '2009W511', + '2009-05-19', + '2009-05-19T14:39Z', + '2009-W21-2', + '2009-W21-2T01:22', + '2009-139', + '20090621T0545Z', + '2007-04-06T00:00', + '2007-04-05T24:00', + '2010-02-18T16:23:48.5', + '2010-02-18T16:23:48,444', + '2010-02-18T16:23:48,3-06:00', + '2010-02-18T16:23.4', + '2010-02-18T16:23,25', + '2010-02-18T16:23.33+0600', + '2010-02-18T16.23334444', + '2010-02-18T16,2283', + '2009-10-10', + '2020-366', + '2000-366', + ], + invalid: [ + '200905', + '2009367', + '2009-', + '2007-04-05T24:50', + '2009-000', + '2009-M511', + '2009M511', + '2009-05-19T14a39r', + '2009-05-19T14:3924', + '2009-0519', + '2009-05-1914:39', + '2009-05-19 14:', + '2009-05-19r14:39', + '2009-05-19 14a39a22', + '200912-01', + '2009-05-19 14:39:22+06a00', + '2009-05-19 146922.500', + '2010-02-18T16.5:23.35:48', + '2010-02-18T16:23.35:48', + '2010-02-18T16:23.35:48.45', + '2009-05-19 14.5.44', + '2010-02-18T16:23.33.600', + '2010-02-18T16,25:23:48,444', + '2010-13-1', + '2009-05-19 00:00', // Previously valid cases - "2009-05-19 14", - "2009-05-19 14:31", - "2009-05-19 14:39:22", - "2009-05-19 14:39:22-06:00", - "2009-05-19 14:39:22+0600", - "2009-05-19 14:39:22-01", + '2009-05-19 14', + '2009-05-19 14:31', + '2009-05-19 14:39:22', + '2009-05-19 14:39:22-06:00', + '2009-05-19 14:39:22+0600', + '2009-05-19 14:39:22-01', ], }); }); - it("should validate ISO 8601 dates, with strict = true and strictSeparator = true (regression)", () => { + it('should validate ISO 8601 dates, with strict = true and strictSeparator = true (regression)', () => { test({ - validator: "isISO8601", + validator: 'isISO8601', args: [{ strict: true, strictSeparator: true }], - valid: ["2000-02-29", "2009-123", "2009-222", "2020-366", "2400-366"], + valid: ['2000-02-29', '2009-123', '2009-222', '2020-366', '2400-366'], invalid: [ - "2010-02-30", - "2009-02-29", - "2009-366", - "2019-02-31", - "2009-05-19 14", - "2009-05-19 14:31", - "2009-05-19 14:39:22", - "2009-05-19 14:39:22-06:00", - "2009-05-19 14:39:22+0600", - "2009-05-19 14:39:22-01", + '2010-02-30', + '2009-02-29', + '2009-366', + '2019-02-31', + '2009-05-19 14', + '2009-05-19 14:31', + '2009-05-19 14:39:22', + '2009-05-19 14:39:22-06:00', + '2009-05-19 14:39:22+0600', + '2009-05-19 14:39:22-01', ], }); }); - it("should validate RFC 3339 dates", () => { + it('should validate RFC 3339 dates', () => { test({ - validator: "isRFC3339", + validator: 'isRFC3339', valid: [ - "2009-05-19 14:39:22-06:00", - "2009-05-19 14:39:22+06:00", - "2009-05-19 14:39:22Z", - "2009-05-19T14:39:22-06:00", - "2009-05-19T14:39:22Z", - "2010-02-18T16:23:48.3-06:00", - "2010-02-18t16:23:33+06:00", - "2010-02-18t16:23:33+06:00", - "2010-02-18t16:12:23.23334444z", - "2010-02-18T16:23:55.2283Z", - "2009-05-19 14:39:22.500Z", - "2009-05-19 14:39:55Z", - "2009-05-31 14:39:55Z", - "2009-05-31 14:53:60Z", - "2010-02-18t00:23:23.33+06:00", - "2010-02-18t00:23:32.33+00:00", - "2010-02-18t00:23:32.33+23:00", + '2009-05-19 14:39:22-06:00', + '2009-05-19 14:39:22+06:00', + '2009-05-19 14:39:22Z', + '2009-05-19T14:39:22-06:00', + '2009-05-19T14:39:22Z', + '2010-02-18T16:23:48.3-06:00', + '2010-02-18t16:23:33+06:00', + '2010-02-18t16:23:33+06:00', + '2010-02-18t16:12:23.23334444z', + '2010-02-18T16:23:55.2283Z', + '2009-05-19 14:39:22.500Z', + '2009-05-19 14:39:55Z', + '2009-05-31 14:39:55Z', + '2009-05-31 14:53:60Z', + '2010-02-18t00:23:23.33+06:00', + '2010-02-18t00:23:32.33+00:00', + '2010-02-18t00:23:32.33+23:00', ], invalid: [ - "2010-02-18t00:23:32.33+24:00", - "2009-05-31 14:60:55Z", - "2010-02-18t24:23.33+0600", - "2009-05-00 1439,55Z", - "2009-13-19 14:39:22-06:00", - "2009-05-00 14:39:22+0600", - "2009-00-1 14:39:22Z", - "2009-05-19T14:39:22", - "nonsense2021-01-01T00:00:00Z", - "2021-01-01T00:00:00Znonsense", + '2010-02-18t00:23:32.33+24:00', + '2009-05-31 14:60:55Z', + '2010-02-18t24:23.33+0600', + '2009-05-00 1439,55Z', + '2009-13-19 14:39:22-06:00', + '2009-05-00 14:39:22+0600', + '2009-00-1 14:39:22Z', + '2009-05-19T14:39:22', + 'nonsense2021-01-01T00:00:00Z', + '2021-01-01T00:00:00Znonsense', ], }); }); - it("should validate ISO 3166-1 alpha 2 country codes", () => { + it('should validate ISO 3166-1 alpha 2 country codes', () => { // from https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 test({ - validator: "isISO31661Alpha2", - valid: ["FR", "fR", "GB", "PT", "CM", "JP", "PM", "ZW", "MM", "cc", "GG"], - invalid: ["", "FRA", "AA", "PI", "RP", "WV", "WL", "UK", "ZZ"], + validator: 'isISO31661Alpha2', + valid: ['FR', 'fR', 'GB', 'PT', 'CM', 'JP', 'PM', 'ZW', 'MM', 'cc', 'GG'], + invalid: ['', 'FRA', 'AA', 'PI', 'RP', 'WV', 'WL', 'UK', 'ZZ'], }); }); - it("should validate ISO 3166-1 alpha 3 country codes", () => { + it('should validate ISO 3166-1 alpha 3 country codes', () => { // from https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3 test({ - validator: "isISO31661Alpha3", - valid: ["ABW", "HND", "KHM", "RWA"], - invalid: ["", "FR", "fR", "GB", "PT", "CM", "JP", "PM", "ZW"], + validator: 'isISO31661Alpha3', + valid: ['ABW', 'HND', 'KHM', 'RWA'], + invalid: ['', 'FR', 'fR', 'GB', 'PT', 'CM', 'JP', 'PM', 'ZW'], }); }); - it("should validate ISO 4217 corrency codes", () => { + it('should validate ISO 4217 corrency codes', () => { // from https://en.wikipedia.org/wiki/ISO_4217 test({ - validator: "isISO4217", + validator: 'isISO4217', valid: [ - "AED", - "aed", - "AUD", - "CUC", - "EUR", - "GBP", - "LYD", - "MYR", - "SGD", - "USD", + 'AED', + 'aed', + 'AUD', + 'CUC', + 'EUR', + 'GBP', + 'LYD', + 'MYR', + 'SGD', + 'USD', ], - invalid: ["", "$", "US", "us", "AAA", "aaa", "RWA", "EURO", "euro"], + invalid: ['', '$', 'US', 'us', 'AAA', 'aaa', 'RWA', 'EURO', 'euro'], }); }); - it("should validate whitelisted characters", () => { + it('should validate whitelisted characters', () => { test({ - validator: "isWhitelisted", - args: ["abcdefghijklmnopqrstuvwxyz-"], - valid: ["foo", "foobar", "baz-foo"], - invalid: ["foo bar", "fo.bar", "türkçe"], + validator: 'isWhitelisted', + args: ['abcdefghijklmnopqrstuvwxyz-'], + valid: ['foo', 'foobar', 'baz-foo'], + invalid: ['foo bar', 'fo.bar', 'türkçe'], }); }); - it("should error on non-string input", () => { + it('should error on non-string input', () => { test({ - validator: "isEmpty", + validator: 'isEmpty', error: [undefined, null, [], NaN], }); }); - it("should validate dataURI", () => { + it('should validate dataURI', () => { /* eslint-disable max-len */ test({ - validator: "isDataURI", - valid: [ - "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC", - "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIBAMAAAA2IaO4AAAAFVBMVEXk5OTn5+ft7e319fX29vb5+fn///++GUmVAAAALUlEQVQIHWNICnYLZnALTgpmMGYIFWYIZTA2ZFAzTTFlSDFVMwVyQhmAwsYMAKDaBy0axX/iAAAAAElFTkSuQmCC", - "data:application/media_control+xml;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIBAMAAAA2IaO4AAAAFVBMVEXk5OTn5+ft7e319fX29vb5+fn///++GUmVAAAALUlEQVQIHWNICnYLZnALTgpmMGYIFWYIZTA2ZFAzTTFlSDFVMwVyQhmAwsYMAKDaBy0axX/iAAAAAElFTkSuQmCC", - " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIBAMAAAA2IaO4AAAAFVBMVEXk5OTn5+ft7e319fX29vb5+fn///++GUmVAAAALUlEQVQIHWNICnYLZnALTgpmMGYIFWYIZTA2ZFAzTTFlSDFVMwVyQhmAwsYMAKDaBy0axX/iAAAAAElFTkSuQmCC ", - "data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22100%22%20height%3D%22100%22%3E%3Crect%20fill%3D%22%2300B1FF%22%20width%3D%22100%22%20height%3D%22100%22%2F%3E%3C%2Fsvg%3E", - "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIj48cmVjdCBmaWxsPSIjMDBCMUZGIiB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIvPjwvc3ZnPg==", - " data:,Hello%2C%20World!", - " data:,Hello World!", - " data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D", - " data:text/html,%3Ch1%3EHello%2C%20World!%3C%2Fh1%3E", - "data:,A%20brief%20note", - "data:text/html;charset=US-ASCII,%3Ch1%3EHello!%3C%2Fh1%3E", - "data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64,dGVzdC5kb2N4", - ], - invalid: [ - "dataxbase64", - "data:HelloWorld", - "data:,A%20brief%20invalid%20[note", - "file:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D", - "data:text/html;charset=,%3Ch1%3EHello!%3C%2Fh1%3E", - "data:text/html;charset,%3Ch1%3EHello!%3C%2Fh1%3E", - "data:base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC", - "", - "http://wikipedia.org", - "base64", - "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC", + validator: 'isDataURI', + valid: [ + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC', + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIBAMAAAA2IaO4AAAAFVBMVEXk5OTn5+ft7e319fX29vb5+fn///++GUmVAAAALUlEQVQIHWNICnYLZnALTgpmMGYIFWYIZTA2ZFAzTTFlSDFVMwVyQhmAwsYMAKDaBy0axX/iAAAAAElFTkSuQmCC', + 'data:application/media_control+xml;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIBAMAAAA2IaO4AAAAFVBMVEXk5OTn5+ft7e319fX29vb5+fn///++GUmVAAAALUlEQVQIHWNICnYLZnALTgpmMGYIFWYIZTA2ZFAzTTFlSDFVMwVyQhmAwsYMAKDaBy0axX/iAAAAAElFTkSuQmCC', + ' data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIBAMAAAA2IaO4AAAAFVBMVEXk5OTn5+ft7e319fX29vb5+fn///++GUmVAAAALUlEQVQIHWNICnYLZnALTgpmMGYIFWYIZTA2ZFAzTTFlSDFVMwVyQhmAwsYMAKDaBy0axX/iAAAAAElFTkSuQmCC ', + 'data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22100%22%20height%3D%22100%22%3E%3Crect%20fill%3D%22%2300B1FF%22%20width%3D%22100%22%20height%3D%22100%22%2F%3E%3C%2Fsvg%3E', + 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIj48cmVjdCBmaWxsPSIjMDBCMUZGIiB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIvPjwvc3ZnPg==', + ' data:,Hello%2C%20World!', + ' data:,Hello World!', + ' data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D', + ' data:text/html,%3Ch1%3EHello%2C%20World!%3C%2Fh1%3E', + 'data:,A%20brief%20note', + 'data:text/html;charset=US-ASCII,%3Ch1%3EHello!%3C%2Fh1%3E', + 'data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64,dGVzdC5kb2N4', + ], + invalid: [ + 'dataxbase64', + 'data:HelloWorld', + 'data:,A%20brief%20invalid%20[note', + 'file:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D', + 'data:text/html;charset=,%3Ch1%3EHello!%3C%2Fh1%3E', + 'data:text/html;charset,%3Ch1%3EHello!%3C%2Fh1%3E', + 'data:base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC', + '', + 'http://wikipedia.org', + 'base64', + 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC', ], }); /* eslint-enable max-len */ }); - it("should validate magnetURI", () => { + it('should validate magnetURI', () => { /* eslint-disable max-len */ test({ - validator: "isMagnetURI", - valid: [ - "magnet:?xt.1=urn:sha1:ABCDEFGHIJKLMNOPQRSTUVWXYZ123456&xt.2=urn:sha1:ABCDEFGHIJKLMNOPQRSTUVWXYZ123456", - "magnet:?xt=urn:btih:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234&dn=helloword2000&tr=udp://helloworld:1337/announce", - "magnet:?xt=urn:btih:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234&dn=foo", - "magnet:?xt=urn:btih:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234&dn=&tr=&nonexisting=hello world", - "magnet:?xt=urn:md5:ABCDEFGHIJKLMNOPQRSTUVWXYZ123456", - "magnet:?xt=urn:tree:tiger:ABCDEFGHIJKLMNOPQRSTUVWXYZ123456", - "magnet:?xt=urn:ed2k:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234", - "magnet:?tr=udp://helloworld:1337/announce&xt=urn:btih:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234", - "magnet:?xt=urn:btmh:1220caf1e1c30e81cb361b9ee167c4aa64228a7fa4fa9f6105232b28ad099f3a302e", - ], - invalid: [ - ":?xt=urn:btih:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234", - "xt=urn:btih:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234", - "magneta:?xt=urn:btih:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234", - "magnet:?xt=uarn:btih:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234", - "magnet:?xt=urn:btihz", - "magnet::?xt=urn:btih:UHWY2892JNEJ2GTEYOMDNU67E8ICGICYE92JDUGH", - "magnet:?xt:btih:ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "magnet:?xt:urn:nonexisting:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234", - "magnet:?xt.2=urn:btih:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234", - "magnet:?xt=urn:ed2k:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234567890123456789ABCD", - "magnet:?xt=urn:btmh:1120caf1e1c30e81cb361b9ee167c4aa64228a7fa4fa9f6105232b28ad099f3a302e", - "magnet:?ttxt=urn:btmh:1220caf1e1c30e81cb361b9ee167c4aa64228a7fa4fa9f6105232b28ad099f3a302e", + validator: 'isMagnetURI', + valid: [ + 'magnet:?xt.1=urn:sha1:ABCDEFGHIJKLMNOPQRSTUVWXYZ123456&xt.2=urn:sha1:ABCDEFGHIJKLMNOPQRSTUVWXYZ123456', + 'magnet:?xt=urn:btih:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234&dn=helloword2000&tr=udp://helloworld:1337/announce', + 'magnet:?xt=urn:btih:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234&dn=foo', + 'magnet:?xt=urn:btih:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234&dn=&tr=&nonexisting=hello world', + 'magnet:?xt=urn:md5:ABCDEFGHIJKLMNOPQRSTUVWXYZ123456', + 'magnet:?xt=urn:tree:tiger:ABCDEFGHIJKLMNOPQRSTUVWXYZ123456', + 'magnet:?xt=urn:ed2k:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234', + 'magnet:?tr=udp://helloworld:1337/announce&xt=urn:btih:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234', + 'magnet:?xt=urn:btmh:1220caf1e1c30e81cb361b9ee167c4aa64228a7fa4fa9f6105232b28ad099f3a302e', + ], + invalid: [ + ':?xt=urn:btih:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234', + 'xt=urn:btih:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234', + 'magneta:?xt=urn:btih:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234', + 'magnet:?xt=uarn:btih:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234', + 'magnet:?xt=urn:btihz', + 'magnet::?xt=urn:btih:UHWY2892JNEJ2GTEYOMDNU67E8ICGICYE92JDUGH', + 'magnet:?xt:btih:ABCDEFGHIJKLMNOPQRSTUVWXYZ', + 'magnet:?xt:urn:nonexisting:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234', + 'magnet:?xt.2=urn:btih:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234', + 'magnet:?xt=urn:ed2k:ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234567890123456789ABCD', + 'magnet:?xt=urn:btmh:1120caf1e1c30e81cb361b9ee167c4aa64228a7fa4fa9f6105232b28ad099f3a302e', + 'magnet:?ttxt=urn:btmh:1220caf1e1c30e81cb361b9ee167c4aa64228a7fa4fa9f6105232b28ad099f3a302e', ], }); /* eslint-enable max-len */ }); - it("should validate LatLong", () => { - test({ - validator: "isLatLong", - valid: [ - "(-17.738223, 85.605469)", - "(-12.3456789, +12.3456789)", - "(-60.978437, -0.175781)", - "(77.719772, -37.529297)", - "(7.264394, 165.058594)", - "0.955766, -19.863281", - "(31.269161,164.355469)", - "+12.3456789, -12.3456789", - "-15.379543, -137.285156", - "(11.770570, -162.949219)", - "-55.034319, 113.027344", - "58.025555, 36.738281", - "55.720923,-28.652344", - "-90.00000,-180.00000", - "(-71, -146)", - "(-71.616864, -146.616864)", - "-0.55, +0.22", - "90, 180", - "+90, -180", - "-90,+180", - "90,180", - "0, 0", - ], - invalid: [ - "(020.000000, 010.000000000)", - "89.9999999989, 360.0000000", - "90.1000000, 180.000000", - "+90.000000, -180.00001", - "090.0000, 0180.0000", - "126, -158", - "(-126.400010, -158.400010)", - "-95, -96", - "-95.738043, -96.738043", - "137, -148", - "(-137.5942, -148.5942)", - "(-120, -203)", - "(-119, -196)", - "+119.821728, -196.821728", - "(-110, -223)", - "-110.369532, 223.369532", - "(-120.969949, +203.969949)", - "-116, -126", - "-116.894222, -126.894222", - "-112, -160", - "-112.96381, -160.96381", - "-90., -180.", - "+90.1, -180.1", - "(-17.738223, 85.605469", - "0.955766, -19.863281)", - "+,-", - "(,)", - ",", - " ", - ], - }); - - test({ - validator: "isLatLong", + it('should validate LatLong', () => { + test({ + validator: 'isLatLong', + valid: [ + '(-17.738223, 85.605469)', + '(-12.3456789, +12.3456789)', + '(-60.978437, -0.175781)', + '(77.719772, -37.529297)', + '(7.264394, 165.058594)', + '0.955766, -19.863281', + '(31.269161,164.355469)', + '+12.3456789, -12.3456789', + '-15.379543, -137.285156', + '(11.770570, -162.949219)', + '-55.034319, 113.027344', + '58.025555, 36.738281', + '55.720923,-28.652344', + '-90.00000,-180.00000', + '(-71, -146)', + '(-71.616864, -146.616864)', + '-0.55, +0.22', + '90, 180', + '+90, -180', + '-90,+180', + '90,180', + '0, 0', + ], + invalid: [ + '(020.000000, 010.000000000)', + '89.9999999989, 360.0000000', + '90.1000000, 180.000000', + '+90.000000, -180.00001', + '090.0000, 0180.0000', + '126, -158', + '(-126.400010, -158.400010)', + '-95, -96', + '-95.738043, -96.738043', + '137, -148', + '(-137.5942, -148.5942)', + '(-120, -203)', + '(-119, -196)', + '+119.821728, -196.821728', + '(-110, -223)', + '-110.369532, 223.369532', + '(-120.969949, +203.969949)', + '-116, -126', + '-116.894222, -126.894222', + '-112, -160', + '-112.96381, -160.96381', + '-90., -180.', + '+90.1, -180.1', + '(-17.738223, 85.605469', + '0.955766, -19.863281)', + '+,-', + '(,)', + ',', + ' ', + ], + }); + + test({ + validator: 'isLatLong', args: [ { checkDMS: true, }, ], valid: [ - "40° 26′ 46″ N, 79° 58′ 56″ W", - "40° 26′ 46″ S, 79° 58′ 56″ E", - "90° 0′ 0″ S, 180° 0′ 0″ E", - "40° 26′ 45.9996″ N, 79° 58′ 55.2″ E", - "40° 26′ 46″ n, 79° 58′ 56″ w", - "40°26′46″s, 79°58′56″e", - "11° 0′ 0.005″ S, 180° 0′ 0″ E", - "40°26′45.9996″N, 79°58′55.2″E", + '40° 26′ 46″ N, 79° 58′ 56″ W', + '40° 26′ 46″ S, 79° 58′ 56″ E', + '90° 0′ 0″ S, 180° 0′ 0″ E', + '40° 26′ 45.9996″ N, 79° 58′ 55.2″ E', + '40° 26′ 46″ n, 79° 58′ 56″ w', + '40°26′46″s, 79°58′56″e', + '11° 0′ 0.005″ S, 180° 0′ 0″ E', + '40°26′45.9996″N, 79°58′55.2″E', ], invalid: [ - "100° 26′ 46″ N, 79° 70′ 56″ W", - "40° 89′ 46″ S, 79° 58′ 100″ E", - "40° 26.445′ 45″ N, 79° 58′ 55.2″ E", - "40° 46″ N, 79° 58′ 56″ W", + '100° 26′ 46″ N, 79° 70′ 56″ W', + '40° 89′ 46″ S, 79° 58′ 100″ E', + '40° 26.445′ 45″ N, 79° 58′ 55.2″ E', + '40° 46″ N, 79° 58′ 56″ W', ], }); }); - it("should validate postal code", () => { + it('should validate postal code', () => { const fixtures = [ { - locale: "AU", - valid: ["4000", "2620", "3000", "2017", "0800"], + locale: 'AU', + valid: ['4000', '2620', '3000', '2017', '0800'], }, { - locale: "BY", - valid: ["225320", "211120", "247710", "231960"], - invalid: ["test 225320", "211120 test", "317543", "267946"], + locale: 'BY', + valid: ['225320', '211120', '247710', '231960'], + invalid: ['test 225320', '211120 test', '317543', '267946'], }, { - locale: "CA", + locale: 'CA', valid: [ - "L4T 0A5", - "G1A-0A2", - "A1A 1A1", - "X0A-0H0", - "V5K 0A1", - "A1C 3S4", - "A1C3S4", - "a1c 3s4", - "V9A 7N2", - "B3K 5X5", - "K8N 5W6", - "K1A 0B1", - "B1Z 0B9", + 'L4T 0A5', + 'G1A-0A2', + 'A1A 1A1', + 'X0A-0H0', + 'V5K 0A1', + 'A1C 3S4', + 'A1C3S4', + 'a1c 3s4', + 'V9A 7N2', + 'B3K 5X5', + 'K8N 5W6', + 'K1A 0B1', + 'B1Z 0B9', ], invalid: [ - " ", - "invalid value", - "a1a1a", - "A1A 1A1", - "K1A 0D1", - "W1A 0B1", - "Z1A 0B1", + ' ', + 'invalid value', + 'a1a1a', + 'A1A 1A1', + 'K1A 0D1', + 'W1A 0B1', + 'Z1A 0B1', ], }, { - locale: "ES", - valid: ["01001", "52999", "27880"], - invalid: ["123", "1234", "53000", "052999", "0123", "abcde"], + locale: 'ES', + valid: ['01001', '52999', '27880'], + invalid: ['123', '1234', '53000', '052999', '0123', 'abcde'], }, { - locale: "JP", - valid: ["135-0000", "874-8577", "669-1161", "470-0156", "672-8031"], + locale: 'JP', + valid: ['135-0000', '874-8577', '669-1161', '470-0156', '672-8031'], }, { - locale: "GR", - valid: ["022 93", "29934", "90293", "299 42", "94944"], + locale: 'GR', + valid: ['022 93', '29934', '90293', '299 42', '94944'], }, { - locale: "GB", + locale: 'GB', valid: [ - "TW8 9GS", - "BS98 1TL", - "DE99 3GG", - "DE55 4SW", - "DH98 1BT", - "DH99 1NS", - "GIR0aa", - "SA99", - "W1N 4DJ", - "AA9A 9AA", - "AA99 9AA", - "BS98 1TL", - "DE993GG", + 'TW8 9GS', + 'BS98 1TL', + 'DE99 3GG', + 'DE55 4SW', + 'DH98 1BT', + 'DH99 1NS', + 'GIR0aa', + 'SA99', + 'W1N 4DJ', + 'AA9A 9AA', + 'AA99 9AA', + 'BS98 1TL', + 'DE993GG', ], }, { - locale: "FR", - valid: ["75008", "44 522", "98025", "38 499", "39940"], + locale: 'FR', + valid: ['75008', '44 522', '98025', '38 499', '39940'], }, { - locale: "ID", - valid: ["10210", "40181", "55161", "60233"], + locale: 'ID', + valid: ['10210', '40181', '55161', '60233'], }, { - locale: "IE", - valid: ["A65 TF12", "A6W U9U9"], + locale: 'IE', + valid: ['A65 TF12', 'A6W U9U9'], invalid: [ - "123", - "75690HG", - "AW5 TF12", - "AW5 TF12", - "756 90HG", - "A65T F12", - "O62 O1O2", + '123', + '75690HG', + 'AW5 TF12', + 'AW5 TF12', + '756 90HG', + 'A65T F12', + 'O62 O1O2', ], }, { - locale: "IN", - valid: ["364240", "360005"], + locale: 'IN', + valid: ['364240', '360005'], invalid: [ - "123", - "012345", - "011111", - "101123", - "291123", - "351123", - "541123", - "551123", - "651123", - "661123", - "861123", - "871123", - "881123", - "891123", + '123', + '012345', + '011111', + '101123', + '291123', + '351123', + '541123', + '551123', + '651123', + '661123', + '861123', + '871123', + '881123', + '891123', ], }, { - locale: "IL", + locale: 'IL', valid: [ - "10200", - "10292", - "10300", - "10329", - "3885500", - "4290500", - "4286000", - "7080000", + '10200', + '10292', + '10300', + '10329', + '3885500', + '4290500', + '4286000', + '7080000', ], invalid: [ - "123", - "012345", - "011111", - "101123", - "291123", - "351123", - "541123", - "551123", - "651123", - "661123", - "861123", - "871123", - "881123", - "891123", + '123', + '012345', + '011111', + '101123', + '291123', + '351123', + '541123', + '551123', + '651123', + '661123', + '861123', + '871123', + '881123', + '891123', ], }, { - locale: "BG", - valid: ["1000"], + locale: 'BG', + valid: ['1000'], }, { - locale: "IR", - valid: ["4351666456", "5614736867"], + locale: 'IR', + valid: ['4351666456', '5614736867'], invalid: [ - "43516 6456", - "123443516 6456", - "891123", - "test 4351666456", - "4351666456 test", - "test 4351666456 test", + '43516 6456', + '123443516 6456', + '891123', + 'test 4351666456', + '4351666456 test', + 'test 4351666456 test', ], }, { - locale: "CZ", - valid: ["20134", "392 90", "39919", "938 29", "39949"], + locale: 'CZ', + valid: ['20134', '392 90', '39919', '938 29', '39949'], }, { - locale: "NL", - valid: ["1012 SZ", "3432FE", "1118 BH", "3950IO", "3997 GH"], + locale: 'NL', + valid: ['1012 SZ', '3432FE', '1118 BH', '3950IO', '3997 GH'], }, { - locale: "NP", - valid: ["10811", "32600", "56806", "977"], - invalid: ["11977", "asds", "13 32", "-977", "97765"], + locale: 'NP', + valid: ['10811', '32600', '56806', '977'], + invalid: ['11977', 'asds', '13 32', '-977', '97765'], }, { - locale: "PL", + locale: 'PL', valid: [ - "47-260", - "12-930", - "78-399", - "39-490", - "38-483", - "05-800", - "54-060", + '47-260', + '12-930', + '78-399', + '39-490', + '38-483', + '05-800', + '54-060', ], }, { - locale: "TW", - valid: ["360", "90312", "399", "935", "38842"], + locale: 'TW', + valid: ['360', '90312', '399', '935', '38842'], }, { - locale: "LI", - valid: ["9485", "9497", "9491", "9489", "9496"], + locale: 'LI', + valid: ['9485', '9497', '9491', '9489', '9496'], }, { - locale: "PT", - valid: ["4829-489", "0294-348", "8156-392"], + locale: 'PT', + valid: ['4829-489', '0294-348', '8156-392'], }, { - locale: "SE", - valid: ["12994", "284 39", "39556", "489 39", "499 49"], + locale: 'SE', + valid: ['12994', '284 39', '39556', '489 39', '499 49'], }, { - locale: "AD", - valid: ["AD100", "AD200", "AD300", "AD400", "AD500", "AD600", "AD700"], + locale: 'AD', + valid: ['AD100', 'AD200', 'AD300', 'AD400', 'AD500', 'AD600', 'AD700'], }, { - locale: "UA", - valid: ["65000", "65080", "01000", "51901", "51909", "49125"], + locale: 'UA', + valid: ['65000', '65080', '01000', '51901', '51909', '49125'], }, { - locale: "BR", - valid: ["39100-000", "22040-020", "39400-152"], + locale: 'BR', + valid: ['39100-000', '22040-020', '39400-152'], invalid: [ - "79800A12", - "13165-00", - "38175-abc", - "81470-2763", - "78908", - "13010|111", + '79800A12', + '13165-00', + '38175-abc', + '81470-2763', + '78908', + '13010|111', ], }, { - locale: "NZ", - valid: ["7843", "3581", "0449", "0984", "4144"], + locale: 'NZ', + valid: ['7843', '3581', '0449', '0984', '4144'], }, { - locale: "MG", - valid: ["101", "303", "407", "512"], + locale: 'MG', + valid: ['101', '303', '407', '512'], }, { - locale: "MT", - valid: ["VLT2345", "VLT 2345", "ATD1234", "MSK8723"], + locale: 'MT', + valid: ['VLT2345', 'VLT 2345', 'ATD1234', 'MSK8723'], }, { - locale: "MY", - valid: ["56000", "12000", "79502"], + locale: 'MY', + valid: ['56000', '12000', '79502'], }, { - locale: "PR", - valid: ["00979", "00631", "00786", "00987"], + locale: 'PR', + valid: ['00979', '00631', '00786', '00987'], }, { - locale: "AZ", - valid: ["AZ0100", "AZ0121", "AZ3500"], - invalid: ["", " AZ0100", "AZ100", "AZ34340", "EN2020", "AY3030"], + locale: 'AZ', + valid: ['AZ0100', 'AZ0121', 'AZ3500'], + invalid: ['', ' AZ0100', 'AZ100', 'AZ34340', 'EN2020', 'AY3030'], }, { - locale: "DO", - valid: ["12345"], - invalid: ["A1234", "123", "123456"], + locale: 'DO', + valid: ['12345'], + invalid: ['A1234', '123', '123456'], }, { - locale: "HT", - valid: ["HT1234"], - invalid: ["HT123", "HT12345", "AA1234"], + locale: 'HT', + valid: ['HT1234'], + invalid: ['HT123', 'HT12345', 'AA1234'], }, { - locale: "TH", - valid: ["10250", "72170", "12140"], - invalid: ["T1025", "T72170", "12140TH"], + locale: 'TH', + valid: ['10250', '72170', '12140'], + invalid: ['T1025', 'T72170', '12140TH'], }, { - locale: "SG", - valid: ["308215", "546080"], + locale: 'SG', + valid: ['308215', '546080'], }, { - locale: "CN", - valid: ["150237", "100000"], - invalid: ["141234", "386789", "ab1234"], + locale: 'CN', + valid: ['150237', '100000'], + invalid: ['141234', '386789', 'ab1234'], }, { - locale: "KR", - valid: ["17008", "339012"], - invalid: ["1412347", "ab1234"], + locale: 'KR', + valid: ['17008', '339012'], + invalid: ['1412347', 'ab1234'], }, { - locale: "LK", - valid: ["11500", "22200", "10370", "43000"], - invalid: ["1234", "789389", "982"], + locale: 'LK', + valid: ['11500', '22200', '10370', '43000'], + invalid: ['1234', '789389', '982'], }, { - locale: "BA", - valid: ["76300", "71000", "75412", "76100", "88202", "88313"], - invalid: ["1234", "789389", "98212", "11000"], + locale: 'BA', + valid: ['76300', '71000', '75412', '76100', '88202', '88313'], + invalid: ['1234', '789389', '98212', '11000'], }, ]; @@ -10176,7 +10176,7 @@ describe("Validators", () => { fixtures.forEach((fixture) => { if (fixture.valid) allValid = allValid.concat(fixture.valid); test({ - validator: "isPostalCode", + validator: 'isPostalCode', valid: fixture.valid, invalid: fixture.invalid, args: [fixture.locale], @@ -10185,693 +10185,693 @@ describe("Validators", () => { // Test generics test({ - validator: "isPostalCode", + validator: 'isPostalCode', valid: [ ...allValid, - "1234", - "6900", - "1292", - "9400", - "27616", - "90210", - "10001", - "21201", - "33142", - "060623", - "123456", - "293940", - "002920", - ], - invalid: [ - "asdf", - "1", - "ASDFGJKLmZXJtZtesting123", - "Vml2YW11cyBmZXJtZtesting123", - "48380480343", - "29923-329393-2324", - "4294924224", - "13", - ], - args: ["any"], - }); - }); - - it("should error on invalid locale", () => { - test({ - validator: "isPostalCode", - args: ["is-NOT"], - error: ["293940", "1234"], - }); - }); - - it("should validate MIME types", () => { - test({ - validator: "isMimeType", - valid: [ - "application/json", - "application/xhtml+xml", - "audio/mp4", - "image/bmp", - "font/woff2", - "message/http", - "model/vnd.gtw", - "application/media_control+xml", - "multipart/form-data", - "multipart/form-data; boundary=something", - "multipart/form-data; charset=utf-8; boundary=something", - "multipart/form-data; boundary=something; charset=utf-8", + '1234', + '6900', + '1292', + '9400', + '27616', + '90210', + '10001', + '21201', + '33142', + '060623', + '123456', + '293940', + '002920', + ], + invalid: [ + 'asdf', + '1', + 'ASDFGJKLmZXJtZtesting123', + 'Vml2YW11cyBmZXJtZtesting123', + '48380480343', + '29923-329393-2324', + '4294924224', + '13', + ], + args: ['any'], + }); + }); + + it('should error on invalid locale', () => { + test({ + validator: 'isPostalCode', + args: ['is-NOT'], + error: ['293940', '1234'], + }); + }); + + it('should validate MIME types', () => { + test({ + validator: 'isMimeType', + valid: [ + 'application/json', + 'application/xhtml+xml', + 'audio/mp4', + 'image/bmp', + 'font/woff2', + 'message/http', + 'model/vnd.gtw', + 'application/media_control+xml', + 'multipart/form-data', + 'multipart/form-data; boundary=something', + 'multipart/form-data; charset=utf-8; boundary=something', + 'multipart/form-data; boundary=something; charset=utf-8', 'multipart/form-data; boundary=something; charset="utf-8"', 'multipart/form-data; boundary="something"; charset=utf-8', 'multipart/form-data; boundary="something"; charset="utf-8"', - "text/css", - "text/plain; charset=utf8", + 'text/css', + 'text/plain; charset=utf8', 'Text/HTML;Charset="utf-8"', - "text/html;charset=UTF-8", - "Text/html;charset=UTF-8", - "text/html; charset=us-ascii", - "text/html; charset=us-ascii (Plain text)", + 'text/html;charset=UTF-8', + 'Text/html;charset=UTF-8', + 'text/html; charset=us-ascii', + 'text/html; charset=us-ascii (Plain text)', 'text/html; charset="us-ascii"', - "video/mp4", + 'video/mp4', ], invalid: [ - "", - " ", - "/", - "f/b", - "application", - "application\\json", - "application/json/text", - "application/json; charset=utf-8", - "audio/mp4; charset=utf-8", - "image/bmp; charset=utf-8", - "font/woff2; charset=utf-8", - "message/http; charset=utf-8", - "model/vnd.gtw; charset=utf-8", - "video/mp4; charset=utf-8", + '', + ' ', + '/', + 'f/b', + 'application', + 'application\\json', + 'application/json/text', + 'application/json; charset=utf-8', + 'audio/mp4; charset=utf-8', + 'image/bmp; charset=utf-8', + 'font/woff2; charset=utf-8', + 'message/http; charset=utf-8', + 'model/vnd.gtw; charset=utf-8', + 'video/mp4; charset=utf-8', ], }); }); - it("should validate ISO6346 shipping containerID", () => { + it('should validate ISO6346 shipping containerID', () => { test({ - validator: "isISO6346", + validator: 'isISO6346', valid: [ - "HLXU2008419", - "TGHU7599330", - "ECMU4657496", - "MEDU6246078", - "YMLU2809976", - "MRKU0046221", - "EMCU3811879", - "OOLU8643084", - "HJCU1922713", - "QJRZ123456", + 'HLXU2008419', + 'TGHU7599330', + 'ECMU4657496', + 'MEDU6246078', + 'YMLU2809976', + 'MRKU0046221', + 'EMCU3811879', + 'OOLU8643084', + 'HJCU1922713', + 'QJRZ123456', ], invalid: [ - "OOLU1922713", - "HJCU1922413", - "FCUI985619", - "ECMJ4657496", - "TBJA7176445", - "AFFU5962593", + 'OOLU1922713', + 'HJCU1922413', + 'FCUI985619', + 'ECMJ4657496', + 'TBJA7176445', + 'AFFU5962593', ], }); }); - it("should validate ISO6346 shipping containerID", () => { + it('should validate ISO6346 shipping containerID', () => { test({ - validator: "isFreightContainerID", + validator: 'isFreightContainerID', valid: [ - "HLXU2008419", - "TGHU7599330", - "ECMU4657496", - "MEDU6246078", - "YMLU2809976", - "MRKU0046221", - "EMCU3811879", - "OOLU8643084", - "HJCU1922713", - "QJRZ123456", + 'HLXU2008419', + 'TGHU7599330', + 'ECMU4657496', + 'MEDU6246078', + 'YMLU2809976', + 'MRKU0046221', + 'EMCU3811879', + 'OOLU8643084', + 'HJCU1922713', + 'QJRZ123456', ], invalid: [ - "OOLU1922713", - "HJCU1922413", - "FCUI985619", - "ECMJ4657496", - "TBJA7176445", - "AFFU5962593", + 'OOLU1922713', + 'HJCU1922413', + 'FCUI985619', + 'ECMJ4657496', + 'TBJA7176445', + 'AFFU5962593', ], }); }); // EU-UK valid numbers sourced from https://ec.europa.eu/taxation_customs/tin/specs/FS-TIN%20Algorithms-Public.docx or constructed by @tplessas. - it("should validate taxID", () => { + it('should validate taxID', () => { test({ - validator: "isTaxID", - args: ["bg-BG"], + validator: 'isTaxID', + args: ['bg-BG'], valid: [ - "7501010010", - "0101010012", - "0111010010", - "7521010014", - "7541010019", + '7501010010', + '0101010012', + '0111010010', + '7521010014', + '7541010019', ], invalid: [ - "750101001", - "75010100101", - "75-01010/01 0", - "7521320010", - "7501010019", + '750101001', + '75010100101', + '75-01010/01 0', + '7521320010', + '7501010019', ], }); test({ - validator: "isTaxID", - args: ["cs-CZ"], + validator: 'isTaxID', + args: ['cs-CZ'], valid: [ - "530121999", - "530121/999", - "530121/9990", - "5301219990", - "1602295134", - "5451219994", - "0424175466", - "0532175468", - "7159079940", + '530121999', + '530121/999', + '530121/9990', + '5301219990', + '1602295134', + '5451219994', + '0424175466', + '0532175468', + '7159079940', ], invalid: [ - "53-0121 999", - "530121000", - "960121999", - "0124175466", - "0472301754", - "1975116400", - "7159079945", + '53-0121 999', + '530121000', + '960121999', + '0124175466', + '0472301754', + '1975116400', + '7159079945', ], }); test({ - validator: "isTaxID", - args: ["de-AT"], - valid: ["931736581", "93-173/6581", "93--173/6581"], - invalid: ["999999999", "93 173 6581", "93-173/65811", "93-173/658"], + validator: 'isTaxID', + args: ['de-AT'], + valid: ['931736581', '93-173/6581', '93--173/6581'], + invalid: ['999999999', '93 173 6581', '93-173/65811', '93-173/658'], }); test({ - validator: "isTaxID", - args: ["de-DE"], + validator: 'isTaxID', + args: ['de-DE'], valid: [ - "26954371827", - "86095742719", - "65929970489", - "79608434120", - "659/299/7048/9", + '26954371827', + '86095742719', + '65929970489', + '79608434120', + '659/299/7048/9', ], invalid: [ - "26954371828", - "86095752719", - "8609575271", - "860957527190", - "65299970489", - "65999970489", - "6592997048-9", + '26954371828', + '86095752719', + '8609575271', + '860957527190', + '65299970489', + '65999970489', + '6592997048-9', ], }); test({ - validator: "isTaxID", - args: ["dk-DK"], + validator: 'isTaxID', + args: ['dk-DK'], valid: [ - "010111-1113", - "0101110117", - "2110084008", - "2110489008", - "2110595002", - "2110197007", - "0101110117", - "0101110230", + '010111-1113', + '0101110117', + '2110084008', + '2110489008', + '2110595002', + '2110197007', + '0101110117', + '0101110230', ], invalid: [ - "010111/1113", - "010111111", - "01011111133", - "2110485008", - "2902034000", - "0101110630", + '010111/1113', + '010111111', + '01011111133', + '2110485008', + '2902034000', + '0101110630', ], }); test({ - validator: "isTaxID", - args: ["el-CY"], - valid: ["00123123T", "99652156X"], + validator: 'isTaxID', + args: ['el-CY'], + valid: ['00123123T', '99652156X'], invalid: [ - "99652156A", - "00124123T", - "00123123", - "001123123T", - "00 12-3123/T", + '99652156A', + '00124123T', + '00123123', + '001123123T', + '00 12-3123/T', ], }); test({ - validator: "isTaxID", - args: ["el-GR"], - valid: ["758426713", "032792320", "054100004"], + validator: 'isTaxID', + args: ['el-GR'], + valid: ['758426713', '032792320', '054100004'], invalid: [ - "054100005", - "05410000", - "0541000055", - "05 4100005", - "05-410/0005", - "658426713", - "558426713", + '054100005', + '05410000', + '0541000055', + '05 4100005', + '05-410/0005', + '658426713', + '558426713', ], }); test({ - validator: "isTaxID", - args: ["en-CA"], - valid: [ - "000000000", - "521719666", - "469317481", - "120217450", - "480534858", - "325268597", - "336475660", - "744797853", - "130692544", - "046454286", + validator: 'isTaxID', + args: ['en-CA'], + valid: [ + '000000000', + '521719666', + '469317481', + '120217450', + '480534858', + '325268597', + '336475660', + '744797853', + '130692544', + '046454286', ], invalid: [ - " ", - "any value", - "012345678", - "111111111", - "999999999", - "657449110", - "74 47 978 53", - "744 797 853", - "744-797-853", - "981062432", - "267500713", - "2675o0713", - "70597312", - "7058973122", - "069437151", - "046454281", - "146452286", - "30x92544", - "30692544", + ' ', + 'any value', + '012345678', + '111111111', + '999999999', + '657449110', + '74 47 978 53', + '744 797 853', + '744-797-853', + '981062432', + '267500713', + '2675o0713', + '70597312', + '7058973122', + '069437151', + '046454281', + '146452286', + '30x92544', + '30692544', ], }); test({ - validator: "isTaxID", - args: ["en-GB"], - valid: ["1234567890", "AA123456A", "AA123456 "], + validator: 'isTaxID', + args: ['en-GB'], + valid: ['1234567890', 'AA123456A', 'AA123456 '], invalid: [ - "GB123456A", - "123456789", - "12345678901", - "NK123456A", - "TN123456A", - "ZZ123456A", - "GB123456Z", - "DM123456A", - "AO123456A", - "GB-123456A", - "GB 123456 A", - "GB123456 ", + 'GB123456A', + '123456789', + '12345678901', + 'NK123456A', + 'TN123456A', + 'ZZ123456A', + 'GB123456Z', + 'DM123456A', + 'AO123456A', + 'GB-123456A', + 'GB 123456 A', + 'GB123456 ', ], }); test({ - validator: "isTaxID", - args: ["en-IE"], - valid: ["1234567T", "1234567TW", "1234577W", "1234577WW", "1234577IA"], - invalid: ["1234567", "1234577WWW", "1234577A", "1234577JA"], + validator: 'isTaxID', + args: ['en-IE'], + valid: ['1234567T', '1234567TW', '1234577W', '1234577WW', '1234577IA'], + invalid: ['1234567', '1234577WWW', '1234577A', '1234577JA'], }); test({ - validator: "isTaxID", - args: ["en-US"], + validator: 'isTaxID', + args: ['en-US'], valid: [ - "01-1234567", - "01 1234567", - "011234567", - "10-1234567", - "02-1234567", - "67-1234567", - "15-1234567", - "31-1234567", - "99-1234567", + '01-1234567', + '01 1234567', + '011234567', + '10-1234567', + '02-1234567', + '67-1234567', + '15-1234567', + '31-1234567', + '99-1234567', ], invalid: [ - "0-11234567", - "01#1234567", - "01 1234567", - "01 1234 567", - "07-1234567", - "28-1234567", - "96-1234567", + '0-11234567', + '01#1234567', + '01 1234567', + '01 1234 567', + '07-1234567', + '28-1234567', + '96-1234567', ], }); test({ - validator: "isTaxID", - args: ["es-AR"], + validator: 'isTaxID', + args: ['es-AR'], valid: [ - "20271633638", - "23274986069", - "27333234519", - "30678561165", - "33693450239", - "30534868460", - "23111111129", - "34557619099", + '20271633638', + '23274986069', + '27333234519', + '30678561165', + '33693450239', + '30534868460', + '23111111129', + '34557619099', ], invalid: [ - "20-27163363-8", - "20.27163363.8", - "33693450231", - "69345023", - "693450233123123", - "3369ew50231", - "34557619095", + '20-27163363-8', + '20.27163363.8', + '33693450231', + '69345023', + '693450233123123', + '3369ew50231', + '34557619095', ], }); test({ - validator: "isTaxID", - args: ["es-ES"], + validator: 'isTaxID', + args: ['es-ES'], valid: [ - "00054237A", - "54237A", - "X1234567L", - "Z1234567R", - "M2812345C", - "Y2812345B", + '00054237A', + '54237A', + 'X1234567L', + 'Z1234567R', + 'M2812345C', + 'Y2812345B', ], - invalid: ["M2812345CR", "A2812345C", "0/005 423-7A", "00054237U"], + invalid: ['M2812345CR', 'A2812345C', '0/005 423-7A', '00054237U'], }); test({ - validator: "isTaxID", - args: ["et-EE"], - valid: ["10001010080", "46304280206", "37102250382", "32708101201"], + validator: 'isTaxID', + args: ['et-EE'], + valid: ['10001010080', '46304280206', '37102250382', '32708101201'], invalid: [ - "46304280205", - "61002293333", - "4-6304 28/0206", - "4630428020", - "463042802066", + '46304280205', + '61002293333', + '4-6304 28/0206', + '4630428020', + '463042802066', ], }); test({ - validator: "isTaxID", - args: ["fi-FI"], - valid: ["131052-308T", "131002+308W", "131019A3089"], + validator: 'isTaxID', + args: ['fi-FI'], + valid: ['131052-308T', '131002+308W', '131019A3089'], invalid: [ - "131052308T", - "131052-308TT", - "131052S308T", - "13 1052-308/T", - "290219A1111", + '131052308T', + '131052-308TT', + '131052S308T', + '13 1052-308/T', + '290219A1111', ], }); test({ - validator: "isTaxID", - args: ["fr-BE"], - valid: ["00012511119"], + validator: 'isTaxID', + args: ['fr-BE'], + valid: ['00012511119'], }); test({ - validator: "isTaxID", - args: ["fr-FR"], - valid: ["30 23 217 600 053", "3023217600053"], + validator: 'isTaxID', + args: ['fr-FR'], + valid: ['30 23 217 600 053', '3023217600053'], invalid: [ - "30 2 3 217 600 053", - "3 023217-600/053", - "3023217600052", - "3023217500053", - "30232176000534", - "302321760005", + '30 2 3 217 600 053', + '3 023217-600/053', + '3023217600052', + '3023217500053', + '30232176000534', + '302321760005', ], }); test({ - validator: "isTaxID", - args: ["nl-BE"], - valid: ["00012511148", "00/0125-11148", "00000011115"], + validator: 'isTaxID', + args: ['nl-BE'], + valid: ['00012511148', '00/0125-11148', '00000011115'], invalid: [ - "00 01 2511148", - "01022911148", - "00013211148", - "0001251114", - "000125111480", - "00012511149", + '00 01 2511148', + '01022911148', + '00013211148', + '0001251114', + '000125111480', + '00012511149', ], }); test({ - validator: "isTaxID", - args: ["fr-LU"], - valid: ["1893120105732"], + validator: 'isTaxID', + args: ['fr-LU'], + valid: ['1893120105732'], invalid: [ - "189312010573", - "18931201057322", - "1893 12-01057/32", - "1893120105742", - "1893120105733", + '189312010573', + '18931201057322', + '1893 12-01057/32', + '1893120105742', + '1893120105733', ], }); test({ - validator: "isTaxID", - args: ["lb-LU"], - invalid: ["2016023005732"], + validator: 'isTaxID', + args: ['lb-LU'], + invalid: ['2016023005732'], }); test({ - validator: "isTaxID", - args: ["hr-HR"], - valid: ["94577403194"], + validator: 'isTaxID', + args: ['hr-HR'], + valid: ['94577403194'], invalid: [ - "94 57-7403/194", - "9457740319", - "945774031945", - "94577403197", - "94587403194", + '94 57-7403/194', + '9457740319', + '945774031945', + '94577403197', + '94587403194', ], }); test({ - validator: "isTaxID", - args: ["hu-HU"], - valid: ["8071592153"], + validator: 'isTaxID', + args: ['hu-HU'], + valid: ['8071592153'], invalid: [ - "80 71-592/153", - "80715921534", - "807159215", - "8071592152", - "8071582153", + '80 71-592/153', + '80715921534', + '807159215', + '8071592152', + '8071582153', ], }); test({ - validator: "isTaxID", - args: ["lt-LT"], - valid: ["33309240064"], + validator: 'isTaxID', + args: ['lt-LT'], + valid: ['33309240064'], }); test({ - validator: "isTaxID", - args: ["it-IT"], - valid: ["DMLPRY77D15H501F", "AXXFAXTTD41H501D"], + validator: 'isTaxID', + args: ['it-IT'], + valid: ['DMLPRY77D15H501F', 'AXXFAXTTD41H501D'], invalid: [ - "DML PRY/77D15H501-F", - "DMLPRY77D15H501", - "DMLPRY77D15H501FF", - "AAPPRY77D15H501F", - "DMLAXA77D15H501F", - "AXXFAX90A01Z001F", - "DMLPRY77B29H501F", - "AXXFAX3TD41H501E", + 'DML PRY/77D15H501-F', + 'DMLPRY77D15H501', + 'DMLPRY77D15H501FF', + 'AAPPRY77D15H501F', + 'DMLAXA77D15H501F', + 'AXXFAX90A01Z001F', + 'DMLPRY77B29H501F', + 'AXXFAX3TD41H501E', ], }); test({ - validator: "isTaxID", - args: ["lv-LV"], - valid: ["01011012344", "32579461005", "01019902341", "325794-61005"], - invalid: ["010110123444", "0101101234", "01001612345", "290217-22343"], + validator: 'isTaxID', + args: ['lv-LV'], + valid: ['01011012344', '32579461005', '01019902341', '325794-61005'], + invalid: ['010110123444', '0101101234', '01001612345', '290217-22343'], }); test({ - validator: "isTaxID", - args: ["mt-MT"], - valid: ["1234567A", "882345608", "34581M", "199Z"], + validator: 'isTaxID', + args: ['mt-MT'], + valid: ['1234567A', '882345608', '34581M', '199Z'], invalid: [ - "812345608", - "88234560", - "8823456088", - "11234567A", - "12/34-567 A", - "88 23-456/08", - "1234560A", - "0000000M", - "3200100G", + '812345608', + '88234560', + '8823456088', + '11234567A', + '12/34-567 A', + '88 23-456/08', + '1234560A', + '0000000M', + '3200100G', ], }); test({ - validator: "isTaxID", - args: ["nl-NL"], - valid: ["174559434"], - invalid: ["17455943", "1745594344", "17 455-94/34"], + validator: 'isTaxID', + args: ['nl-NL'], + valid: ['174559434'], + invalid: ['17455943', '1745594344', '17 455-94/34'], }); test({ - validator: "isTaxID", - args: ["pl-PL"], + validator: 'isTaxID', + args: ['pl-PL'], valid: [ - "2234567895", - "02070803628", - "02870803622", - "02670803626", - "01510813623", + '2234567895', + '02070803628', + '02870803622', + '02670803626', + '01510813623', ], invalid: [ - "020708036285", - "223456789", - "22 345-678/95", - "02 070-8036/28", - "2234567855", - "02223013623", + '020708036285', + '223456789', + '22 345-678/95', + '02 070-8036/28', + '2234567855', + '02223013623', ], }); test({ - validator: "isTaxID", - args: ["pt-BR"], - valid: ["35161990910", "74407265027", "05423994000172", "11867044000130"], + validator: 'isTaxID', + args: ['pt-BR'], + valid: ['35161990910', '74407265027', '05423994000172', '11867044000130'], invalid: [ - "ABCDEFGH", - "170.691.440-72", - "11494282142", - "74405265037", - "11111111111", - "48469799384", - "94.592.973/0001-82", - "28592361000192", - "11111111111111", - "111111111111112", - "61938188550993", - "82168365502729", + 'ABCDEFGH', + '170.691.440-72', + '11494282142', + '74405265037', + '11111111111', + '48469799384', + '94.592.973/0001-82', + '28592361000192', + '11111111111111', + '111111111111112', + '61938188550993', + '82168365502729', ], }); test({ - validator: "isTaxID", - args: ["pt-PT"], - valid: ["299999998", "299992020"], - invalid: ["2999999988", "29999999", "29 999-999/8"], + validator: 'isTaxID', + args: ['pt-PT'], + valid: ['299999998', '299992020'], + invalid: ['2999999988', '29999999', '29 999-999/8'], }); test({ - validator: "isTaxID", - args: ["ro-RO"], + validator: 'isTaxID', + args: ['ro-RO'], valid: [ - "8001011234563", - "9000123456789", - "1001011234560", - "3001011234564", - "5001011234568", + '8001011234563', + '9000123456789', + '1001011234560', + '3001011234564', + '5001011234568', ], invalid: [ - "5001011234569", - "500 1011-234/568", - "500101123456", - "50010112345688", - "5001011504568", - "8000230234563", - "6000230234563", + '5001011234569', + '500 1011-234/568', + '500101123456', + '50010112345688', + '5001011504568', + '8000230234563', + '6000230234563', ], }); test({ - validator: "isTaxID", - args: ["sk-SK"], + validator: 'isTaxID', + args: ['sk-SK'], valid: [ - "530121999", - "536221/999", - "031121999", - "520229999", - "1234567890", + '530121999', + '536221/999', + '031121999', + '520229999', + '1234567890', ], invalid: [ - "53012199999", - "990101999", - "530121000", - "53012199", - "53-0121 999", - "535229999", + '53012199999', + '990101999', + '530121000', + '53012199', + '53-0121 999', + '535229999', ], }); test({ - validator: "isTaxID", - args: ["sl-SI"], - valid: ["15012557", "15012590"], - invalid: ["150125577", "1501255", "15 01-255/7"], + validator: 'isTaxID', + args: ['sl-SI'], + valid: ['15012557', '15012590'], + invalid: ['150125577', '1501255', '15 01-255/7'], }); test({ - validator: "isTaxID", - args: ["sv-SE"], + validator: 'isTaxID', + args: ['sv-SE'], valid: [ - "640823-3234", - "640883-3231", - "6408833231", - "19640823-3233", - "196408233233", - "19640883-3230", - "200228+5266", - "20180101-5581", + '640823-3234', + '640883-3231', + '6408833231', + '19640823-3233', + '196408233233', + '19640883-3230', + '200228+5266', + '20180101-5581', ], invalid: [ - "640823+3234", - "160230-3231", - "160260-3231", - "160260-323", - "160260323", - "640823+323", - "640823323", - "640823+32344", - "64082332344", - "19640823-32333", - "1964082332333", + '640823+3234', + '160230-3231', + '160260-3231', + '160260-323', + '160260323', + '640823+323', + '640823323', + '640823+32344', + '64082332344', + '19640823-32333', + '1964082332333', ], }); test({ - validator: "isTaxID", - valid: ["01-1234567"], + validator: 'isTaxID', + valid: ['01-1234567'], }); test({ - validator: "isTaxID", - args: ["is-NOT"], + validator: 'isTaxID', + args: ['is-NOT'], error: [ - "01-1234567", - "01 1234567", - "011234567", - "0-11234567", - "01#1234567", - "01 1234567", - "01 1234 567", - "07-1234567", - "28-1234567", - "96-1234567", + '01-1234567', + '01 1234567', + '011234567', + '0-11234567', + '01#1234567', + '01 1234567', + '01 1234 567', + '07-1234567', + '28-1234567', + '96-1234567', ], }); }); - it("should validate slug", () => { + it('should validate slug', () => { test({ - validator: "isSlug", + validator: 'isSlug', valid: [ - "foo", - "foo-bar", - "foo_bar", - "foo-bar-foo", - "foo-bar_foo", - "foo-bar_foo*75-b4r-**_foo", - "foo-bar_foo*75-b4r-**_foo-&&", + 'foo', + 'foo-bar', + 'foo_bar', + 'foo-bar-foo', + 'foo-bar_foo', + 'foo-bar_foo*75-b4r-**_foo', + 'foo-bar_foo*75-b4r-**_foo-&&', ], invalid: [ - "not-----------slug", - "@#_$@", - "-not-slug", - "not-slug-", - "_not-slug", - "not-slug_", - "not slug", + 'not-----------slug', + '@#_$@', + '-not-slug', + 'not-slug-', + '_not-slug', + 'not-slug_', + 'not slug', ], }); }); - it("should validate strong passwords", () => { + it('should validate strong passwords', () => { test({ - validator: "isStrongPassword", + validator: 'isStrongPassword', args: [ { minLength: 8, @@ -10883,1140 +10883,1140 @@ describe("Validators", () => { ], valid: [ '%2%k{7BsL"M%Kd6e', - "EXAMPLE of very long_password123!", - "mxH_+2vs&54_+H3P", - "+&DxJ=X7-4L8jRCD", - "etV*p%Nr6w&H%FeF", - "£3.ndSau_7", + 'EXAMPLE of very long_password123!', + 'mxH_+2vs&54_+H3P', + '+&DxJ=X7-4L8jRCD', + 'etV*p%Nr6w&H%FeF', + '£3.ndSau_7', ], invalid: [ - "", - "password", - "hunter2", - "hello world", - "passw0rd", - "password!", - "PASSWORD!", + '', + 'password', + 'hunter2', + 'hello world', + 'passw0rd', + 'password!', + 'PASSWORD!', ], }); }); - it("should validate base64URL", () => { + it('should validate base64URL', () => { test({ - validator: "isBase64", + validator: 'isBase64', args: [{ urlSafe: true }], valid: [ - "", - "bGFkaWVzIGFuZCBnZW50bGVtZW4sIHdlIGFyZSBmbG9hdGluZyBpbiBzcGFjZQ", - "1234", - "bXVtLW5ldmVyLXByb3Vk", - "PDw_Pz8-Pg", - "VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw", + '', + 'bGFkaWVzIGFuZCBnZW50bGVtZW4sIHdlIGFyZSBmbG9hdGluZyBpbiBzcGFjZQ', + '1234', + 'bXVtLW5ldmVyLXByb3Vk', + 'PDw_Pz8-Pg', + 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw', ], invalid: [ - " AA", - "\tAA", - "\rAA", - "\nAA", - "123=", - "This+isa/bad+base64Url==", - "0K3RgtC+INC30LDQutC+0LTQuNGA0L7QstCw0L3QvdCw0Y8g0YHRgtGA0L7QutCw", + ' AA', + '\tAA', + '\rAA', + '\nAA', + '123=', + 'This+isa/bad+base64Url==', + '0K3RgtC+INC30LDQutC+0LTQuNGA0L7QstCw0L3QvdCw0Y8g0YHRgtGA0L7QutCw', ], error: [null, undefined, {}, [], 42], }); }); - it("should validate date", () => { + it('should validate date', () => { test({ - validator: "isDate", + validator: 'isDate', valid: [ new Date(), new Date([2014, 2, 15]), - new Date("2014-03-15"), - "2020/02/29", + new Date('2014-03-15'), + '2020/02/29', ], invalid: [ - "", - "15072002", + '', + '15072002', null, undefined, { year: 2002, month: 7, day: 15 }, 42, { toString() { - return "[object Date]"; + return '[object Date]'; }, }, // faking - "2020-02-30", // invalid date - "2019-02-29", // non-leap year - "2020-04-31", // invalid date - "2020/03-15", // mixed delimiter + '2020-02-30', // invalid date + '2019-02-29', // non-leap year + '2020-04-31', // invalid date + '2020/03-15', // mixed delimiter ], }); test({ - validator: "isDate", - args: ["DD/MM/YYYY"], // old format for backward compatibility - valid: ["15-07-2002", "15/07/2002"], - invalid: ["15/7/2002", "15-7-2002", "15/7/02", "15-7-02", "15-07/2002"], + validator: 'isDate', + args: ['DD/MM/YYYY'], // old format for backward compatibility + valid: ['15-07-2002', '15/07/2002'], + invalid: ['15/7/2002', '15-7-2002', '15/7/02', '15-7-02', '15-07/2002'], }); test({ - validator: "isDate", - args: [{ format: "DD/MM/YYYY" }], - valid: ["15-07-2002", "15/07/2002"], - invalid: ["15/7/2002", "15-7-2002", "15/7/02", "15-7-02", "15-07/2002"], + validator: 'isDate', + args: [{ format: 'DD/MM/YYYY' }], + valid: ['15-07-2002', '15/07/2002'], + invalid: ['15/7/2002', '15-7-2002', '15/7/02', '15-7-02', '15-07/2002'], }); test({ - validator: "isDate", - args: [{ format: "DD/MM/YY" }], - valid: ["15-07-02", "15/07/02"], - invalid: ["15/7/2002", "15-7-2002", "15/07-02", "30/04/--"], + validator: 'isDate', + args: [{ format: 'DD/MM/YY' }], + valid: ['15-07-02', '15/07/02'], + invalid: ['15/7/2002', '15-7-2002', '15/07-02', '30/04/--'], }); test({ - validator: "isDate", - args: [{ format: "D/M/YY" }], - valid: ["5-7-02", "5/7/02"], - invalid: ["5/07/02", "15/7/02", "15-7-02", "5/7-02", "3/4/aa"], + validator: 'isDate', + args: [{ format: 'D/M/YY' }], + valid: ['5-7-02', '5/7/02'], + invalid: ['5/07/02', '15/7/02', '15-7-02', '5/7-02', '3/4/aa'], }); test({ - validator: "isDate", - args: [{ format: "DD/MM/YYYY", strictMode: true }], - valid: ["15/07/2002"], + validator: 'isDate', + args: [{ format: 'DD/MM/YYYY', strictMode: true }], + valid: ['15/07/2002'], invalid: [ - "15-07-2002", - "15/7/2002", - "15-7-2002", - "15/7/02", - "15-7-02", - "15-07/2002", + '15-07-2002', + '15/7/2002', + '15-7-2002', + '15/7/02', + '15-7-02', + '15-07/2002', ], }); test({ - validator: "isDate", + validator: 'isDate', args: [{ strictMode: true }], - valid: ["2020/01/15", "2014/02/15", "2014/03/15", "2020/02/29"], + valid: ['2020/01/15', '2014/02/15', '2014/03/15', '2020/02/29'], invalid: [ - "2014-02-15", - "2020-02-29", - "15-07/2002", + '2014-02-15', + '2020-02-29', + '15-07/2002', new Date(), new Date([2014, 2, 15]), - new Date("2014-03-15"), + new Date('2014-03-15'), ], }); test({ - validator: "isDate", - args: [{ delimiters: ["/", " "] }], + validator: 'isDate', + args: [{ delimiters: ['/', ' '] }], valid: [ new Date(), new Date([2014, 2, 15]), - new Date("2014-03-15"), - "2020/02/29", - "2020 02 29", + new Date('2014-03-15'), + '2020/02/29', + '2020 02 29', ], invalid: [ - "2020-02-29", - "", - "15072002", + '2020-02-29', + '', + '15072002', null, undefined, { year: 2002, month: 7, day: 15 }, 42, { toString() { - return "[object Date]"; + return '[object Date]'; }, }, - "2020/02/30", - "2019/02/29", - "2020/04/31", - "2020/03-15", + '2020/02/30', + '2019/02/29', + '2020/04/31', + '2020/03-15', ], }); test({ - validator: "isDate", - args: [{ format: "MM.DD.YYYY", delimiters: ["."], strictMode: true }], - valid: ["01.15.2020", "02.15.2014", "03.15.2014", "02.29.2020"], + validator: 'isDate', + args: [{ format: 'MM.DD.YYYY', delimiters: ['.'], strictMode: true }], + valid: ['01.15.2020', '02.15.2014', '03.15.2014', '02.29.2020'], invalid: [ - "2014-02-15", - "2020-02-29", - "15-07/2002", + '2014-02-15', + '2020-02-29', + '15-07/2002', new Date(), new Date([2014, 2, 15]), - new Date("2014-03-15"), - "29.02.2020", + new Date('2014-03-15'), + '29.02.2020', ], }); // emulating Pacific time zone offset & time // which could potentially result in UTC conversion issues - timezone_mock.register("US/Pacific"); + timezone_mock.register('US/Pacific'); test({ - validator: "isDate", - valid: [new Date(2016, 2, 29), "2017-08-04"], + validator: 'isDate', + valid: [new Date(2016, 2, 29), '2017-08-04'], }); timezone_mock.unregister(); }); - it("should validate time", () => { + it('should validate time', () => { test({ - validator: "isTime", - valid: ["00:00", "23:59", "9:00"], + validator: 'isTime', + valid: ['00:00', '23:59', '9:00'], invalid: [ - "", + '', null, undefined, 0, - "07:00 PM", - "23", - "00:60", - "00:", - "01:0 ", - "001:01", + '07:00 PM', + '23', + '00:60', + '00:', + '01:0 ', + '001:01', ], }); test({ - validator: "isTime", - args: [{ hourFormat: "hour24", mode: "withSeconds" }], - valid: ["23:59:59", "00:00:00", "9:50:01"], + validator: 'isTime', + args: [{ hourFormat: 'hour24', mode: 'withSeconds' }], + valid: ['23:59:59', '00:00:00', '9:50:01'], invalid: [ - "", + '', null, undefined, 23, - "01:00:01 PM", - "13:00:", - "00", - "26", - "00;01", - "0 :09", - "59:59:59", - "24:00:00", - "00:59:60", - "99:99:99", - "009:50:01", + '01:00:01 PM', + '13:00:', + '00', + '26', + '00;01', + '0 :09', + '59:59:59', + '24:00:00', + '00:59:60', + '99:99:99', + '009:50:01', ], }); test({ - validator: "isTime", - args: [{ hourFormat: "hour12" }], - valid: ["12:59 PM", "12:59 AM", "01:00 PM", "01:00 AM", "7:00 AM"], + validator: 'isTime', + args: [{ hourFormat: 'hour12' }], + valid: ['12:59 PM', '12:59 AM', '01:00 PM', '01:00 AM', '7:00 AM'], invalid: [ - "", + '', null, undefined, 0, - "12:59 MM", - "12:59 MA", - "12:59 PA", - "12:59 A M", - "13:00 PM", - "23", - "00:60", - "00:", - "9:00", - "01:0 ", - "001:01", - "12:59:00 PM", - "12:59:00 A M", - "12:59:00 ", - ], - }); - test({ - validator: "isTime", - args: [{ hourFormat: "hour12", mode: "withSeconds" }], - valid: ["12:59:59 PM", "2:34:45 AM", "7:00:00 AM"], - invalid: [ - "", + '12:59 MM', + '12:59 MA', + '12:59 PA', + '12:59 A M', + '13:00 PM', + '23', + '00:60', + '00:', + '9:00', + '01:0 ', + '001:01', + '12:59:00 PM', + '12:59:00 A M', + '12:59:00 ', + ], + }); + test({ + validator: 'isTime', + args: [{ hourFormat: 'hour12', mode: 'withSeconds' }], + valid: ['12:59:59 PM', '2:34:45 AM', '7:00:00 AM'], + invalid: [ + '', null, undefined, 23, - "01:00: 1 PM", - "13:00:", - "13:00:00 PM", - "00", - "26", - "00;01", - "0 :09", - "59:59:59", - "24:00:00", - "00:59:60", - "99:99:99", - "9:50:01", - "009:50:01", - ], - }); - }); - it("should be valid license plate", () => { - test({ - validator: "isLicensePlate", - args: ["es-AR"], - valid: ["AB 123 CD", "AB123CD", "ABC 123", "ABC123"], - invalid: [ - "", - "notalicenseplate", - "AB-123-CD", - "ABC-123", - "AABC 123", - "AB CDE FG", - "ABC DEF", - "12 ABC 34", - ], - }); - test({ - validator: "isLicensePlate", - args: ["pt-PT"], - valid: ["AA-12-34", "12·34·AB", "12·AB·34", "AB 12 CD", "AB12CD"], - invalid: ["", "notalicenseplate", "A1-B2-C3", "ABC-1-EF"], - }); - test({ - validator: "isLicensePlate", - args: ["de-LI"], - valid: ["FL 1", "FL 99999", "FL 1337"], - invalid: ["", "FL 999999", "AB 12345", "FL -1"], - }); - test({ - validator: "isLicensePlate", - args: ["de-DE"], - valid: [ - "M A 1", - "M A 12", - "M A 123", - "M A 1234", - "M AB 1", - "M AB 12", - "M AB 123", - "M AB 1234", - "FS A 1", - "FS A 12", - "FS A 123", - "FS A 1234", - "FS AB 1", - "FS AB 12", - "FS AB 123", - "FS AB 1234", - "FSAB1234", - "FS-AB-1234", - "FS AB 1234 H", - "FS AB 1234 E", - "FSAB1234E", - "FS-AB-1234-E", - "FS AB-1234-E", - "FSAB1234 E", - "FS AB1234E", - "LRO AB 123", - "LRO-AB-123-E", - "LRO-AB-123E", - "LRO-AB-123 E", - "LRO-AB-123-H", - "LRO-AB-123H", - "LRO-AB-123 H", - ], - invalid: [ - "YY AB 123", - "PAF AB 1234", - "M ABC 123", - "M AB 12345", - "FS AB 1234 A", - "LRO-AB-1234", - "HRO ABC 123", - "HRO ABC 1234", - "LDK-AB-1234-E", - "ÖHR FA 123D", - "MZG-AB-123X", - "OBG-ABD-123", - "PAF-AB2-123", - ], - }); - test({ - validator: "isLicensePlate", - args: ["fi-FI"], - valid: [ - "ABC-123", - "ABC 123", - "ABC123", - "A100", - "A 100", - "A-100", - "C10001", - "C 10001", - "C-10001", - "123-ABC", - "123 ABC", - "123ABC", - "123-A", - "123 A", - "123A", - "199AA", - "199 AA", - "199-AA", - ], - invalid: [ - " ", - "A-1", - "A1A-100", - "1-A-2", - "C1234567", - "A B C 1 2 3", - "abc-123", - ], - }); - test({ - validator: "isLicensePlate", - args: ["sq-AL"], - valid: ["AA 000 AA", "ZZ 999 ZZ"], - invalid: ["", "AA 0 A", "AAA 00 AAA"], - }); - test({ - validator: "isLicensePlate", - args: ["cs-CZ"], - valid: [ - "ALA4011", - "4A23000", - "DICTAT0R", - "VETERAN", - "AZKVIZ8", - "2A45876", - "DIC-TAT0R", - ], - invalid: [ - "", - "invalidlicenseplate", - "LN5758898", - "X-|$|-X", - "AE0F-OP4", - "GO0MER", - "2AAAAAAAA", - "FS AB 1234 E", - "GB999 9999 00", - ], - }); - - test({ - validator: "isLicensePlate", - args: ["pt-BR"], - valid: [ - "ABC1234", - "ABC 1234", - "ABC-1234", - "ABC1D23", - "ABC1K23", - "ABC1Z23", - "ABC 1D23", - "ABC-1D23", - ], - invalid: ["", "AA 0 A", "AAA 00 AAA", "ABCD123", "AB12345", "AB123DC"], - }); - test({ - validator: "isLicensePlate", - args: ["hu-HU"], - valid: [ - "AAB-001", - "AVC-987", - "KOC-124", - "JCM-871", - "AWQ-777", - "BPO-001", - "BPI-002", - "UCO-342", - "UDO-385", - "XAO-987", - "AAI-789", - "ABI-789", - "ACI-789", - "AAO-789", - "ABO-789", - "ACO-789", - "YAA-123", - "XAA-123", - "WAA-258", - "XZZ-784", - "M123456", - "CK 12-34", - "DT 12-34", - "CD 12-34", - "HC 12-34", - "HB 12-34", - "HK 12-34", - "MA 12-34", - "OT 12-34", - "RR 17-87", - "CD 124-348", - "C-C 2021", - "C-X 2458", - "X-A 7842", - "E-72345", - "Z-07458", - "S ACF 83", - "SP 04-68", - ], - invalid: [ - "AAA-547", - "aab-001", - "AAB 001", - "AB34", - "789-LKJ", - "BBO-987", - "BBI-987", - "BWQ-777", - "BQW-987", - "BAI-789", - "BBI-789", - "BCI-789", - "BAO-789", - "BBO-789", - "BCO-789", - "ADI-789", - "ADO-789", - "KOC-1234", - "M1234567", - "W-12345", - "S BCF 83", - "X-D 1234", - "C-D 1234", - "HU 12-34", - ], - }); - test({ - validator: "isLicensePlate", - args: ["any"], - valid: ["FL 1", "FS AB 123"], - invalid: ["", "FL 999999", "FS AB 1234 A"], - }); - test({ - validator: "isLicensePlate", - args: ["asdfasdf"], - error: ["FL 1", "FS AB 123", "FL 999999", "FS AB 1234 A"], - }); - test({ - validator: "isLicensePlate", - args: ["sv-SE"], - valid: [ - "ABC 123", - "ABC 12A", - "ABC123", - "ABC12A", - "A WORD", - "WORD", - "ÅSNA", - "EN VARG", - "CERISE", - "AA", - "ABCDEFG", - "ÅÄÖ", - "ÅÄÖ ÅÄÖ", - ], - invalid: [ - "", - " ", - "IQV 123", - "IQV123", - "ABI 12Q", - "ÅÄÖ 123", - "ÅÄÖ 12A", - "AB1 A23", - "AB1 12A", - "lower", - "abc 123", - "abc 12A", - "abc 12a", - "AbC 12a", - "WORDLONGERTHANSEVENCHARACTERS", - "A", - "ABC-123", - ], - }); - test({ - validator: "isLicensePlate", - args: ["en-IN"], - valid: [ - "MH 04 AD 0001", - "HR26DQ0001", - "WB-04-ZU-2001", - "KL 18 X 5800", - "DL 4 CAF 4856", - "KA-41CE-5289", - "GJ 04-AD 5822", + '01:00: 1 PM', + '13:00:', + '13:00:00 PM', + '00', + '26', + '00;01', + '0 :09', + '59:59:59', + '24:00:00', + '00:59:60', + '99:99:99', + '9:50:01', + '009:50:01', + ], + }); + }); + it('should be valid license plate', () => { + test({ + validator: 'isLicensePlate', + args: ['es-AR'], + valid: ['AB 123 CD', 'AB123CD', 'ABC 123', 'ABC123'], + invalid: [ + '', + 'notalicenseplate', + 'AB-123-CD', + 'ABC-123', + 'AABC 123', + 'AB CDE FG', + 'ABC DEF', + '12 ABC 34', + ], + }); + test({ + validator: 'isLicensePlate', + args: ['pt-PT'], + valid: ['AA-12-34', '12·34·AB', '12·AB·34', 'AB 12 CD', 'AB12CD'], + invalid: ['', 'notalicenseplate', 'A1-B2-C3', 'ABC-1-EF'], + }); + test({ + validator: 'isLicensePlate', + args: ['de-LI'], + valid: ['FL 1', 'FL 99999', 'FL 1337'], + invalid: ['', 'FL 999999', 'AB 12345', 'FL -1'], + }); + test({ + validator: 'isLicensePlate', + args: ['de-DE'], + valid: [ + 'M A 1', + 'M A 12', + 'M A 123', + 'M A 1234', + 'M AB 1', + 'M AB 12', + 'M AB 123', + 'M AB 1234', + 'FS A 1', + 'FS A 12', + 'FS A 123', + 'FS A 1234', + 'FS AB 1', + 'FS AB 12', + 'FS AB 123', + 'FS AB 1234', + 'FSAB1234', + 'FS-AB-1234', + 'FS AB 1234 H', + 'FS AB 1234 E', + 'FSAB1234E', + 'FS-AB-1234-E', + 'FS AB-1234-E', + 'FSAB1234 E', + 'FS AB1234E', + 'LRO AB 123', + 'LRO-AB-123-E', + 'LRO-AB-123E', + 'LRO-AB-123 E', + 'LRO-AB-123-H', + 'LRO-AB-123H', + 'LRO-AB-123 H', + ], + invalid: [ + 'YY AB 123', + 'PAF AB 1234', + 'M ABC 123', + 'M AB 12345', + 'FS AB 1234 A', + 'LRO-AB-1234', + 'HRO ABC 123', + 'HRO ABC 1234', + 'LDK-AB-1234-E', + 'ÖHR FA 123D', + 'MZG-AB-123X', + 'OBG-ABD-123', + 'PAF-AB2-123', + ], + }); + test({ + validator: 'isLicensePlate', + args: ['fi-FI'], + valid: [ + 'ABC-123', + 'ABC 123', + 'ABC123', + 'A100', + 'A 100', + 'A-100', + 'C10001', + 'C 10001', + 'C-10001', + '123-ABC', + '123 ABC', + '123ABC', + '123-A', + '123 A', + '123A', + '199AA', + '199 AA', + '199-AA', + ], + invalid: [ + ' ', + 'A-1', + 'A1A-100', + '1-A-2', + 'C1234567', + 'A B C 1 2 3', + 'abc-123', + ], + }); + test({ + validator: 'isLicensePlate', + args: ['sq-AL'], + valid: ['AA 000 AA', 'ZZ 999 ZZ'], + invalid: ['', 'AA 0 A', 'AAA 00 AAA'], + }); + test({ + validator: 'isLicensePlate', + args: ['cs-CZ'], + valid: [ + 'ALA4011', + '4A23000', + 'DICTAT0R', + 'VETERAN', + 'AZKVIZ8', + '2A45876', + 'DIC-TAT0R', + ], + invalid: [ + '', + 'invalidlicenseplate', + 'LN5758898', + 'X-|$|-X', + 'AE0F-OP4', + 'GO0MER', + '2AAAAAAAA', + 'FS AB 1234 E', + 'GB999 9999 00', + ], + }); + + test({ + validator: 'isLicensePlate', + args: ['pt-BR'], + valid: [ + 'ABC1234', + 'ABC 1234', + 'ABC-1234', + 'ABC1D23', + 'ABC1K23', + 'ABC1Z23', + 'ABC 1D23', + 'ABC-1D23', + ], + invalid: ['', 'AA 0 A', 'AAA 00 AAA', 'ABCD123', 'AB12345', 'AB123DC'], + }); + test({ + validator: 'isLicensePlate', + args: ['hu-HU'], + valid: [ + 'AAB-001', + 'AVC-987', + 'KOC-124', + 'JCM-871', + 'AWQ-777', + 'BPO-001', + 'BPI-002', + 'UCO-342', + 'UDO-385', + 'XAO-987', + 'AAI-789', + 'ABI-789', + 'ACI-789', + 'AAO-789', + 'ABO-789', + 'ACO-789', + 'YAA-123', + 'XAA-123', + 'WAA-258', + 'XZZ-784', + 'M123456', + 'CK 12-34', + 'DT 12-34', + 'CD 12-34', + 'HC 12-34', + 'HB 12-34', + 'HK 12-34', + 'MA 12-34', + 'OT 12-34', + 'RR 17-87', + 'CD 124-348', + 'C-C 2021', + 'C-X 2458', + 'X-A 7842', + 'E-72345', + 'Z-07458', + 'S ACF 83', + 'SP 04-68', + ], + invalid: [ + 'AAA-547', + 'aab-001', + 'AAB 001', + 'AB34', + '789-LKJ', + 'BBO-987', + 'BBI-987', + 'BWQ-777', + 'BQW-987', + 'BAI-789', + 'BBI-789', + 'BCI-789', + 'BAO-789', + 'BBO-789', + 'BCO-789', + 'ADI-789', + 'ADO-789', + 'KOC-1234', + 'M1234567', + 'W-12345', + 'S BCF 83', + 'X-D 1234', + 'C-D 1234', + 'HU 12-34', + ], + }); + test({ + validator: 'isLicensePlate', + args: ['any'], + valid: ['FL 1', 'FS AB 123'], + invalid: ['', 'FL 999999', 'FS AB 1234 A'], + }); + test({ + validator: 'isLicensePlate', + args: ['asdfasdf'], + error: ['FL 1', 'FS AB 123', 'FL 999999', 'FS AB 1234 A'], + }); + test({ + validator: 'isLicensePlate', + args: ['sv-SE'], + valid: [ + 'ABC 123', + 'ABC 12A', + 'ABC123', + 'ABC12A', + 'A WORD', + 'WORD', + 'ÅSNA', + 'EN VARG', + 'CERISE', + 'AA', + 'ABCDEFG', + 'ÅÄÖ', + 'ÅÄÖ ÅÄÖ', + ], + invalid: [ + '', + ' ', + 'IQV 123', + 'IQV123', + 'ABI 12Q', + 'ÅÄÖ 123', + 'ÅÄÖ 12A', + 'AB1 A23', + 'AB1 12A', + 'lower', + 'abc 123', + 'abc 12A', + 'abc 12a', + 'AbC 12a', + 'WORDLONGERTHANSEVENCHARACTERS', + 'A', + 'ABC-123', + ], + }); + test({ + validator: 'isLicensePlate', + args: ['en-IN'], + valid: [ + 'MH 04 AD 0001', + 'HR26DQ0001', + 'WB-04-ZU-2001', + 'KL 18 X 5800', + 'DL 4 CAF 4856', + 'KA-41CE-5289', + 'GJ 04-AD 5822', ], - invalid: ["mh04ad0045", "invalidlicenseplate", "4578", "", "GJ054GH4785"], + invalid: ['mh04ad0045', 'invalidlicenseplate', '4578', '', 'GJ054GH4785'], }); }); - it("should validate VAT numbers", () => { + it('should validate VAT numbers', () => { test({ - validator: "isVAT", - args: ["AT"], - valid: ["ATU12345678", "U12345678"], - invalid: ["AT 12345678", "12345678"], + validator: 'isVAT', + args: ['AT'], + valid: ['ATU12345678', 'U12345678'], + invalid: ['AT 12345678', '12345678'], }); test({ - validator: "isVAT", - args: ["BE"], - valid: ["BE1234567890", "1234567890"], - invalid: ["BE 1234567890", "123456789"], + validator: 'isVAT', + args: ['BE'], + valid: ['BE1234567890', '1234567890'], + invalid: ['BE 1234567890', '123456789'], }); test({ - validator: "isVAT", - args: ["BG"], - valid: ["BG1234567890", "1234567890", "BG123456789", "123456789"], - invalid: ["BG 1234567890", "12345678"], + validator: 'isVAT', + args: ['BG'], + valid: ['BG1234567890', '1234567890', 'BG123456789', '123456789'], + invalid: ['BG 1234567890', '12345678'], }); test({ - validator: "isVAT", - args: ["HR"], - valid: ["HR12345678901", "12345678901"], - invalid: ["HR 12345678901", "1234567890"], + validator: 'isVAT', + args: ['HR'], + valid: ['HR12345678901', '12345678901'], + invalid: ['HR 12345678901', '1234567890'], }); test({ - validator: "isVAT", - args: ["CY"], - valid: ["CY123456789", "123456789"], - invalid: ["CY 123456789", "12345678"], + validator: 'isVAT', + args: ['CY'], + valid: ['CY123456789', '123456789'], + invalid: ['CY 123456789', '12345678'], }); test({ - validator: "isVAT", - args: ["CZ"], + validator: 'isVAT', + args: ['CZ'], valid: [ - "CZ1234567890", - "CZ123456789", - "CZ12345678", - "1234567890", - "123456789", - "12345678", + 'CZ1234567890', + 'CZ123456789', + 'CZ12345678', + '1234567890', + '123456789', + '12345678', ], - invalid: ["CZ 123456789", "1234567"], + invalid: ['CZ 123456789', '1234567'], }); test({ - validator: "isVAT", - args: ["DK"], - valid: ["DK12345678", "12345678"], - invalid: ["DK 12345678", "1234567"], + validator: 'isVAT', + args: ['DK'], + valid: ['DK12345678', '12345678'], + invalid: ['DK 12345678', '1234567'], }); test({ - validator: "isVAT", - args: ["EE"], - valid: ["EE123456789", "123456789"], - invalid: ["EE 123456789", "12345678"], + validator: 'isVAT', + args: ['EE'], + valid: ['EE123456789', '123456789'], + invalid: ['EE 123456789', '12345678'], }); test({ - validator: "isVAT", - args: ["FI"], - valid: ["FI12345678", "12345678"], - invalid: ["FI 12345678", "1234567"], + validator: 'isVAT', + args: ['FI'], + valid: ['FI12345678', '12345678'], + invalid: ['FI 12345678', '1234567'], }); test({ - validator: "isVAT", - args: ["FR"], - valid: ["FRAA123456789", "AA123456789"], - invalid: ["FR AA123456789", "123456789"], + validator: 'isVAT', + args: ['FR'], + valid: ['FRAA123456789', 'AA123456789'], + invalid: ['FR AA123456789', '123456789'], }); test({ - validator: "isVAT", - args: ["DE"], - valid: ["DE123456789", "123456789"], - invalid: ["DE 123456789", "12345678"], + validator: 'isVAT', + args: ['DE'], + valid: ['DE123456789', '123456789'], + invalid: ['DE 123456789', '12345678'], }); test({ - validator: "isVAT", - args: ["EL"], - valid: ["EL123456789", "123456789"], - invalid: ["EL 123456789", "12345678"], + validator: 'isVAT', + args: ['EL'], + valid: ['EL123456789', '123456789'], + invalid: ['EL 123456789', '12345678'], }); test({ - validator: "isVAT", - args: ["HU"], - valid: ["HU12345678", "12345678"], - invalid: ["HU 12345678", "1234567"], + validator: 'isVAT', + args: ['HU'], + valid: ['HU12345678', '12345678'], + invalid: ['HU 12345678', '1234567'], }); test({ - validator: "isVAT", - args: ["IE"], - valid: ["IE1234567AW", "1234567AW"], - invalid: ["IE 1234567", "1234567"], + validator: 'isVAT', + args: ['IE'], + valid: ['IE1234567AW', '1234567AW'], + invalid: ['IE 1234567', '1234567'], }); test({ - validator: "isVAT", - args: ["IT"], - valid: ["IT12345678910", "12345678910"], + validator: 'isVAT', + args: ['IT'], + valid: ['IT12345678910', '12345678910'], invalid: [ - "IT12345678 910", - "IT 123456789101", - "IT123456789101", - "GB12345678910", - "IT123456789", + 'IT12345678 910', + 'IT 123456789101', + 'IT123456789101', + 'GB12345678910', + 'IT123456789', ], }); test({ - validator: "isVAT", - args: ["LV"], - valid: ["LV12345678901", "12345678901"], - invalid: ["LV 12345678901", "1234567890"], + validator: 'isVAT', + args: ['LV'], + valid: ['LV12345678901', '12345678901'], + invalid: ['LV 12345678901', '1234567890'], }); test({ - validator: "isVAT", - args: ["LT"], + validator: 'isVAT', + args: ['LT'], valid: [ - "LT123456789012", - "123456789012", - "LT12345678901", - "12345678901", - "LT1234567890", - "1234567890", - "LT123456789", - "123456789", + 'LT123456789012', + '123456789012', + 'LT12345678901', + '12345678901', + 'LT1234567890', + '1234567890', + 'LT123456789', + '123456789', ], - invalid: ["LT 123456789012", "12345678"], + invalid: ['LT 123456789012', '12345678'], }); test({ - validator: "isVAT", - args: ["LU"], - valid: ["LU12345678", "12345678"], - invalid: ["LU 12345678", "1234567"], + validator: 'isVAT', + args: ['LU'], + valid: ['LU12345678', '12345678'], + invalid: ['LU 12345678', '1234567'], }); test({ - validator: "isVAT", - args: ["MT"], - valid: ["MT12345678", "12345678"], - invalid: ["MT 12345678", "1234567"], + validator: 'isVAT', + args: ['MT'], + valid: ['MT12345678', '12345678'], + invalid: ['MT 12345678', '1234567'], }); test({ - validator: "isVAT", - args: ["NL"], - valid: ["NL123456789B10", "123456789B10"], + validator: 'isVAT', + args: ['NL'], + valid: ['NL123456789B10', '123456789B10'], invalid: [ - "NL12345678 910", - "NL 123456789101", - "NL123456789B1", - "GB12345678910", - "NL123456789", + 'NL12345678 910', + 'NL 123456789101', + 'NL123456789B1', + 'GB12345678910', + 'NL123456789', ], }); test({ - validator: "isVAT", - args: ["PL"], + validator: 'isVAT', + args: ['PL'], valid: [ - "PL1234567890", - "1234567890", - "PL123-456-78-90", - "123-456-78-90", - "PL123-45-67-890", - "123-45-67-890", + 'PL1234567890', + '1234567890', + 'PL123-456-78-90', + '123-456-78-90', + 'PL123-45-67-890', + '123-45-67-890', ], - invalid: ["PL 1234567890", "123456789"], + invalid: ['PL 1234567890', '123456789'], }); test({ - validator: "isVAT", - args: ["PT"], - valid: ["PT123456789", "123456789"], - invalid: ["PT 123456789", "000000001"], + validator: 'isVAT', + args: ['PT'], + valid: ['PT123456789', '123456789'], + invalid: ['PT 123456789', '000000001'], }); test({ - validator: "isVAT", - args: ["RO"], - valid: ["RO1234567890", "1234567890", "RO12", "12"], - invalid: ["RO 12", "1"], + validator: 'isVAT', + args: ['RO'], + valid: ['RO1234567890', '1234567890', 'RO12', '12'], + invalid: ['RO 12', '1'], }); test({ - validator: "isVAT", - args: ["SK"], - valid: ["SK1234567890", "1234567890"], - invalid: ["SK 1234567890", "123456789"], + validator: 'isVAT', + args: ['SK'], + valid: ['SK1234567890', '1234567890'], + invalid: ['SK 1234567890', '123456789'], }); test({ - validator: "isVAT", - args: ["SI"], - valid: ["SI12345678", "12345678"], - invalid: ["SI 12345678", "1234567"], + validator: 'isVAT', + args: ['SI'], + valid: ['SI12345678', '12345678'], + invalid: ['SI 12345678', '1234567'], }); test({ - validator: "isVAT", - args: ["ES"], - valid: ["ESA1234567A", "A1234567A"], - invalid: ["ES 1234567A", "123456789"], + validator: 'isVAT', + args: ['ES'], + valid: ['ESA1234567A', 'A1234567A'], + invalid: ['ES 1234567A', '123456789'], }); test({ - validator: "isVAT", - args: ["SE"], - valid: ["SE123456789012", "123456789012"], - invalid: ["SE 123456789012", "12345678901"], + validator: 'isVAT', + args: ['SE'], + valid: ['SE123456789012', '123456789012'], + invalid: ['SE 123456789012', '12345678901'], }); test({ - validator: "isVAT", - args: ["AL"], - valid: ["AL123456789A", "123456789A"], - invalid: ["AL 123456789A", "123456789"], + validator: 'isVAT', + args: ['AL'], + valid: ['AL123456789A', '123456789A'], + invalid: ['AL 123456789A', '123456789'], }); test({ - validator: "isVAT", - args: ["MK"], - valid: ["MK1234567890123", "1234567890123"], - invalid: ["MK 1234567890123", "123456789012"], + validator: 'isVAT', + args: ['MK'], + valid: ['MK1234567890123', '1234567890123'], + invalid: ['MK 1234567890123', '123456789012'], }); test({ - validator: "isVAT", - args: ["AU"], - valid: ["AU12345678901", "12345678901"], - invalid: ["AU 12345678901", "1234567890"], + validator: 'isVAT', + args: ['AU'], + valid: ['AU12345678901', '12345678901'], + invalid: ['AU 12345678901', '1234567890'], }); test({ - validator: "isVAT", - args: ["BY"], - valid: ["УНП 123456789", "123456789"], - invalid: ["BY 123456789", "12345678"], + validator: 'isVAT', + args: ['BY'], + valid: ['УНП 123456789', '123456789'], + invalid: ['BY 123456789', '12345678'], }); test({ - validator: "isVAT", - args: ["CA"], - valid: ["CA123456789", "123456789"], - invalid: ["CA 123456789", "12345678"], + validator: 'isVAT', + args: ['CA'], + valid: ['CA123456789', '123456789'], + invalid: ['CA 123456789', '12345678'], }); test({ - validator: "isVAT", - args: ["IS"], - valid: ["IS123456", "12345"], - invalid: ["IS 12345", "1234"], + validator: 'isVAT', + args: ['IS'], + valid: ['IS123456', '12345'], + invalid: ['IS 12345', '1234'], }); test({ - validator: "isVAT", - args: ["IN"], - valid: ["IN123456789012345", "123456789012345"], - invalid: ["IN 123456789012345", "12345678901234"], + validator: 'isVAT', + args: ['IN'], + valid: ['IN123456789012345', '123456789012345'], + invalid: ['IN 123456789012345', '12345678901234'], }); test({ - validator: "isVAT", - args: ["ID"], + validator: 'isVAT', + args: ['ID'], valid: [ - "ID123456789012345", - "123456789012345", - "ID12.345.678.9-012.345", - "12.345.678.9-012.345", + 'ID123456789012345', + '123456789012345', + 'ID12.345.678.9-012.345', + '12.345.678.9-012.345', ], - invalid: ["ID 123456789012345", "12345678901234"], + invalid: ['ID 123456789012345', '12345678901234'], }); test({ - validator: "isVAT", - args: ["IL"], - valid: ["IL123456789", "123456789"], - invalid: ["IL 123456789", "12345678"], + validator: 'isVAT', + args: ['IL'], + valid: ['IL123456789', '123456789'], + invalid: ['IL 123456789', '12345678'], }); test({ - validator: "isVAT", - args: ["KZ"], - valid: ["KZ123456789", "123456789"], - invalid: ["KZ 123456789", "12345678"], + validator: 'isVAT', + args: ['KZ'], + valid: ['KZ123456789', '123456789'], + invalid: ['KZ 123456789', '12345678'], }); test({ - validator: "isVAT", - args: ["NZ"], - valid: ["NZ123456789", "123456789"], - invalid: ["NZ 123456789", "12345678"], + validator: 'isVAT', + args: ['NZ'], + valid: ['NZ123456789', '123456789'], + invalid: ['NZ 123456789', '12345678'], }); test({ - validator: "isVAT", - args: ["NG"], + validator: 'isVAT', + args: ['NG'], valid: [ - "NG123456789012", - "123456789012", - "NG12345678-9012", - "12345678-9012", + 'NG123456789012', + '123456789012', + 'NG12345678-9012', + '12345678-9012', ], - invalid: ["NG 123456789012", "12345678901"], + invalid: ['NG 123456789012', '12345678901'], }); test({ - validator: "isVAT", - args: ["NO"], - valid: ["NO123456789MVA", "123456789MVA"], - invalid: ["NO 123456789MVA", "123456789"], + validator: 'isVAT', + args: ['NO'], + valid: ['NO123456789MVA', '123456789MVA'], + invalid: ['NO 123456789MVA', '123456789'], }); test({ - validator: "isVAT", - args: ["PH"], + validator: 'isVAT', + args: ['PH'], valid: [ - "PH123456789012", - "123456789012", - "PH123 456 789 012", - "123 456 789 012", + 'PH123456789012', + '123456789012', + 'PH123 456 789 012', + '123 456 789 012', ], - invalid: ["PH 123456789012", "12345678901"], + invalid: ['PH 123456789012', '12345678901'], }); test({ - validator: "isVAT", - args: ["RU"], - valid: ["RU1234567890", "1234567890", "RU123456789012", "123456789012"], - invalid: ["RU 123456789012", "12345678901"], + validator: 'isVAT', + args: ['RU'], + valid: ['RU1234567890', '1234567890', 'RU123456789012', '123456789012'], + invalid: ['RU 123456789012', '12345678901'], }); test({ - validator: "isVAT", - args: ["SM"], - valid: ["SM12345", "12345"], - invalid: ["SM 12345", "1234"], + validator: 'isVAT', + args: ['SM'], + valid: ['SM12345', '12345'], + invalid: ['SM 12345', '1234'], }); test({ - validator: "isVAT", - args: ["SA"], - valid: ["SA123456789012345", "123456789012345"], - invalid: ["SA 123456789012345", "12345678901234"], + validator: 'isVAT', + args: ['SA'], + valid: ['SA123456789012345', '123456789012345'], + invalid: ['SA 123456789012345', '12345678901234'], }); test({ - validator: "isVAT", - args: ["RS"], - valid: ["RS123456789", "123456789"], - invalid: ["RS 123456789", "12345678"], + validator: 'isVAT', + args: ['RS'], + valid: ['RS123456789', '123456789'], + invalid: ['RS 123456789', '12345678'], }); test({ - validator: "isVAT", - args: ["CH"], + validator: 'isVAT', + args: ['CH'], valid: [ // strictly valid - "CHE-116.281.710 MWST", - "CHE-116.281.710 IVA", - "CHE-116.281.710 TVA", + 'CHE-116.281.710 MWST', + 'CHE-116.281.710 IVA', + 'CHE-116.281.710 TVA', // loosely valid presentation variants - "CHE 116 281 710 IVA", // all separators are spaces - "CHE-191.398.369MWST", // no space before suffix - "CHE-116281710 MWST", // no number separators - "CHE-116281710MWST", // no number separators and no space before suffix - "CHE105854263MWST", // no separators - "CHE-116.285.524", // no suffix (vat abbreviation) - "CHE116281710", // no suffix and separators - "116.281.710 TVA", // no prefix (CHE, ISO-3166-1 Alpha-3) - "116281710MWST", // no prefix and separators - "100.218.485", // no prefix and suffix - "123456788", // no prefix, separators and suffix + 'CHE 116 281 710 IVA', // all separators are spaces + 'CHE-191.398.369MWST', // no space before suffix + 'CHE-116281710 MWST', // no number separators + 'CHE-116281710MWST', // no number separators and no space before suffix + 'CHE105854263MWST', // no separators + 'CHE-116.285.524', // no suffix (vat abbreviation) + 'CHE116281710', // no suffix and separators + '116.281.710 TVA', // no prefix (CHE, ISO-3166-1 Alpha-3) + '116281710MWST', // no prefix and separators + '100.218.485', // no prefix and suffix + '123456788', // no prefix, separators and suffix ], invalid: [ - "CH-116.281.710 MWST", // invalid prefix (should be CHE) - "CHE-116.281 MWST", // invalid number of digits (should be 9) - "CHE-123.456.789 MWST", // invalid last digit (should match the calculated check-number 8) - "CHE-123.356.780 MWST", // invalid check-number (there are no swiss UIDs with the calculated check number 10) - "CH-116.281.710 VAT", // invalid suffix (should be MWST, IVA or TVA) - "CHE-116/281/710 IVA", // invalid number separators (should be all dots or all spaces) + 'CH-116.281.710 MWST', // invalid prefix (should be CHE) + 'CHE-116.281 MWST', // invalid number of digits (should be 9) + 'CHE-123.456.789 MWST', // invalid last digit (should match the calculated check-number 8) + 'CHE-123.356.780 MWST', // invalid check-number (there are no swiss UIDs with the calculated check number 10) + 'CH-116.281.710 VAT', // invalid suffix (should be MWST, IVA or TVA) + 'CHE-116/281/710 IVA', // invalid number separators (should be all dots or all spaces) ], }); test({ - validator: "isVAT", - args: ["TR"], - valid: ["TR1234567890", "1234567890"], - invalid: ["TR 1234567890", "123456789"], + validator: 'isVAT', + args: ['TR'], + valid: ['TR1234567890', '1234567890'], + invalid: ['TR 1234567890', '123456789'], }); test({ - validator: "isVAT", - args: ["UA"], - valid: ["UA123456789012", "123456789012"], - invalid: ["UA 123456789012", "12345678901"], + validator: 'isVAT', + args: ['UA'], + valid: ['UA123456789012', '123456789012'], + invalid: ['UA 123456789012', '12345678901'], }); test({ - validator: "isVAT", - args: ["GB"], + validator: 'isVAT', + args: ['GB'], valid: [ - "GB999 9999 00", - "GB999 9999 96", - "GB999999999 999", - "GBGD000", - "GBGD499", - "GBHA500", - "GBHA999", + 'GB999 9999 00', + 'GB999 9999 96', + 'GB999999999 999', + 'GBGD000', + 'GBGD499', + 'GBHA500', + 'GBHA999', ], invalid: [ - "GB999999900", - "GB999999996", - "GB999 9999 97", - "GB999999999999", - "GB999999999 9999", - "GB9999999999 999", - "GBGD 000", - "GBGD 499", - "GBHA 500", - "GBHA 999", - "GBGD500", - "GBGD999", - "GBHA000", - "GBHA499", + 'GB999999900', + 'GB999999996', + 'GB999 9999 97', + 'GB999999999999', + 'GB999999999 9999', + 'GB9999999999 999', + 'GBGD 000', + 'GBGD 499', + 'GBHA 500', + 'GBHA 999', + 'GBGD500', + 'GBGD999', + 'GBHA000', + 'GBHA499', ], }); test({ - validator: "isVAT", - args: ["UZ"], - valid: ["UZ123456789", "123456789"], - invalid: ["UZ 123456789", "12345678"], + validator: 'isVAT', + args: ['UZ'], + valid: ['UZ123456789', '123456789'], + invalid: ['UZ 123456789', '12345678'], }); test({ - validator: "isVAT", - args: ["AR"], - valid: ["AR12345678901", "12345678901"], - invalid: ["AR 12345678901", "1234567890"], + validator: 'isVAT', + args: ['AR'], + valid: ['AR12345678901', '12345678901'], + invalid: ['AR 12345678901', '1234567890'], }); test({ - validator: "isVAT", - args: ["BO"], - valid: ["BO1234567", "1234567"], - invalid: ["BO 1234567", "123456"], + validator: 'isVAT', + args: ['BO'], + valid: ['BO1234567', '1234567'], + invalid: ['BO 1234567', '123456'], }); test({ - validator: "isVAT", - args: ["BR"], + validator: 'isVAT', + args: ['BR'], valid: [ - "BR12.345.678/9012-34", - "12.345.678/9012-34", - "BR123.456.789-01", - "123.456.789-01", + 'BR12.345.678/9012-34', + '12.345.678/9012-34', + 'BR123.456.789-01', + '123.456.789-01', ], - invalid: ["BR 12.345.678/9012-34", "12345678901234"], + invalid: ['BR 12.345.678/9012-34', '12345678901234'], }); test({ - validator: "isVAT", - args: ["CL"], - valid: ["CL12345678-9", "12345678-9"], - invalid: ["CL 12345678-9", "12345678"], + validator: 'isVAT', + args: ['CL'], + valid: ['CL12345678-9', '12345678-9'], + invalid: ['CL 12345678-9', '12345678'], }); test({ - validator: "isVAT", - args: ["CO"], - valid: ["CO1234567890", "1234567890"], - invalid: ["CO 1234567890", "123456789"], + validator: 'isVAT', + args: ['CO'], + valid: ['CO1234567890', '1234567890'], + invalid: ['CO 1234567890', '123456789'], }); test({ - validator: "isVAT", - args: ["CR"], - valid: ["CR123456789012", "123456789012", "CR123456789", "123456789"], - invalid: ["CR 123456789", "12345678"], + validator: 'isVAT', + args: ['CR'], + valid: ['CR123456789012', '123456789012', 'CR123456789', '123456789'], + invalid: ['CR 123456789', '12345678'], }); test({ - validator: "isVAT", - args: ["EC"], - valid: ["EC1234567890123", "1234567890123"], - invalid: ["EC 1234567890123", "123456789012"], + validator: 'isVAT', + args: ['EC'], + valid: ['EC1234567890123', '1234567890123'], + invalid: ['EC 1234567890123', '123456789012'], }); test({ - validator: "isVAT", - args: ["SV"], - valid: ["SV1234-567890-123-1", "1234-567890-123-1"], - invalid: ["SV 1234-567890-123-1", "1234567890123"], + validator: 'isVAT', + args: ['SV'], + valid: ['SV1234-567890-123-1', '1234-567890-123-1'], + invalid: ['SV 1234-567890-123-1', '1234567890123'], }); test({ - validator: "isVAT", - args: ["GT"], - valid: ["GT1234567-8", "1234567-8"], - invalid: ["GT 1234567-8", "1234567"], + validator: 'isVAT', + args: ['GT'], + valid: ['GT1234567-8', '1234567-8'], + invalid: ['GT 1234567-8', '1234567'], }); test({ - validator: "isVAT", - args: ["HN"], - valid: ["HN"], - invalid: ["HN "], + validator: 'isVAT', + args: ['HN'], + valid: ['HN'], + invalid: ['HN '], }); test({ - validator: "isVAT", - args: ["MX"], + validator: 'isVAT', + args: ['MX'], valid: [ - "MXABCD123456EFG", - "ABCD123456EFG", - "MXABC123456DEF", - "ABC123456DEF", + 'MXABCD123456EFG', + 'ABCD123456EFG', + 'MXABC123456DEF', + 'ABC123456DEF', ], - invalid: ["MX ABC123456EFG", "123456"], + invalid: ['MX ABC123456EFG', '123456'], }); test({ - validator: "isVAT", - args: ["NI"], - valid: ["NI123-456789-0123A", "123-456789-0123A"], - invalid: ["NI 123-456789-0123A", "1234567890123"], + validator: 'isVAT', + args: ['NI'], + valid: ['NI123-456789-0123A', '123-456789-0123A'], + invalid: ['NI 123-456789-0123A', '1234567890123'], }); test({ - validator: "isVAT", - args: ["PA"], - valid: ["PA"], - invalid: ["PA "], + validator: 'isVAT', + args: ['PA'], + valid: ['PA'], + invalid: ['PA '], }); test({ - validator: "isVAT", - args: ["PY"], - valid: ["PY12345678-9", "12345678-9", "PY123456-7", "123456-7"], - invalid: ["PY 123456-7", "123456"], + validator: 'isVAT', + args: ['PY'], + valid: ['PY12345678-9', '12345678-9', 'PY123456-7', '123456-7'], + invalid: ['PY 123456-7', '123456'], }); test({ - validator: "isVAT", - args: ["PE"], - valid: ["PE12345678901", "12345678901"], - invalid: ["PE 12345678901", "1234567890"], + validator: 'isVAT', + args: ['PE'], + valid: ['PE12345678901', '12345678901'], + invalid: ['PE 12345678901', '1234567890'], }); test({ - validator: "isVAT", - args: ["DO"], + validator: 'isVAT', + args: ['DO'], valid: [ - "DO12345678901", - "12345678901", - "DO123-4567890-1", - "123-4567890-1", - "DO123456789", - "123456789", - "DO1-23-45678-9", - "1-23-45678-9", + 'DO12345678901', + '12345678901', + 'DO123-4567890-1', + '123-4567890-1', + 'DO123456789', + '123456789', + 'DO1-23-45678-9', + '1-23-45678-9', ], - invalid: ["DO 12345678901", "1234567890"], + invalid: ['DO 12345678901', '1234567890'], }); test({ - validator: "isVAT", - args: ["UY"], - valid: ["UY123456789012", "123456789012"], - invalid: ["UY 123456789012", "12345678901"], + validator: 'isVAT', + args: ['UY'], + valid: ['UY123456789012', '123456789012'], + invalid: ['UY 123456789012', '12345678901'], }); test({ - validator: "isVAT", - args: ["VE"], - valid: ["VEJ-123456789", "J-123456789", "VEJ-12345678-9", "J-12345678-9"], - invalid: ["VE J-123456789", "12345678"], + validator: 'isVAT', + args: ['VE'], + valid: ['VEJ-123456789', 'J-123456789', 'VEJ-12345678-9', 'J-12345678-9'], + invalid: ['VE J-123456789', '12345678'], }); test({ - validator: "isVAT", - args: ["invalidCountryCode"], - error: ["GB999 9999 00"], + validator: 'isVAT', + args: ['invalidCountryCode'], + error: ['GB999 9999 00'], }); }); - it("should validate mailto URI", () => { + it('should validate mailto URI', () => { test({ - validator: "isMailtoURI", + validator: 'isMailtoURI', valid: [ - "mailto:?subject=something&cc=valid@mail.com", - "mailto:?subject=something&cc=valid@mail.com,another@mail.com,", - "mailto:?subject=something&bcc=valid@mail.com", - "mailto:?subject=something&bcc=valid@mail.com,another@mail.com", - "mailto:?bcc=valid@mail.com,another@mail.com", - "mailto:?cc=valid@mail.com,another@mail.com", - "mailto:?cc=valid@mail.com", - "mailto:?bcc=valid@mail.com", - "mailto:?subject=something&body=something else", - "mailto:?subject=something&body=something else&cc=hello@mail.com,another@mail.com", - "mailto:?subject=something&body=something else&bcc=hello@mail.com,another@mail.com", - "mailto:?subject=something&body=something else&cc=something@mail.com&bcc=hello@mail.com,another@mail.com", - "mailto:hello@mail.com", - "mailto:info@mail.com?", - "mailto:hey@mail.com?subject=something", - "mailto:info@mail.com?subject=something&cc=valid@mail.com", - "mailto:info@mail.com?subject=something&cc=valid@mail.com,another@mail.com,", - "mailto:info@mail.com?subject=something&bcc=valid@mail.com", - "mailto:info@mail.com?subject=something&bcc=valid@mail.com,another@mail.com", - "mailto:info@mail.com?bcc=valid@mail.com,another@mail.com", - "mailto:info@mail.com?cc=valid@mail.com,another@mail.com", - "mailto:info@mail.com?cc=valid@mail.com", - "mailto:info@mail.com?bcc=valid@mail.com&", - "mailto:info@mail.com?subject=something&body=something else", - "mailto:info@mail.com?subject=something&body=something else&cc=hello@mail.com,another@mail.com", - "mailto:info@mail.com?subject=something&body=something else&bcc=hello@mail.com,another@mail.com", - "mailto:info@mail.com?subject=something&body=something else&cc=something@mail.com&bcc=hello@mail.com,another@mail.com", - "mailto:", - ], - invalid: [ - "", - "somthing", - "valid@gmail.com", - "mailto:?subject=okay&subject=444", - "mailto:?subject=something&wrong=888", - "mailto:somename@gmail.com", - "mailto:hello@world.com?cc=somename@gmail.com", - "mailto:hello@world.com?bcc=somename@gmail.com", - "mailto:hello@world.com?bcc=somename@gmail.com&bcc", - "mailto:valid@gmail.com?subject=anything&body=nothing&cc=&bcc=&key=", - "mailto:hello@world.com?cc=somename", - "mailto:somename", - "mailto:info@mail.com?subject=something&body=something else&cc=something@mail.com&bcc=hello@mail.com,another@mail.com&", - "mailto:?subject=something&body=something else&cc=something@mail.com&bcc=hello@mail.com,another@mail.com&", + 'mailto:?subject=something&cc=valid@mail.com', + 'mailto:?subject=something&cc=valid@mail.com,another@mail.com,', + 'mailto:?subject=something&bcc=valid@mail.com', + 'mailto:?subject=something&bcc=valid@mail.com,another@mail.com', + 'mailto:?bcc=valid@mail.com,another@mail.com', + 'mailto:?cc=valid@mail.com,another@mail.com', + 'mailto:?cc=valid@mail.com', + 'mailto:?bcc=valid@mail.com', + 'mailto:?subject=something&body=something else', + 'mailto:?subject=something&body=something else&cc=hello@mail.com,another@mail.com', + 'mailto:?subject=something&body=something else&bcc=hello@mail.com,another@mail.com', + 'mailto:?subject=something&body=something else&cc=something@mail.com&bcc=hello@mail.com,another@mail.com', + 'mailto:hello@mail.com', + 'mailto:info@mail.com?', + 'mailto:hey@mail.com?subject=something', + 'mailto:info@mail.com?subject=something&cc=valid@mail.com', + 'mailto:info@mail.com?subject=something&cc=valid@mail.com,another@mail.com,', + 'mailto:info@mail.com?subject=something&bcc=valid@mail.com', + 'mailto:info@mail.com?subject=something&bcc=valid@mail.com,another@mail.com', + 'mailto:info@mail.com?bcc=valid@mail.com,another@mail.com', + 'mailto:info@mail.com?cc=valid@mail.com,another@mail.com', + 'mailto:info@mail.com?cc=valid@mail.com', + 'mailto:info@mail.com?bcc=valid@mail.com&', + 'mailto:info@mail.com?subject=something&body=something else', + 'mailto:info@mail.com?subject=something&body=something else&cc=hello@mail.com,another@mail.com', + 'mailto:info@mail.com?subject=something&body=something else&bcc=hello@mail.com,another@mail.com', + 'mailto:info@mail.com?subject=something&body=something else&cc=something@mail.com&bcc=hello@mail.com,another@mail.com', + 'mailto:', + ], + invalid: [ + '', + 'somthing', + 'valid@gmail.com', + 'mailto:?subject=okay&subject=444', + 'mailto:?subject=something&wrong=888', + 'mailto:somename@gmail.com', + 'mailto:hello@world.com?cc=somename@gmail.com', + 'mailto:hello@world.com?bcc=somename@gmail.com', + 'mailto:hello@world.com?bcc=somename@gmail.com&bcc', + 'mailto:valid@gmail.com?subject=anything&body=nothing&cc=&bcc=&key=', + 'mailto:hello@world.com?cc=somename', + 'mailto:somename', + 'mailto:info@mail.com?subject=something&body=something else&cc=something@mail.com&bcc=hello@mail.com,another@mail.com&', + 'mailto:?subject=something&body=something else&cc=something@mail.com&bcc=hello@mail.com,another@mail.com&', ], }); }); diff --git a/test/validators/isFQDN.test.js b/test/validators/isFQDN.test.js index 1ec999007..d9123538c 100644 --- a/test/validators/isFQDN.test.js +++ b/test/validators/isFQDN.test.js @@ -5,22 +5,14 @@ describe('isFQDN', () => { test({ validator: 'isFQDN', args: [], - valid: [ - 'google.com', - ], - invalid: [ - 'google.l33t', - ], + valid: ['google.com'], + invalid: ['google.l33t'], }); test({ validator: 'isFQDN', args: [{ allow_numeric_tld: true }], - valid: [ - 'google.com', - 'google.l33t', - ], - invalid: [ - ], + valid: ['google.com', 'google.l33t'], + invalid: [], }); }); }); diff --git a/test/validators/isISBN.test.js b/test/validators/isISBN.test.js index b9e0a800b..ef3086af4 100644 --- a/test/validators/isISBN.test.js +++ b/test/validators/isISBN.test.js @@ -6,50 +6,68 @@ describe('isISBN', () => { validator: 'isISBN', args: [{ version: 10 }], valid: [ - '3836221195', '3-8362-2119-5', '3 8362 2119 5', - '1617290858', '1-61729-085-8', '1 61729 085-8', - '0007269706', '0-00-726970-6', '0 00 726970 6', - '3423214120', '3-423-21412-0', '3 423 21412 0', - '340101319X', '3-401-01319-X', '3 401 01319 X', + '3836221195', + '3-8362-2119-5', + '3 8362 2119 5', + '1617290858', + '1-61729-085-8', + '1 61729 085-8', + '0007269706', + '0-00-726970-6', + '0 00 726970 6', + '3423214120', + '3-423-21412-0', + '3 423 21412 0', + '340101319X', + '3-401-01319-X', + '3 401 01319 X', ], invalid: [ - '3423214121', '3-423-21412-1', '3 423 21412 1', - '978-3836221191', '9783836221191', - '123456789a', 'foo', '', + '3423214121', + '3-423-21412-1', + '3 423 21412 1', + '978-3836221191', + '9783836221191', + '123456789a', + 'foo', + '', ], }); test({ validator: 'isISBN', args: [{ version: 13 }], valid: [ - '9783836221191', '978-3-8362-2119-1', '978 3 8362 2119 1', - '9783401013190', '978-3401013190', '978 3401013190', - '9784873113685', '978-4-87311-368-5', '978 4 87311 368 5', + '9783836221191', + '978-3-8362-2119-1', + '978 3 8362 2119 1', + '9783401013190', + '978-3401013190', + '978 3401013190', + '9784873113685', + '978-4-87311-368-5', + '978 4 87311 368 5', ], invalid: [ - '9783836221190', '978-3-8362-2119-0', '978 3 8362 2119 0', - '3836221195', '3-8362-2119-5', '3 8362 2119 5', - '01234567890ab', 'foo', '', + '9783836221190', + '978-3-8362-2119-0', + '978 3 8362 2119 0', + '3836221195', + '3-8362-2119-5', + '3 8362 2119 5', + '01234567890ab', + 'foo', + '', ], }); test({ validator: 'isISBN', - valid: [ - '340101319X', - '9784873113685', - ], - invalid: [ - '3423214121', - '9783836221190', - ], + valid: ['340101319X', '9784873113685'], + invalid: ['3423214121', '9783836221190'], }); test({ validator: 'isISBN', args: [{ version: 'foo' }], - invalid: [ - '340101319X', - '9784873113685', - ], + invalid: ['340101319X', '9784873113685'], }); }); @@ -59,50 +77,68 @@ describe('isISBN', () => { validator: 'isISBN', args: [10], valid: [ - '3836221195', '3-8362-2119-5', '3 8362 2119 5', - '1617290858', '1-61729-085-8', '1 61729 085-8', - '0007269706', '0-00-726970-6', '0 00 726970 6', - '3423214120', '3-423-21412-0', '3 423 21412 0', - '340101319X', '3-401-01319-X', '3 401 01319 X', + '3836221195', + '3-8362-2119-5', + '3 8362 2119 5', + '1617290858', + '1-61729-085-8', + '1 61729 085-8', + '0007269706', + '0-00-726970-6', + '0 00 726970 6', + '3423214120', + '3-423-21412-0', + '3 423 21412 0', + '340101319X', + '3-401-01319-X', + '3 401 01319 X', ], invalid: [ - '3423214121', '3-423-21412-1', '3 423 21412 1', - '978-3836221191', '9783836221191', - '123456789a', 'foo', '', + '3423214121', + '3-423-21412-1', + '3 423 21412 1', + '978-3836221191', + '9783836221191', + '123456789a', + 'foo', + '', ], }); test({ validator: 'isISBN', args: [13], valid: [ - '9783836221191', '978-3-8362-2119-1', '978 3 8362 2119 1', - '9783401013190', '978-3401013190', '978 3401013190', - '9784873113685', '978-4-87311-368-5', '978 4 87311 368 5', + '9783836221191', + '978-3-8362-2119-1', + '978 3 8362 2119 1', + '9783401013190', + '978-3401013190', + '978 3401013190', + '9784873113685', + '978-4-87311-368-5', + '978 4 87311 368 5', ], invalid: [ - '9783836221190', '978-3-8362-2119-0', '978 3 8362 2119 0', - '3836221195', '3-8362-2119-5', '3 8362 2119 5', - '01234567890ab', 'foo', '', + '9783836221190', + '978-3-8362-2119-0', + '978 3 8362 2119 0', + '3836221195', + '3-8362-2119-5', + '3 8362 2119 5', + '01234567890ab', + 'foo', + '', ], }); test({ validator: 'isISBN', - valid: [ - '340101319X', - '9784873113685', - ], - invalid: [ - '3423214121', - '9783836221190', - ], + valid: ['340101319X', '9784873113685'], + invalid: ['3423214121', '9783836221190'], }); test({ validator: 'isISBN', args: ['foo'], - invalid: [ - '340101319X', - '9784873113685', - ], + invalid: ['340101319X', '9784873113685'], }); }); }); From bee7b91fb607fc313c16c89e16b4ea68cb2f2df2 Mon Sep 17 00:00:00 2001 From: Henk Bakker Date: Fri, 5 Jan 2024 15:21:22 +0100 Subject: [PATCH 11/12] trailing comma --- .prettierrc | 3 ++- src/lib/isAlpha.js | 4 ++-- src/lib/isAlphanumeric.js | 4 ++-- src/lib/isDate.js | 6 +++--- src/lib/isDecimal.js | 2 +- src/lib/isEAN.js | 3 +-- src/lib/isFQDN.js | 2 +- src/lib/isFloat.js | 2 +- src/lib/isIBAN.js | 4 ++-- src/lib/isIP.js | 2 +- src/lib/isIdentityCard.js | 6 +++--- src/lib/isJWT.js | 2 +- src/lib/isLicensePlate.js | 12 ++++++------ src/lib/isLocale.js | 2 +- src/lib/isNumeric.js | 2 +- src/lib/isRFC3339.js | 4 ++-- src/lib/isSemVer.js | 2 +- src/lib/isTaxID.js | 8 ++++---- src/lib/isVAT.js | 12 ++++++------ src/lib/rtrim.js | 2 +- test/clientSide.test.js | 4 ++-- test/exports.test.js | 2 +- test/sanitizers.test.js | 2 +- test/testFunctions.js | 6 +++--- test/validators.test.js | 2 +- 25 files changed, 50 insertions(+), 50 deletions(-) diff --git a/.prettierrc b/.prettierrc index 544138be4..c1a6f6671 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,3 +1,4 @@ { - "singleQuote": true + "singleQuote": true, + "trailingComma": "es5" } diff --git a/src/lib/isAlpha.js b/src/lib/isAlpha.js index 40ef9f1f0..2eb2b20ea 100644 --- a/src/lib/isAlpha.js +++ b/src/lib/isAlpha.js @@ -14,9 +14,9 @@ export default function isAlpha(_str, locale = 'en-US', options = {}) { str = str.replace( new RegExp( `[${ignore.replace(/[-[\]{}()*+?.,\\^$|#\\s]/g, '\\$&')}]`, - 'g', + 'g' ), - '', + '' ); // escape regex for ignore } else { throw new Error('ignore should be instance of a String or RegExp'); diff --git a/src/lib/isAlphanumeric.js b/src/lib/isAlphanumeric.js index 7e94420f9..01abcb1d2 100644 --- a/src/lib/isAlphanumeric.js +++ b/src/lib/isAlphanumeric.js @@ -14,9 +14,9 @@ export default function isAlphanumeric(_str, locale = 'en-US', options = {}) { str = str.replace( new RegExp( `[${ignore.replace(/[-[\]{}()*+?.,\\^$|#\\s]/g, '\\$&')}]`, - 'g', + 'g' ), - '', + '' ); // escape regex for ignore } else { throw new Error('ignore should be instance of a String or RegExp'); diff --git a/src/lib/isDate.js b/src/lib/isDate.js index 462333810..c37630396 100644 --- a/src/lib/isDate.js +++ b/src/lib/isDate.js @@ -8,7 +8,7 @@ const default_date_options = { function isValidFormat(format) { return /(^(y{4}|y{2})[.\/-](m{1,2})[.\/-](d{1,2})$)|(^(m{1,2})[.\/-](d{1,2})[.\/-]((y{4}|y{2})$))|(^(d{1,2})[.\/-](m{1,2})[.\/-]((y{4}|y{2})$))/gi.test( - format, + format ); } @@ -32,14 +32,14 @@ export default function isDate(input, options) { } if (typeof input === 'string' && isValidFormat(options.format)) { const formatDelimiter = options.delimiters.find( - (delimiter) => options.format.indexOf(delimiter) !== -1, + (delimiter) => options.format.indexOf(delimiter) !== -1 ); const dateDelimiter = options.strictMode ? formatDelimiter : options.delimiters.find((delimiter) => input.indexOf(delimiter) !== -1); const dateAndFormat = zip( input.split(dateDelimiter), - options.format.toLowerCase().split(formatDelimiter), + options.format.toLowerCase().split(formatDelimiter) ); const dateObj = {}; diff --git a/src/lib/isDecimal.js b/src/lib/isDecimal.js index e1536882e..f8fb29f73 100644 --- a/src/lib/isDecimal.js +++ b/src/lib/isDecimal.js @@ -7,7 +7,7 @@ function decimalRegExp(options) { const regExp = new RegExp( `^[-+]?([0-9]+)?(\\${decimal[options.locale]}[0-9]{${ options.decimal_digits - }})${options.force_decimal ? '' : '?'}$`, + }})${options.force_decimal ? '' : '?'}$` ); return regExp; } diff --git a/src/lib/isEAN.js b/src/lib/isEAN.js index c3bbe4e7d..3e00acc45 100644 --- a/src/lib/isEAN.js +++ b/src/lib/isEAN.js @@ -52,8 +52,7 @@ function calculateCheckDigit(ean) { .split('') .map( (char, index) => - Number(char) * - getPositionWeightThroughLengthAndIndex(ean.length, index), + Number(char) * getPositionWeightThroughLengthAndIndex(ean.length, index) ) .reduce((acc, partialSum) => acc + partialSum, 0); diff --git a/src/lib/isFQDN.js b/src/lib/isFQDN.js index 7bce4be12..3d61aaab2 100644 --- a/src/lib/isFQDN.js +++ b/src/lib/isFQDN.js @@ -36,7 +36,7 @@ export default function isFQDN(str, options) { if ( !options.allow_numeric_tld && !/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i.test( - tld, + tld ) ) { return false; diff --git a/src/lib/isFloat.js b/src/lib/isFloat.js index 7466d3016..658c631cf 100644 --- a/src/lib/isFloat.js +++ b/src/lib/isFloat.js @@ -7,7 +7,7 @@ export default function isFloat(str, options) { const float = new RegExp( `^(?:[-+])?(?:[0-9]+)?(?:\\${ options.locale ? decimal[options.locale] : '.' - }[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$`, + }[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$` ); if (str === '' || str === '.' || str === ',' || str === '-' || str === '+') { return false; diff --git a/src/lib/isIBAN.js b/src/lib/isIBAN.js index 2d13b313b..1047068d8 100644 --- a/src/lib/isIBAN.js +++ b/src/lib/isIBAN.js @@ -97,7 +97,7 @@ const ibanRegexThroughCountryCode = { function hasOnlyValidCountryCodes(countryCodeArray) { const countryCodeArrayFilteredWithObjectIbanCode = countryCodeArray.filter( - (countryCode) => !(countryCode in ibanRegexThroughCountryCode), + (countryCode) => !(countryCode in ibanRegexThroughCountryCode) ); if (countryCodeArrayFilteredWithObjectIbanCode.length > 0) { @@ -173,7 +173,7 @@ function hasValidIbanChecksum(str) { const rearranged = strippedStr.slice(4) + strippedStr.slice(0, 4); const alphaCapsReplacedWithDigits = rearranged.replace( /[A-Z]/g, - (char) => char.charCodeAt(0) - 55, + (char) => char.charCodeAt(0) - 55 ); const remainder = alphaCapsReplacedWithDigits diff --git a/src/lib/isIP.js b/src/lib/isIP.js index f60f085da..15038d865 100644 --- a/src/lib/isIP.js +++ b/src/lib/isIP.js @@ -44,7 +44,7 @@ const IPv6AddressRegExp = new RegExp( `(?:${IPv6SegmentFormat}:){2}(?:(:${IPv6SegmentFormat}){0,3}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,5}|:)|` + `(?:${IPv6SegmentFormat}:){1}(?:(:${IPv6SegmentFormat}){0,4}:${IPv4AddressFormat}|(:${IPv6SegmentFormat}){1,6}|:)|` + `(?::((?::${IPv6SegmentFormat}){0,5}:${IPv4AddressFormat}|(?::${IPv6SegmentFormat}){1,7}|:))` + - ')(%[0-9a-zA-Z-.:]{1,})?$', + ')(%[0-9a-zA-Z-.:]{1,})?$' ); export default function isIP(str, version = '') { diff --git a/src/lib/isIdentityCard.js b/src/lib/isIdentityCard.js index e0c48a910..0f555dc85 100644 --- a/src/lib/isIdentityCard.js +++ b/src/lib/isIdentityCard.js @@ -28,7 +28,7 @@ const validators = { const digits = str.split('').slice(0, -1); const sum = digits.reduce( (acc, digit, index) => acc + Number(digit) * weightOfDigits[index + 1], - 0, + 0 ); const modulo = sum % 10; @@ -391,7 +391,7 @@ const validators = { const check15IdCardNo = (idCardNo) => { let check = /^[1-9]\d{7}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}$/.test( - idCardNo, + idCardNo ); if (!check) return false; let addressCode = idCardNo.substring(0, 2); @@ -406,7 +406,7 @@ const validators = { const check18IdCardNo = (idCardNo) => { let check = /^[1-9]\d{5}[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}(\d|x|X)$/.test( - idCardNo, + idCardNo ); if (!check) return false; let addressCode = idCardNo.substring(0, 2); diff --git a/src/lib/isJWT.js b/src/lib/isJWT.js index 039428e88..b8f9a11a7 100644 --- a/src/lib/isJWT.js +++ b/src/lib/isJWT.js @@ -13,6 +13,6 @@ export default function isJWT(str) { return dotSplit.reduce( (acc, currElem) => acc && isBase64(currElem, { urlSafe: true }), - true, + true ); } diff --git a/src/lib/isLicensePlate.js b/src/lib/isLicensePlate.js index 737ccd084..03e26b837 100644 --- a/src/lib/isLicensePlate.js +++ b/src/lib/isLicensePlate.js @@ -4,34 +4,34 @@ const validators = { 'cs-CZ': (str) => /^(([ABCDEFHIJKLMNPRSTUVXYZ]|[0-9])-?){5,8}$/.test(str), 'de-DE': (str) => /^((A|AA|AB|AC|AE|AH|AK|AM|AN|AÖ|AP|AS|AT|AU|AW|AZ|B|BA|BB|BC|BE|BF|BH|BI|BK|BL|BM|BN|BO|BÖ|BS|BT|BZ|C|CA|CB|CE|CO|CR|CW|D|DA|DD|DE|DH|DI|DL|DM|DN|DO|DU|DW|DZ|E|EA|EB|ED|EE|EF|EG|EH|EI|EL|EM|EN|ER|ES|EU|EW|F|FB|FD|FF|FG|FI|FL|FN|FO|FR|FS|FT|FÜ|FW|FZ|G|GA|GC|GD|GE|GF|GG|GI|GK|GL|GM|GN|GÖ|GP|GR|GS|GT|GÜ|GV|GW|GZ|H|HA|HB|HC|HD|HE|HF|HG|HH|HI|HK|HL|HM|HN|HO|HP|HR|HS|HU|HV|HX|HY|HZ|IK|IL|IN|IZ|J|JE|JL|K|KA|KB|KC|KE|KF|KG|KH|KI|KK|KL|KM|KN|KO|KR|KS|KT|KU|KW|KY|L|LA|LB|LC|LD|LF|LG|LH|LI|LL|LM|LN|LÖ|LP|LR|LU|M|MA|MB|MC|MD|ME|MG|MH|MI|MK|ML|MM|MN|MO|MQ|MR|MS|MÜ|MW|MY|MZ|N|NB|ND|NE|NF|NH|NI|NK|NM|NÖ|NP|NR|NT|NU|NW|NY|NZ|OA|OB|OC|OD|OE|OF|OG|OH|OK|OL|OP|OS|OZ|P|PA|PB|PE|PF|PI|PL|PM|PN|PR|PS|PW|PZ|R|RA|RC|RD|RE|RG|RH|RI|RL|RM|RN|RO|RP|RS|RT|RU|RV|RW|RZ|S|SB|SC|SE|SG|SI|SK|SL|SM|SN|SO|SP|SR|ST|SU|SW|SY|SZ|TE|TF|TG|TO|TP|TR|TS|TT|TÜ|ÜB|UE|UH|UL|UM|UN|V|VB|VG|VK|VR|VS|W|WA|WB|WE|WF|WI|WK|WL|WM|WN|WO|WR|WS|WT|WÜ|WW|WZ|Z|ZE|ZI|ZP|ZR|ZW|ZZ)[- ]?[A-Z]{1,2}[- ]?\d{1,4}|(ABG|ABI|AIB|AIC|ALF|ALZ|ANA|ANG|ANK|APD|ARN|ART|ASL|ASZ|AUR|AZE|BAD|BAR|BBG|BCH|BED|BER|BGD|BGL|BID|BIN|BIR|BIT|BIW|BKS|BLB|BLK|BNA|BOG|BOH|BOR|BOT|BRA|BRB|BRG|BRK|BRL|BRV|BSB|BSK|BTF|BÜD|BUL|BÜR|BÜS|BÜZ|CAS|CHA|CLP|CLZ|COC|COE|CUX|DAH|DAN|DAU|DBR|DEG|DEL|DGF|DIL|DIN|DIZ|DKB|DLG|DON|DUD|DÜW|EBE|EBN|EBS|ECK|EIC|EIL|EIN|EIS|EMD|EMS|ERB|ERH|ERK|ERZ|ESB|ESW|FDB|FDS|FEU|FFB|FKB|FLÖ|FOR|FRG|FRI|FRW|FTL|FÜS|GAN|GAP|GDB|GEL|GEO|GER|GHA|GHC|GLA|GMN|GNT|GOA|GOH|GRA|GRH|GRI|GRM|GRZ|GTH|GUB|GUN|GVM|HAB|HAL|HAM|HAS|HBN|HBS|HCH|HDH|HDL|HEB|HEF|HEI|HER|HET|HGN|HGW|HHM|HIG|HIP|HMÜ|HOG|HOH|HOL|HOM|HOR|HÖS|HOT|HRO|HSK|HST|HVL|HWI|IGB|ILL|JÜL|KEH|KEL|KEM|KIB|KLE|KLZ|KÖN|KÖT|KÖZ|KRU|KÜN|KUS|KYF|LAN|LAU|LBS|LBZ|LDK|LDS|LEO|LER|LEV|LIB|LIF|LIP|LÖB|LOS|LRO|LSZ|LÜN|LUP|LWL|MAB|MAI|MAK|MAL|MED|MEG|MEI|MEK|MEL|MER|MET|MGH|MGN|MHL|MIL|MKK|MOD|MOL|MON|MOS|MSE|MSH|MSP|MST|MTK|MTL|MÜB|MÜR|MYK|MZG|NAB|NAI|NAU|NDH|NEA|NEB|NEC|NEN|NES|NEW|NMB|NMS|NOH|NOL|NOM|NOR|NVP|NWM|OAL|OBB|OBG|OCH|OHA|ÖHR|OHV|OHZ|OPR|OSL|OVI|OVL|OVP|PAF|PAN|PAR|PCH|PEG|PIR|PLÖ|PRÜ|QFT|QLB|RDG|REG|REH|REI|RID|RIE|ROD|ROF|ROK|ROL|ROS|ROT|ROW|RSL|RÜD|RÜG|SAB|SAD|SAN|SAW|SBG|SBK|SCZ|SDH|SDL|SDT|SEB|SEE|SEF|SEL|SFB|SFT|SGH|SHA|SHG|SHK|SHL|SIG|SIM|SLE|SLF|SLK|SLN|SLS|SLÜ|SLZ|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, + str ), 'de-LI': (str) => /^FL[- ]?\d{1,5}[UZ]?$/.test(str), 'en-IN': (str) => /^[A-Z]{2}[ -]?[0-9]{1,2}(?:[ -]?[A-Z])(?:[ -]?[A-Z]*)?[ -]?[0-9]{4}$/.test( - str, + str ), 'es-AR': (str) => /^(([A-Z]{2} ?[0-9]{3} ?[A-Z]{2})|([A-Z]{3} ?[0-9]{3}))$/.test(str), 'fi-FI': (str) => /^(?=.{4,7})(([A-Z]{1,3}|[0-9]{1,3})[\s-]?([A-Z]{1,3}|[0-9]{1,5}))$/.test( - str, + str ), 'hu-HU': (str) => /^((((?!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, + str ), 'pt-BR': (str) => /^[A-Z]{3}[ -]?[0-9][A-Z][0-9]{2}|[A-Z]{3}[ -]?[0-9]{4}$/.test(str), 'pt-PT': (str) => /^([A-Z]{2}|[0-9]{2})[ -·]?([A-Z]{2}|[0-9]{2})[ -·]?([A-Z]{2}|[0-9]{2})$/.test( - str, + str ), 'sq-AL': (str) => /^[A-Z]{2}[- ]?((\d{3}[- ]?(([A-Z]{2})|T))|(R[- ]?\d{3}))$/.test(str), 'sv-SE': (str) => /^[A-HJ-PR-UW-Z]{3} ?[\d]{2}[A-HJ-PR-UW-Z1-9]$|(^[A-ZÅÄÖ ]{2,7}$)/.test( - str.trim(), + str.trim() ), }; diff --git a/src/lib/isLocale.js b/src/lib/isLocale.js index 621c2f73b..169b88d09 100644 --- a/src/lib/isLocale.js +++ b/src/lib/isLocale.js @@ -106,7 +106,7 @@ const langtag = `${language}(${delimiter}${script})?(${delimiter}${region})?(${d https://www.rfc-editor.org/rfc/rfc5646.html */ const languageTagRegex = new RegExp( - `(^${privateuse}$)|(^${grandfathered}$)|(^${langtag}$)`, + `(^${privateuse}$)|(^${grandfathered}$)|(^${langtag}$)` ); export default function isLocale(str) { diff --git a/src/lib/isNumeric.js b/src/lib/isNumeric.js index 37200ea52..f6ded2b92 100644 --- a/src/lib/isNumeric.js +++ b/src/lib/isNumeric.js @@ -11,6 +11,6 @@ export default function isNumeric(str, options) { return new RegExp( `^[+-]?([0-9]*[${ (options || {}).locale ? decimal[options.locale] : '.' - }])?[0-9]+$`, + }])?[0-9]+$` ).test(str); } diff --git a/src/lib/isRFC3339.js b/src/lib/isRFC3339.js index eec46ce2c..37e16b717 100644 --- a/src/lib/isRFC3339.js +++ b/src/lib/isRFC3339.js @@ -15,11 +15,11 @@ const timeNumOffset = new RegExp(`[-+]${timeHour.source}:${timeMinute.source}`); const timeOffset = new RegExp(`([zZ]|${timeNumOffset.source})`); const partialTime = new RegExp( - `${timeHour.source}:${timeMinute.source}:${timeSecond.source}${timeSecFrac.source}`, + `${timeHour.source}:${timeMinute.source}:${timeSecond.source}${timeSecFrac.source}` ); const fullDate = new RegExp( - `${dateFullYear.source}-${dateMonth.source}-${dateMDay.source}`, + `${dateFullYear.source}-${dateMonth.source}-${dateMDay.source}` ); const fullTime = new RegExp(`${partialTime.source}${timeOffset.source}`); diff --git a/src/lib/isSemVer.js b/src/lib/isSemVer.js index 115905c80..9bb3e13af 100644 --- a/src/lib/isSemVer.js +++ b/src/lib/isSemVer.js @@ -13,7 +13,7 @@ const semanticVersioningRegex = multilineRegexp( '(?:-((?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*))*))', '?(?:\\+([0-9a-z-]+(?:\\.[0-9a-z-]+)*))?$', ], - 'i', + 'i' ); export default function isSemVer(str) { diff --git a/src/lib/isTaxID.js b/src/lib/isTaxID.js index 3b57a681e..4b7846563 100644 --- a/src/lib/isTaxID.js +++ b/src/lib/isTaxID.js @@ -353,7 +353,7 @@ function enIeCheck(tin) { .split('') .slice(0, 7) .map((a) => parseInt(a, 10)), - 8, + 8 ); if (tin.length === 9 && tin[8] !== 'W') { checksum += (tin[8].charCodeAt(0) - 64) * 9; @@ -1023,7 +1023,7 @@ function nlNlCheck(tin) { .split('') .slice(0, 8) .map((a) => parseInt(a, 10)), - 9, + 9 ) % 11 === parseInt(tin[8], 10) @@ -1207,7 +1207,7 @@ function ptPtCheck(tin) { .split('') .slice(0, 8) .map((a) => parseInt(a, 10)), - 9, + 9 ) % 11); if (checksum > 9) { @@ -1326,7 +1326,7 @@ function slSiCheck(tin) { .split('') .slice(0, 7) .map((a) => parseInt(a, 10)), - 8, + 8 ) % 11); if (checksum === 10) { diff --git a/src/lib/isVAT.js b/src/lib/isVAT.js index 640044340..825a58d18 100644 --- a/src/lib/isVAT.js +++ b/src/lib/isVAT.js @@ -17,7 +17,7 @@ const CH = (str) => { // @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, + str ) && hasValidCheckNumber(str.match(/\d/g).map((el) => +el)) ); }; @@ -37,7 +37,7 @@ const PT = (str) => { .split('') .slice(0, 8) .map((a) => parseInt(a, 10)), - 9, + 9 ) % 11); if (checksum > 9) { @@ -72,7 +72,7 @@ export const vatMatchers = { NL: (str) => /^(NL)?\d{9}B\d{2}$/.test(str), PL: (str) => /^(PL)?(\d{10}|(\d{3}-\d{3}-\d{2}-\d{2})|(\d{3}-\d{2}-\d{2}-\d{3}))$/.test( - str, + str ), PT, RO: (str) => /^(RO)?\d{2,10}$/.test(str), @@ -108,7 +108,7 @@ export const vatMatchers = { UA: (str) => /^(UA)?\d{12}$/.test(str), GB: (str) => /^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, + str ), UZ: (str) => /^(UZ)?\d{9}$/.test(str), @@ -119,7 +119,7 @@ export const vatMatchers = { BO: (str) => /^(BO)?\d{7}$/.test(str), BR: (str) => /^(BR)?((\d{2}.\d{3}.\d{3}\/\d{4}-\d{2})|(\d{3}.\d{3}.\d{3}-\d{2}))$/.test( - str, + str ), CL: (str) => /^(CL)?\d{8}-\d{1}$/.test(str), CO: (str) => /^(CO)?\d{10}$/.test(str), @@ -135,7 +135,7 @@ export const vatMatchers = { PE: (str) => /^(PE)?\d{11}$/.test(str), DO: (str) => /^(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, + str ), UY: (str) => /^(UY)?\d{12}$/.test(str), VE: (str) => /^(VE)?[J,G,V,E]{1}-(\d{9}|(\d{8}-\d{1}))$/.test(str), diff --git a/src/lib/rtrim.js b/src/lib/rtrim.js index bace9516d..8c5e2e146 100644 --- a/src/lib/rtrim.js +++ b/src/lib/rtrim.js @@ -6,7 +6,7 @@ export default function rtrim(str, chars) { // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Escaping const pattern = new RegExp( `[${chars.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}]+$`, - 'g', + 'g' ); return str.replace(pattern, ''); } diff --git a/test/clientSide.test.js b/test/clientSide.test.js index 17d6de2d5..037c4e4a5 100644 --- a/test/clientSide.test.js +++ b/test/clientSide.test.js @@ -11,7 +11,7 @@ describe('Minified version', () => { assert.strictEqual( typeof validator[key], typeof min[key], - `Minified version did not export ${key}`, + `Minified version did not export ${key}` ); } } @@ -21,7 +21,7 @@ describe('Minified version', () => { assert.strictEqual( min.version, validator.version, - 'Minified version mismatch. Run `make min`', + 'Minified version mismatch. Run `make min`' ); }); diff --git a/test/exports.test.js b/test/exports.test.js index 832920a5a..96ec33502 100644 --- a/test/exports.test.js +++ b/test/exports.test.js @@ -28,7 +28,7 @@ describe('Exports', () => { assert.strictEqual( validator.version, require('../package.json').version, - 'Version number mismatch in "package.json" vs. "validator.js"', + 'Version number mismatch in "package.json" vs. "validator.js"' ); /* eslint-enable global-require */ }); diff --git a/test/sanitizers.test.js b/test/sanitizers.test.js index 9d00e504d..900b0c3c0 100644 --- a/test/sanitizers.test.js +++ b/test/sanitizers.test.js @@ -22,7 +22,7 @@ function test(options) { options.sanitizer, args.join(', '), result, - expected, + expected ); throw new Error(warning); diff --git a/test/testFunctions.js b/test/testFunctions.js index 53f561016..17dc8157a 100644 --- a/test/testFunctions.js +++ b/test/testFunctions.js @@ -17,7 +17,7 @@ export default function test(options) { const warning = format( 'validator.%s(%s) passed but should error', options.validator, - args.join(', '), + args.join(', ') ); throw new Error(warning); @@ -33,7 +33,7 @@ export default function test(options) { const warning = format( 'validator.%s(%s) failed but should have passed', options.validator, - args.join(', '), + args.join(', ') ); throw new Error(warning); @@ -49,7 +49,7 @@ export default function test(options) { const warning = format( 'validator.%s(%s) passed but should have failed', options.validator, - args.join(', '), + args.join(', ') ); throw new Error(warning); diff --git a/test/validators.test.js b/test/validators.test.js index 34687df63..f9b051231 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -52,7 +52,7 @@ describe('Validators', () => { `${'a'.repeat(65)}@${'a'.repeat(250)}.com`, `${'a'.repeat(64)}@${'a'.repeat(64)}.com`, `${'a'.repeat(64)}@${'a'.repeat(63)}.${'a'.repeat(63)}.${'a'.repeat( - 63, + 63 )}.${'a'.repeat(58)}.com`, 'test1@invalid.co m', 'test2@invalid.co m', From c4838d741ed97bbcb69fa17e921af02d5987a35b Mon Sep 17 00:00:00 2001 From: Henk Bakker Date: Fri, 5 Jan 2024 15:25:38 +0100 Subject: [PATCH 12/12] fix test --- test/validators/isAfter.test.js | 1 + test/validators/isFQDN.test.js | 1 + test/validators/isISBN.test.js | 1 + 3 files changed, 3 insertions(+) diff --git a/test/validators/isAfter.test.js b/test/validators/isAfter.test.js index 65257580f..b33767eb8 100644 --- a/test/validators/isAfter.test.js +++ b/test/validators/isAfter.test.js @@ -1,3 +1,4 @@ +import { describe, it } from 'vitest'; import test from '../testFunctions.js'; describe('isAfter', () => { diff --git a/test/validators/isFQDN.test.js b/test/validators/isFQDN.test.js index d9123538c..37a4dfc0f 100644 --- a/test/validators/isFQDN.test.js +++ b/test/validators/isFQDN.test.js @@ -1,3 +1,4 @@ +import { describe, it } from 'vitest'; import test from '../testFunctions.js'; describe('isFQDN', () => { diff --git a/test/validators/isISBN.test.js b/test/validators/isISBN.test.js index ef3086af4..5376dcafa 100644 --- a/test/validators/isISBN.test.js +++ b/test/validators/isISBN.test.js @@ -1,3 +1,4 @@ +import { describe, it } from 'vitest'; import test from '../testFunctions.js'; describe('isISBN', () => {