PATH:
opt
/
bitninja-dispatcher
/
node_modules
/
validator
/
lib
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = isPassportNumber; var _assertString = _interopRequireDefault(require("./util/assertString")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Reference: * https://en.wikipedia.org/ -- Wikipedia * https://docs.microsoft.com/en-us/microsoft-365/compliance/eu-passport-number -- EU Passport Number * https://countrycode.org/ -- Country Codes */ var passportRegexByCountryCode = { AM: /^[A-Z]{2}\d{7}$/, // ARMENIA AR: /^[A-Z]{3}\d{6}$/, // ARGENTINA AT: /^[A-Z]\d{7}$/, // AUSTRIA AU: /^[A-Z]\d{7}$/, // AUSTRALIA BE: /^[A-Z]{2}\d{6}$/, // BELGIUM BG: /^\d{9}$/, // BULGARIA BR: /^[A-Z]{2}\d{6}$/, // BRAZIL BY: /^[A-Z]{2}\d{7}$/, // BELARUS CA: /^[A-Z]{2}\d{6}$/, // CANADA CH: /^[A-Z]\d{7}$/, // SWITZERLAND CN: /^G\d{8}$|^E(?![IO])[A-Z0-9]\d{7}$/, // CHINA [G=Ordinary, E=Electronic] followed by 8-digits, or E followed by any UPPERCASE letter (except I and O) followed by 7 digits CY: /^[A-Z](\d{6}|\d{8})$/, // CYPRUS CZ: /^\d{8}$/, // CZECH REPUBLIC DE: /^[CFGHJKLMNPRTVWXYZ0-9]{9}$/, // GERMANY DK: /^\d{9}$/, // DENMARK DZ: /^\d{9}$/, // ALGERIA EE: /^([A-Z]\d{7}|[A-Z]{2}\d{7})$/, // ESTONIA (K followed by 7-digits), e-passports have 2 UPPERCASE followed by 7 digits ES: /^[A-Z0-9]{2}([A-Z0-9]?)\d{6}$/, // SPAIN FI: /^[A-Z]{2}\d{7}$/, // FINLAND FR: /^\d{2}[A-Z]{2}\d{5}$/, // FRANCE GB: /^\d{9}$/, // UNITED KINGDOM GR: /^[A-Z]{2}\d{7}$/, // GREECE HR: /^\d{9}$/, // CROATIA HU: /^[A-Z]{2}(\d{6}|\d{7})$/, // HUNGARY IE: /^[A-Z0-9]{2}\d{7}$/, // IRELAND IN: /^[A-Z]{1}-?\d{7}$/, // INDIA ID: /^[A-C]\d{7}$/, // INDONESIA IR: /^[A-Z]\d{8}$/, // IRAN IS: /^(A)\d{7}$/, // ICELAND IT: /^[A-Z0-9]{2}\d{7}$/, // ITALY JP: /^[A-Z]{2}\d{7}$/, // JAPAN KR: /^[MS]\d{8}$/, // SOUTH KOREA, REPUBLIC OF KOREA, [S=PS Passports, M=PM Passports] LT: /^[A-Z0-9]{8}$/, // LITHUANIA LU: /^[A-Z0-9]{8}$/, // LUXEMBURG LV: /^[A-Z0-9]{2}\d{7}$/, // LATVIA LY: /^[A-Z0-9]{8}$/, // LIBYA MT: /^\d{7}$/, // MALTA MZ: /^([A-Z]{2}\d{7})|(\d{2}[A-Z]{2}\d{5})$/, // MOZAMBIQUE MY: /^[AHK]\d{8}$/, // MALAYSIA NL: /^[A-Z]{2}[A-Z0-9]{6}\d$/, // NETHERLANDS PL: /^[A-Z]{2}\d{7}$/, // POLAND PT: /^[A-Z]\d{6}$/, // PORTUGAL RO: /^\d{8,9}$/, // ROMANIA RU: /^\d{9}$/, // RUSSIAN FEDERATION SE: /^\d{8}$/, // SWEDEN SL: /^(P)[A-Z]\d{7}$/, // SLOVANIA SK: /^[0-9A-Z]\d{7}$/, // SLOVAKIA TR: /^[A-Z]\d{8}$/, // TURKEY UA: /^[A-Z]{2}\d{6}$/, // UKRAINE US: /^\d{9}$/ // UNITED STATES }; /** * Check if str is a valid passport number * relative to provided ISO Country Code. * * @param {string} str * @param {string} countryCode * @return {boolean} */ function isPassportNumber(str, countryCode) { (0, _assertString.default)(str); /** Remove All Whitespaces, Convert to UPPERCASE */ var normalizedStr = str.replace(/\s/g, '').toUpperCase(); return countryCode.toUpperCase() in passportRegexByCountryCode && passportRegexByCountryCode[countryCode].test(normalizedStr); } module.exports = exports.default; module.exports.default = exports.default;
[-] isISO31661Alpha3.js
[edit]
[-] isBtcAddress.js
[edit]
[-] isBoolean.js
[edit]
[-] isHexColor.js
[edit]
[-] equals.js
[edit]
[-] isUppercase.js
[edit]
[-] isLocale.js
[edit]
[-] toInt.js
[edit]
[-] toDate.js
[edit]
[-] isIn.js
[edit]
[-] isDivisibleBy.js
[edit]
[-] isEthereumAddress.js
[edit]
[-] isMagnetURI.js
[edit]
[-] toBoolean.js
[edit]
[-] isHexadecimal.js
[edit]
[-] isVAT.js
[edit]
[-] isHSL.js
[edit]
[+]
..
[-] isMobilePhone.js
[edit]
[-] isMD5.js
[edit]
[-] stripLow.js
[edit]
[-] contains.js
[edit]
[-] isMimeType.js
[edit]
[-] isIdentityCard.js
[edit]
[-] blacklist.js
[edit]
[-] isJSON.js
[edit]
[-] isHash.js
[edit]
[-] isPassportNumber.js
[edit]
[-] isURL.js
[edit]
[-] isISO31661Alpha2.js
[edit]
[-] toFloat.js
[edit]
[-] isNumeric.js
[edit]
[-] isVariableWidth.js
[edit]
[-] isUUID.js
[edit]
[-] isBIC.js
[edit]
[-] isDate.js
[edit]
[-] isIPRange.js
[edit]
[-] isStrongPassword.js
[edit]
[-] unescape.js
[edit]
[-] isISRC.js
[edit]
[-] isSemVer.js
[edit]
[-] isInt.js
[edit]
[-] isEAN.js
[edit]
[-] alpha.js
[edit]
[-] isISSN.js
[edit]
[-] rtrim.js
[edit]
[-] isPostalCode.js
[edit]
[-] isSurrogatePair.js
[edit]
[-] isMongoId.js
[edit]
[-] isBase58.js
[edit]
[-] isCreditCard.js
[edit]
[-] isIMEI.js
[edit]
[-] isFullWidth.js
[edit]
[-] isISO8601.js
[edit]
[-] isBase64.js
[edit]
[-] isHalfWidth.js
[edit]
[-] isIBAN.js
[edit]
[-] isByteLength.js
[edit]
[-] isDataURI.js
[edit]
[-] isAfter.js
[edit]
[-] isISIN.js
[edit]
[-] normalizeEmail.js
[edit]
[-] isAlpha.js
[edit]
[-] isBefore.js
[edit]
[+]
util
[-] isCurrency.js
[edit]
[-] isRFC3339.js
[edit]
[-] isJWT.js
[edit]
[-] isWhitelisted.js
[edit]
[-] isMACAddress.js
[edit]
[-] isISO4217.js
[edit]
[-] isOctal.js
[edit]
[-] ltrim.js
[edit]
[-] isLength.js
[edit]
[-] whitelist.js
[edit]
[-] isDecimal.js
[edit]
[-] isRgbColor.js
[edit]
[-] isLatLong.js
[edit]
[-] isPort.js
[edit]
[-] isMultibyte.js
[edit]
[-] matches.js
[edit]
[-] isTaxID.js
[edit]
[-] isBase32.js
[edit]
[-] trim.js
[edit]
[-] isAlphanumeric.js
[edit]
[-] isAscii.js
[edit]
[-] isSlug.js
[edit]
[-] isEmpty.js
[edit]
[-] escape.js
[edit]
[-] isEmail.js
[edit]
[-] isLowercase.js
[edit]
[-] isFloat.js
[edit]
[-] isISBN.js
[edit]
[-] isIP.js
[edit]
[-] isFQDN.js
[edit]
[-] isLicensePlate.js
[edit]