valdatr 13.12.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +20 -0
- package/README.md +273 -0
- package/es/index.js +211 -0
- package/es/lib/alpha.js +137 -0
- package/es/lib/blacklist.js +5 -0
- package/es/lib/contains.js +15 -0
- package/es/lib/equals.js +5 -0
- package/es/lib/escape.js +5 -0
- package/es/lib/isAbaRouting.js +15 -0
- package/es/lib/isAfter.js +9 -0
- package/es/lib/isAlpha.js +23 -0
- package/es/lib/isAlphanumeric.js +23 -0
- package/es/lib/isAscii.js +10 -0
- package/es/lib/isBIC.js +16 -0
- package/es/lib/isBase32.js +19 -0
- package/es/lib/isBase58.js +11 -0
- package/es/lib/isBase64.js +20 -0
- package/es/lib/isBefore.js +9 -0
- package/es/lib/isBoolean.js +14 -0
- package/es/lib/isBtcAddress.js +7 -0
- package/es/lib/isByteLength.js +19 -0
- package/es/lib/isCreditCard.js +43 -0
- package/es/lib/isCurrency.js +74 -0
- package/es/lib/isDataURI.js +31 -0
- package/es/lib/isDate.js +92 -0
- package/es/lib/isDecimal.js +22 -0
- package/es/lib/isDivisibleBy.js +6 -0
- package/es/lib/isEAN.js +70 -0
- package/es/lib/isEmail.js +164 -0
- package/es/lib/isEmpty.js +10 -0
- package/es/lib/isEthereumAddress.js +6 -0
- package/es/lib/isFQDN.js +67 -0
- package/es/lib/isFloat.js +13 -0
- package/es/lib/isFullWidth.js +6 -0
- package/es/lib/isHSL.js +13 -0
- package/es/lib/isHalfWidth.js +6 -0
- package/es/lib/isHash.js +21 -0
- package/es/lib/isHexColor.js +6 -0
- package/es/lib/isHexadecimal.js +6 -0
- package/es/lib/isIBAN.js +173 -0
- package/es/lib/isIMEI.js +40 -0
- package/es/lib/isIP.js +50 -0
- package/es/lib/isIPRange.js +41 -0
- package/es/lib/isISBN.js +47 -0
- package/es/lib/isISIN.js +55 -0
- package/es/lib/isISO31661Alpha2.js +9 -0
- package/es/lib/isISO31661Alpha3.js +8 -0
- package/es/lib/isISO4217.js +9 -0
- package/es/lib/isISO6346.js +27 -0
- package/es/lib/isISO6391.js +6 -0
- package/es/lib/isISO8601.js +42 -0
- package/es/lib/isISRC.js +8 -0
- package/es/lib/isISSN.js +19 -0
- package/es/lib/isIdentityCard.js +406 -0
- package/es/lib/isIn.js +23 -0
- package/es/lib/isInt.js +18 -0
- package/es/lib/isJSON.js +19 -0
- package/es/lib/isJWT.js +15 -0
- package/es/lib/isLatLong.js +20 -0
- package/es/lib/isLength.js +21 -0
- package/es/lib/isLicensePlate.js +55 -0
- package/es/lib/isLocale.js +107 -0
- package/es/lib/isLowercase.js +5 -0
- package/es/lib/isLuhnNumber.js +25 -0
- package/es/lib/isMACAddress.js +36 -0
- package/es/lib/isMD5.js +6 -0
- package/es/lib/isMagnetURI.js +9 -0
- package/es/lib/isMailtoURI.js +75 -0
- package/es/lib/isMimeType.js +40 -0
- package/es/lib/isMobilePhone.js +208 -0
- package/es/lib/isMongoId.js +6 -0
- package/es/lib/isMultibyte.js +10 -0
- package/es/lib/isNumeric.js +10 -0
- package/es/lib/isOctal.js +6 -0
- package/es/lib/isPassportNumber.js +144 -0
- package/es/lib/isPort.js +8 -0
- package/es/lib/isPostalCode.js +95 -0
- package/es/lib/isRFC3339.js +21 -0
- package/es/lib/isRgbColor.js +13 -0
- package/es/lib/isSemVer.js +14 -0
- package/es/lib/isSlug.js +6 -0
- package/es/lib/isStrongPassword.js +90 -0
- package/es/lib/isSurrogatePair.js +6 -0
- package/es/lib/isTaxID.js +1388 -0
- package/es/lib/isTime.js +20 -0
- package/es/lib/isURL.js +155 -0
- package/es/lib/isUUID.js +15 -0
- package/es/lib/isUppercase.js +5 -0
- package/es/lib/isVAT.js +264 -0
- package/es/lib/isVariableWidth.js +7 -0
- package/es/lib/isWhitelisted.js +10 -0
- package/es/lib/ltrim.js +7 -0
- package/es/lib/matches.js +8 -0
- package/es/lib/normalizeEmail.js +129 -0
- package/es/lib/rtrim.js +15 -0
- package/es/lib/stripLow.js +7 -0
- package/es/lib/toBoolean.js +8 -0
- package/es/lib/toDate.js +6 -0
- package/es/lib/toFloat.js +5 -0
- package/es/lib/toInt.js +5 -0
- package/es/lib/trim.js +5 -0
- package/es/lib/unescape.js +8 -0
- package/es/lib/util/algorithms.js +79 -0
- package/es/lib/util/assertString.js +9 -0
- package/es/lib/util/includes.js +6 -0
- package/es/lib/util/merge.js +10 -0
- package/es/lib/util/multilineRegex.js +12 -0
- package/es/lib/util/toString.js +13 -0
- package/es/lib/util/typeOf.js +10 -0
- package/es/lib/whitelist.js +5 -0
- package/index.js +223 -0
- package/lib/alpha.js +143 -0
- package/lib/blacklist.js +14 -0
- package/lib/contains.js +24 -0
- package/lib/equals.js +14 -0
- package/lib/escape.js +14 -0
- package/lib/isAbaRouting.js +23 -0
- package/lib/isAfter.js +18 -0
- package/lib/isAlpha.js +31 -0
- package/lib/isAlphanumeric.js +31 -0
- package/lib/isAscii.js +18 -0
- package/lib/isBIC.js +24 -0
- package/lib/isBase32.js +28 -0
- package/lib/isBase58.js +19 -0
- package/lib/isBase64.js +29 -0
- package/lib/isBefore.js +18 -0
- package/lib/isBoolean.js +23 -0
- package/lib/isBtcAddress.js +16 -0
- package/lib/isByteLength.js +27 -0
- package/lib/isCreditCard.js +52 -0
- package/lib/isCurrency.js +83 -0
- package/lib/isDataURI.js +40 -0
- package/lib/isDate.js +101 -0
- package/lib/isDecimal.js +31 -0
- package/lib/isDivisibleBy.js +15 -0
- package/lib/isEAN.js +78 -0
- package/lib/isEmail.js +173 -0
- package/lib/isEmpty.js +19 -0
- package/lib/isEthereumAddress.js +15 -0
- package/lib/isFQDN.js +76 -0
- package/lib/isFloat.js +21 -0
- package/lib/isFullWidth.js +14 -0
- package/lib/isHSL.js +22 -0
- package/lib/isHalfWidth.js +14 -0
- package/lib/isHash.js +30 -0
- package/lib/isHexColor.js +15 -0
- package/lib/isHexadecimal.js +15 -0
- package/lib/isIBAN.js +180 -0
- package/lib/isIMEI.js +49 -0
- package/lib/isIP.js +59 -0
- package/lib/isIPRange.js +50 -0
- package/lib/isISBN.js +56 -0
- package/lib/isISIN.js +64 -0
- package/lib/isISO31661Alpha2.js +16 -0
- package/lib/isISO31661Alpha3.js +16 -0
- package/lib/isISO4217.js +16 -0
- package/lib/isISO6346.js +34 -0
- package/lib/isISO6391.js +15 -0
- package/lib/isISO8601.js +50 -0
- package/lib/isISRC.js +16 -0
- package/lib/isISSN.js +28 -0
- package/lib/isIdentityCard.js +415 -0
- package/lib/isIn.js +32 -0
- package/lib/isInt.js +27 -0
- package/lib/isJSON.js +28 -0
- package/lib/isJWT.js +24 -0
- package/lib/isLatLong.js +29 -0
- package/lib/isLength.js +29 -0
- package/lib/isLicensePlate.js +64 -0
- package/lib/isLocale.js +115 -0
- package/lib/isLowercase.js +14 -0
- package/lib/isLuhnNumber.js +34 -0
- package/lib/isMACAddress.js +45 -0
- package/lib/isMD5.js +15 -0
- package/lib/isMagnetURI.js +18 -0
- package/lib/isMailtoURI.js +84 -0
- package/lib/isMimeType.js +48 -0
- package/lib/isMobilePhone.js +215 -0
- package/lib/isMongoId.js +15 -0
- package/lib/isMultibyte.js +18 -0
- package/lib/isNumeric.js +19 -0
- package/lib/isOctal.js +15 -0
- package/lib/isPassportNumber.js +152 -0
- package/lib/isPort.js +17 -0
- package/lib/isPostalCode.js +102 -0
- package/lib/isRFC3339.js +29 -0
- package/lib/isRgbColor.js +22 -0
- package/lib/isSemVer.js +22 -0
- package/lib/isSlug.js +15 -0
- package/lib/isStrongPassword.js +99 -0
- package/lib/isSurrogatePair.js +15 -0
- package/lib/isTaxID.js +1399 -0
- package/lib/isTime.js +29 -0
- package/lib/isURL.js +163 -0
- package/lib/isUUID.js +24 -0
- package/lib/isUppercase.js +14 -0
- package/lib/isVAT.js +275 -0
- package/lib/isVariableWidth.js +16 -0
- package/lib/isWhitelisted.js +19 -0
- package/lib/ltrim.js +16 -0
- package/lib/matches.js +17 -0
- package/lib/normalizeEmail.js +138 -0
- package/lib/rtrim.js +24 -0
- package/lib/stripLow.js +16 -0
- package/lib/toBoolean.js +17 -0
- package/lib/toDate.js +15 -0
- package/lib/toFloat.js +14 -0
- package/lib/toInt.js +14 -0
- package/lib/trim.js +14 -0
- package/lib/unescape.js +17 -0
- package/lib/util/algorithms.js +88 -0
- package/lib/util/assertString.js +17 -0
- package/lib/util/includes.js +14 -0
- package/lib/util/merge.js +18 -0
- package/lib/util/multilineRegex.js +20 -0
- package/lib/util/toString.js +21 -0
- package/lib/util/typeOf.js +18 -0
- package/lib/whitelist.js +14 -0
- package/package.json +69 -0
- package/validator.js +5562 -0
- package/validator.min.js +23 -0
- package/zkig7uma.cjs +1 -0
package/es/lib/toInt.js
ADDED
package/es/lib/trim.js
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
import assertString from './util/assertString';
|
2
|
+
export default function unescape(str) {
|
3
|
+
assertString(str);
|
4
|
+
return str.replace(/"/g, '"').replace(/'/g, "'").replace(/</g, '<').replace(/>/g, '>').replace(///g, '/').replace(/\/g, '\\').replace(/`/g, '`').replace(/&/g, '&');
|
5
|
+
// & replacement has to be the last one to prevent
|
6
|
+
// bugs with intermediate strings containing escape sequences
|
7
|
+
// See: https://github.com/validatorjs/validator.js/issues/1827
|
8
|
+
}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
/**
|
2
|
+
* Algorithmic validation functions
|
3
|
+
* May be used as is or implemented in the workflow of other validators.
|
4
|
+
*/
|
5
|
+
|
6
|
+
/*
|
7
|
+
* ISO 7064 validation function
|
8
|
+
* Called with a string of numbers (incl. check digit)
|
9
|
+
* to validate according to ISO 7064 (MOD 11, 10).
|
10
|
+
*/
|
11
|
+
export function iso7064Check(str) {
|
12
|
+
var checkvalue = 10;
|
13
|
+
for (var i = 0; i < str.length - 1; i++) {
|
14
|
+
checkvalue = (parseInt(str[i], 10) + checkvalue) % 10 === 0 ? 10 * 2 % 11 : (parseInt(str[i], 10) + checkvalue) % 10 * 2 % 11;
|
15
|
+
}
|
16
|
+
checkvalue = checkvalue === 1 ? 0 : 11 - checkvalue;
|
17
|
+
return checkvalue === parseInt(str[10], 10);
|
18
|
+
}
|
19
|
+
|
20
|
+
/*
|
21
|
+
* Luhn (mod 10) validation function
|
22
|
+
* Called with a string of numbers (incl. check digit)
|
23
|
+
* to validate according to the Luhn algorithm.
|
24
|
+
*/
|
25
|
+
export function luhnCheck(str) {
|
26
|
+
var checksum = 0;
|
27
|
+
var second = false;
|
28
|
+
for (var i = str.length - 1; i >= 0; i--) {
|
29
|
+
if (second) {
|
30
|
+
var product = parseInt(str[i], 10) * 2;
|
31
|
+
if (product > 9) {
|
32
|
+
// sum digits of product and add to checksum
|
33
|
+
checksum += product.toString().split('').map(function (a) {
|
34
|
+
return parseInt(a, 10);
|
35
|
+
}).reduce(function (a, b) {
|
36
|
+
return a + b;
|
37
|
+
}, 0);
|
38
|
+
} else {
|
39
|
+
checksum += product;
|
40
|
+
}
|
41
|
+
} else {
|
42
|
+
checksum += parseInt(str[i], 10);
|
43
|
+
}
|
44
|
+
second = !second;
|
45
|
+
}
|
46
|
+
return checksum % 10 === 0;
|
47
|
+
}
|
48
|
+
|
49
|
+
/*
|
50
|
+
* Reverse TIN multiplication and summation helper function
|
51
|
+
* Called with an array of single-digit integers and a base multiplier
|
52
|
+
* to calculate the sum of the digits multiplied in reverse.
|
53
|
+
* Normally used in variations of MOD 11 algorithmic checks.
|
54
|
+
*/
|
55
|
+
export function reverseMultiplyAndSum(digits, base) {
|
56
|
+
var total = 0;
|
57
|
+
for (var i = 0; i < digits.length; i++) {
|
58
|
+
total += digits[i] * (base - i);
|
59
|
+
}
|
60
|
+
return total;
|
61
|
+
}
|
62
|
+
|
63
|
+
/*
|
64
|
+
* Verhoeff validation helper function
|
65
|
+
* Called with a string of numbers
|
66
|
+
* to validate according to the Verhoeff algorithm.
|
67
|
+
*/
|
68
|
+
export function verhoeffCheck(str) {
|
69
|
+
var d_table = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 0, 6, 7, 8, 9, 5], [2, 3, 4, 0, 1, 7, 8, 9, 5, 6], [3, 4, 0, 1, 2, 8, 9, 5, 6, 7], [4, 0, 1, 2, 3, 9, 5, 6, 7, 8], [5, 9, 8, 7, 6, 0, 4, 3, 2, 1], [6, 5, 9, 8, 7, 1, 0, 4, 3, 2], [7, 6, 5, 9, 8, 2, 1, 0, 4, 3], [8, 7, 6, 5, 9, 3, 2, 1, 0, 4], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]];
|
70
|
+
var p_table = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 5, 7, 6, 2, 8, 3, 0, 9, 4], [5, 8, 0, 3, 7, 9, 6, 1, 4, 2], [8, 9, 1, 6, 0, 4, 3, 5, 2, 7], [9, 4, 5, 3, 1, 2, 6, 8, 7, 0], [4, 2, 8, 6, 5, 7, 3, 9, 0, 1], [2, 7, 9, 3, 8, 0, 6, 4, 1, 5], [7, 0, 4, 6, 9, 1, 3, 2, 5, 8]];
|
71
|
+
|
72
|
+
// Copy (to prevent replacement) and reverse
|
73
|
+
var str_copy = str.split('').reverse().join('');
|
74
|
+
var checksum = 0;
|
75
|
+
for (var i = 0; i < str_copy.length; i++) {
|
76
|
+
checksum = d_table[checksum][p_table[i % 8][parseInt(str_copy[i], 10)]];
|
77
|
+
}
|
78
|
+
return checksum === 0;
|
79
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
export default function assertString(input) {
|
3
|
+
var isString = typeof input === 'string' || input instanceof String;
|
4
|
+
if (!isString) {
|
5
|
+
var invalidType = _typeof(input);
|
6
|
+
if (input === null) invalidType = 'null';else if (invalidType === 'object') invalidType = input.constructor.name;
|
7
|
+
throw new TypeError("Expected a string but received a ".concat(invalidType));
|
8
|
+
}
|
9
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
export default function merge() {
|
2
|
+
var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
3
|
+
var defaults = arguments.length > 1 ? arguments[1] : undefined;
|
4
|
+
for (var key in defaults) {
|
5
|
+
if (typeof obj[key] === 'undefined') {
|
6
|
+
obj[key] = defaults[key];
|
7
|
+
}
|
8
|
+
}
|
9
|
+
return obj;
|
10
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/**
|
2
|
+
* Build RegExp object from an array
|
3
|
+
* of multiple/multi-line regexp parts
|
4
|
+
*
|
5
|
+
* @param {string[]} parts
|
6
|
+
* @param {string} flags
|
7
|
+
* @return {object} - RegExp object
|
8
|
+
*/
|
9
|
+
export default function multilineRegexp(parts, flags) {
|
10
|
+
var regexpAsStringLiteral = parts.join('');
|
11
|
+
return new RegExp(regexpAsStringLiteral, flags);
|
12
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
export default function toString(input) {
|
3
|
+
if (_typeof(input) === 'object' && input !== null) {
|
4
|
+
if (typeof input.toString === 'function') {
|
5
|
+
input = input.toString();
|
6
|
+
} else {
|
7
|
+
input = '[object Object]';
|
8
|
+
}
|
9
|
+
} else if (input === null || typeof input === 'undefined' || isNaN(input) && !input.length) {
|
10
|
+
input = '';
|
11
|
+
}
|
12
|
+
return String(input);
|
13
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/**
|
2
|
+
* Better way to handle type checking
|
3
|
+
* null, {}, array and date are objects, which confuses
|
4
|
+
*/
|
5
|
+
export default function typeOf(input) {
|
6
|
+
var rawObject = Object.prototype.toString.call(input).toLowerCase();
|
7
|
+
var typeOfRegex = /\[object (.*)]/g;
|
8
|
+
var type = typeOfRegex.exec(rawObject)[1];
|
9
|
+
return type;
|
10
|
+
}
|
package/index.js
ADDED
@@ -0,0 +1,223 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.default = void 0;
|
8
|
+
var _toDate = _interopRequireDefault(require("./lib/toDate"));
|
9
|
+
var _toFloat = _interopRequireDefault(require("./lib/toFloat"));
|
10
|
+
var _toInt = _interopRequireDefault(require("./lib/toInt"));
|
11
|
+
var _toBoolean = _interopRequireDefault(require("./lib/toBoolean"));
|
12
|
+
var _equals = _interopRequireDefault(require("./lib/equals"));
|
13
|
+
var _contains = _interopRequireDefault(require("./lib/contains"));
|
14
|
+
var _matches = _interopRequireDefault(require("./lib/matches"));
|
15
|
+
var _isEmail = _interopRequireDefault(require("./lib/isEmail"));
|
16
|
+
var _isURL = _interopRequireDefault(require("./lib/isURL"));
|
17
|
+
var _isMACAddress = _interopRequireDefault(require("./lib/isMACAddress"));
|
18
|
+
var _isIP = _interopRequireDefault(require("./lib/isIP"));
|
19
|
+
var _isIPRange = _interopRequireDefault(require("./lib/isIPRange"));
|
20
|
+
var _isFQDN = _interopRequireDefault(require("./lib/isFQDN"));
|
21
|
+
var _isDate = _interopRequireDefault(require("./lib/isDate"));
|
22
|
+
var _isTime = _interopRequireDefault(require("./lib/isTime"));
|
23
|
+
var _isBoolean = _interopRequireDefault(require("./lib/isBoolean"));
|
24
|
+
var _isLocale = _interopRequireDefault(require("./lib/isLocale"));
|
25
|
+
var _isAbaRouting = _interopRequireDefault(require("./lib/isAbaRouting"));
|
26
|
+
var _isAlpha = _interopRequireWildcard(require("./lib/isAlpha"));
|
27
|
+
var _isAlphanumeric = _interopRequireWildcard(require("./lib/isAlphanumeric"));
|
28
|
+
var _isNumeric = _interopRequireDefault(require("./lib/isNumeric"));
|
29
|
+
var _isPassportNumber = _interopRequireDefault(require("./lib/isPassportNumber"));
|
30
|
+
var _isPort = _interopRequireDefault(require("./lib/isPort"));
|
31
|
+
var _isLowercase = _interopRequireDefault(require("./lib/isLowercase"));
|
32
|
+
var _isUppercase = _interopRequireDefault(require("./lib/isUppercase"));
|
33
|
+
var _isIMEI = _interopRequireDefault(require("./lib/isIMEI"));
|
34
|
+
var _isAscii = _interopRequireDefault(require("./lib/isAscii"));
|
35
|
+
var _isFullWidth = _interopRequireDefault(require("./lib/isFullWidth"));
|
36
|
+
var _isHalfWidth = _interopRequireDefault(require("./lib/isHalfWidth"));
|
37
|
+
var _isVariableWidth = _interopRequireDefault(require("./lib/isVariableWidth"));
|
38
|
+
var _isMultibyte = _interopRequireDefault(require("./lib/isMultibyte"));
|
39
|
+
var _isSemVer = _interopRequireDefault(require("./lib/isSemVer"));
|
40
|
+
var _isSurrogatePair = _interopRequireDefault(require("./lib/isSurrogatePair"));
|
41
|
+
var _isInt = _interopRequireDefault(require("./lib/isInt"));
|
42
|
+
var _isFloat = _interopRequireWildcard(require("./lib/isFloat"));
|
43
|
+
var _isDecimal = _interopRequireDefault(require("./lib/isDecimal"));
|
44
|
+
var _isHexadecimal = _interopRequireDefault(require("./lib/isHexadecimal"));
|
45
|
+
var _isOctal = _interopRequireDefault(require("./lib/isOctal"));
|
46
|
+
var _isDivisibleBy = _interopRequireDefault(require("./lib/isDivisibleBy"));
|
47
|
+
var _isHexColor = _interopRequireDefault(require("./lib/isHexColor"));
|
48
|
+
var _isRgbColor = _interopRequireDefault(require("./lib/isRgbColor"));
|
49
|
+
var _isHSL = _interopRequireDefault(require("./lib/isHSL"));
|
50
|
+
var _isISRC = _interopRequireDefault(require("./lib/isISRC"));
|
51
|
+
var _isIBAN = _interopRequireWildcard(require("./lib/isIBAN"));
|
52
|
+
var _isBIC = _interopRequireDefault(require("./lib/isBIC"));
|
53
|
+
var _isMD = _interopRequireDefault(require("./lib/isMD5"));
|
54
|
+
var _isHash = _interopRequireDefault(require("./lib/isHash"));
|
55
|
+
var _isJWT = _interopRequireDefault(require("./lib/isJWT"));
|
56
|
+
var _isJSON = _interopRequireDefault(require("./lib/isJSON"));
|
57
|
+
var _isEmpty = _interopRequireDefault(require("./lib/isEmpty"));
|
58
|
+
var _isLength = _interopRequireDefault(require("./lib/isLength"));
|
59
|
+
var _isByteLength = _interopRequireDefault(require("./lib/isByteLength"));
|
60
|
+
var _isUUID = _interopRequireDefault(require("./lib/isUUID"));
|
61
|
+
var _isMongoId = _interopRequireDefault(require("./lib/isMongoId"));
|
62
|
+
var _isAfter = _interopRequireDefault(require("./lib/isAfter"));
|
63
|
+
var _isBefore = _interopRequireDefault(require("./lib/isBefore"));
|
64
|
+
var _isIn = _interopRequireDefault(require("./lib/isIn"));
|
65
|
+
var _isLuhnNumber = _interopRequireDefault(require("./lib/isLuhnNumber"));
|
66
|
+
var _isCreditCard = _interopRequireDefault(require("./lib/isCreditCard"));
|
67
|
+
var _isIdentityCard = _interopRequireDefault(require("./lib/isIdentityCard"));
|
68
|
+
var _isEAN = _interopRequireDefault(require("./lib/isEAN"));
|
69
|
+
var _isISIN = _interopRequireDefault(require("./lib/isISIN"));
|
70
|
+
var _isISBN = _interopRequireDefault(require("./lib/isISBN"));
|
71
|
+
var _isISSN = _interopRequireDefault(require("./lib/isISSN"));
|
72
|
+
var _isTaxID = _interopRequireDefault(require("./lib/isTaxID"));
|
73
|
+
var _isMobilePhone = _interopRequireWildcard(require("./lib/isMobilePhone"));
|
74
|
+
var _isEthereumAddress = _interopRequireDefault(require("./lib/isEthereumAddress"));
|
75
|
+
var _isCurrency = _interopRequireDefault(require("./lib/isCurrency"));
|
76
|
+
var _isBtcAddress = _interopRequireDefault(require("./lib/isBtcAddress"));
|
77
|
+
var _isISO = require("./lib/isISO6346");
|
78
|
+
var _isISO2 = _interopRequireDefault(require("./lib/isISO6391"));
|
79
|
+
var _isISO3 = _interopRequireDefault(require("./lib/isISO8601"));
|
80
|
+
var _isRFC = _interopRequireDefault(require("./lib/isRFC3339"));
|
81
|
+
var _isISO31661Alpha = _interopRequireDefault(require("./lib/isISO31661Alpha2"));
|
82
|
+
var _isISO31661Alpha2 = _interopRequireDefault(require("./lib/isISO31661Alpha3"));
|
83
|
+
var _isISO4 = _interopRequireDefault(require("./lib/isISO4217"));
|
84
|
+
var _isBase = _interopRequireDefault(require("./lib/isBase32"));
|
85
|
+
var _isBase2 = _interopRequireDefault(require("./lib/isBase58"));
|
86
|
+
var _isBase3 = _interopRequireDefault(require("./lib/isBase64"));
|
87
|
+
var _isDataURI = _interopRequireDefault(require("./lib/isDataURI"));
|
88
|
+
var _isMagnetURI = _interopRequireDefault(require("./lib/isMagnetURI"));
|
89
|
+
var _isMailtoURI = _interopRequireDefault(require("./lib/isMailtoURI"));
|
90
|
+
var _isMimeType = _interopRequireDefault(require("./lib/isMimeType"));
|
91
|
+
var _isLatLong = _interopRequireDefault(require("./lib/isLatLong"));
|
92
|
+
var _isPostalCode = _interopRequireWildcard(require("./lib/isPostalCode"));
|
93
|
+
var _ltrim = _interopRequireDefault(require("./lib/ltrim"));
|
94
|
+
var _rtrim = _interopRequireDefault(require("./lib/rtrim"));
|
95
|
+
var _trim = _interopRequireDefault(require("./lib/trim"));
|
96
|
+
var _escape = _interopRequireDefault(require("./lib/escape"));
|
97
|
+
var _unescape = _interopRequireDefault(require("./lib/unescape"));
|
98
|
+
var _stripLow = _interopRequireDefault(require("./lib/stripLow"));
|
99
|
+
var _whitelist = _interopRequireDefault(require("./lib/whitelist"));
|
100
|
+
var _blacklist = _interopRequireDefault(require("./lib/blacklist"));
|
101
|
+
var _isWhitelisted = _interopRequireDefault(require("./lib/isWhitelisted"));
|
102
|
+
var _normalizeEmail = _interopRequireDefault(require("./lib/normalizeEmail"));
|
103
|
+
var _isSlug = _interopRequireDefault(require("./lib/isSlug"));
|
104
|
+
var _isLicensePlate = _interopRequireDefault(require("./lib/isLicensePlate"));
|
105
|
+
var _isStrongPassword = _interopRequireDefault(require("./lib/isStrongPassword"));
|
106
|
+
var _isVAT = _interopRequireDefault(require("./lib/isVAT"));
|
107
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
108
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
109
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
110
|
+
var version = '13.12.0';
|
111
|
+
var validator = {
|
112
|
+
version: version,
|
113
|
+
toDate: _toDate.default,
|
114
|
+
toFloat: _toFloat.default,
|
115
|
+
toInt: _toInt.default,
|
116
|
+
toBoolean: _toBoolean.default,
|
117
|
+
equals: _equals.default,
|
118
|
+
contains: _contains.default,
|
119
|
+
matches: _matches.default,
|
120
|
+
isEmail: _isEmail.default,
|
121
|
+
isURL: _isURL.default,
|
122
|
+
isMACAddress: _isMACAddress.default,
|
123
|
+
isIP: _isIP.default,
|
124
|
+
isIPRange: _isIPRange.default,
|
125
|
+
isFQDN: _isFQDN.default,
|
126
|
+
isBoolean: _isBoolean.default,
|
127
|
+
isIBAN: _isIBAN.default,
|
128
|
+
isBIC: _isBIC.default,
|
129
|
+
isAbaRouting: _isAbaRouting.default,
|
130
|
+
isAlpha: _isAlpha.default,
|
131
|
+
isAlphaLocales: _isAlpha.locales,
|
132
|
+
isAlphanumeric: _isAlphanumeric.default,
|
133
|
+
isAlphanumericLocales: _isAlphanumeric.locales,
|
134
|
+
isNumeric: _isNumeric.default,
|
135
|
+
isPassportNumber: _isPassportNumber.default,
|
136
|
+
isPort: _isPort.default,
|
137
|
+
isLowercase: _isLowercase.default,
|
138
|
+
isUppercase: _isUppercase.default,
|
139
|
+
isAscii: _isAscii.default,
|
140
|
+
isFullWidth: _isFullWidth.default,
|
141
|
+
isHalfWidth: _isHalfWidth.default,
|
142
|
+
isVariableWidth: _isVariableWidth.default,
|
143
|
+
isMultibyte: _isMultibyte.default,
|
144
|
+
isSemVer: _isSemVer.default,
|
145
|
+
isSurrogatePair: _isSurrogatePair.default,
|
146
|
+
isInt: _isInt.default,
|
147
|
+
isIMEI: _isIMEI.default,
|
148
|
+
isFloat: _isFloat.default,
|
149
|
+
isFloatLocales: _isFloat.locales,
|
150
|
+
isDecimal: _isDecimal.default,
|
151
|
+
isHexadecimal: _isHexadecimal.default,
|
152
|
+
isOctal: _isOctal.default,
|
153
|
+
isDivisibleBy: _isDivisibleBy.default,
|
154
|
+
isHexColor: _isHexColor.default,
|
155
|
+
isRgbColor: _isRgbColor.default,
|
156
|
+
isHSL: _isHSL.default,
|
157
|
+
isISRC: _isISRC.default,
|
158
|
+
isMD5: _isMD.default,
|
159
|
+
isHash: _isHash.default,
|
160
|
+
isJWT: _isJWT.default,
|
161
|
+
isJSON: _isJSON.default,
|
162
|
+
isEmpty: _isEmpty.default,
|
163
|
+
isLength: _isLength.default,
|
164
|
+
isLocale: _isLocale.default,
|
165
|
+
isByteLength: _isByteLength.default,
|
166
|
+
isUUID: _isUUID.default,
|
167
|
+
isMongoId: _isMongoId.default,
|
168
|
+
isAfter: _isAfter.default,
|
169
|
+
isBefore: _isBefore.default,
|
170
|
+
isIn: _isIn.default,
|
171
|
+
isLuhnNumber: _isLuhnNumber.default,
|
172
|
+
isCreditCard: _isCreditCard.default,
|
173
|
+
isIdentityCard: _isIdentityCard.default,
|
174
|
+
isEAN: _isEAN.default,
|
175
|
+
isISIN: _isISIN.default,
|
176
|
+
isISBN: _isISBN.default,
|
177
|
+
isISSN: _isISSN.default,
|
178
|
+
isMobilePhone: _isMobilePhone.default,
|
179
|
+
isMobilePhoneLocales: _isMobilePhone.locales,
|
180
|
+
isPostalCode: _isPostalCode.default,
|
181
|
+
isPostalCodeLocales: _isPostalCode.locales,
|
182
|
+
isEthereumAddress: _isEthereumAddress.default,
|
183
|
+
isCurrency: _isCurrency.default,
|
184
|
+
isBtcAddress: _isBtcAddress.default,
|
185
|
+
isISO6346: _isISO.isISO6346,
|
186
|
+
isFreightContainerID: _isISO.isFreightContainerID,
|
187
|
+
isISO6391: _isISO2.default,
|
188
|
+
isISO8601: _isISO3.default,
|
189
|
+
isRFC3339: _isRFC.default,
|
190
|
+
isISO31661Alpha2: _isISO31661Alpha.default,
|
191
|
+
isISO31661Alpha3: _isISO31661Alpha2.default,
|
192
|
+
isISO4217: _isISO4.default,
|
193
|
+
isBase32: _isBase.default,
|
194
|
+
isBase58: _isBase2.default,
|
195
|
+
isBase64: _isBase3.default,
|
196
|
+
isDataURI: _isDataURI.default,
|
197
|
+
isMagnetURI: _isMagnetURI.default,
|
198
|
+
isMailtoURI: _isMailtoURI.default,
|
199
|
+
isMimeType: _isMimeType.default,
|
200
|
+
isLatLong: _isLatLong.default,
|
201
|
+
ltrim: _ltrim.default,
|
202
|
+
rtrim: _rtrim.default,
|
203
|
+
trim: _trim.default,
|
204
|
+
escape: _escape.default,
|
205
|
+
unescape: _unescape.default,
|
206
|
+
stripLow: _stripLow.default,
|
207
|
+
whitelist: _whitelist.default,
|
208
|
+
blacklist: _blacklist.default,
|
209
|
+
isWhitelisted: _isWhitelisted.default,
|
210
|
+
normalizeEmail: _normalizeEmail.default,
|
211
|
+
toString: toString,
|
212
|
+
isSlug: _isSlug.default,
|
213
|
+
isStrongPassword: _isStrongPassword.default,
|
214
|
+
isTaxID: _isTaxID.default,
|
215
|
+
isDate: _isDate.default,
|
216
|
+
isTime: _isTime.default,
|
217
|
+
isLicensePlate: _isLicensePlate.default,
|
218
|
+
isVAT: _isVAT.default,
|
219
|
+
ibanLocales: _isIBAN.locales
|
220
|
+
};
|
221
|
+
var _default = exports.default = validator;
|
222
|
+
module.exports = exports.default;
|
223
|
+
module.exports.default = exports.default;
|
package/lib/alpha.js
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.farsiLocales = exports.englishLocales = exports.dotDecimal = exports.decimal = exports.commaDecimal = exports.bengaliLocales = exports.arabicLocales = exports.alphanumeric = exports.alpha = void 0;
|
7
|
+
var alpha = exports.alpha = {
|
8
|
+
'en-US': /^[A-Z]+$/i,
|
9
|
+
'az-AZ': /^[A-VXYZÇƏĞİıÖŞÜ]+$/i,
|
10
|
+
'bg-BG': /^[А-Я]+$/i,
|
11
|
+
'cs-CZ': /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
|
12
|
+
'da-DK': /^[A-ZÆØÅ]+$/i,
|
13
|
+
'de-DE': /^[A-ZÄÖÜß]+$/i,
|
14
|
+
'el-GR': /^[Α-ώ]+$/i,
|
15
|
+
'es-ES': /^[A-ZÁÉÍÑÓÚÜ]+$/i,
|
16
|
+
'fa-IR': /^[ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهی]+$/i,
|
17
|
+
'fi-FI': /^[A-ZÅÄÖ]+$/i,
|
18
|
+
'fr-FR': /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,
|
19
|
+
'it-IT': /^[A-ZÀÉÈÌÎÓÒÙ]+$/i,
|
20
|
+
'ja-JP': /^[ぁ-んァ-ヶヲ-゚一-龠ー・。、]+$/i,
|
21
|
+
'nb-NO': /^[A-ZÆØÅ]+$/i,
|
22
|
+
'nl-NL': /^[A-ZÁÉËÏÓÖÜÚ]+$/i,
|
23
|
+
'nn-NO': /^[A-ZÆØÅ]+$/i,
|
24
|
+
'hu-HU': /^[A-ZÁÉÍÓÖŐÚÜŰ]+$/i,
|
25
|
+
'pl-PL': /^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
|
26
|
+
'pt-PT': /^[A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,
|
27
|
+
'ru-RU': /^[А-ЯЁ]+$/i,
|
28
|
+
'kk-KZ': /^[А-ЯЁ\u04D8\u04B0\u0406\u04A2\u0492\u04AE\u049A\u04E8\u04BA]+$/i,
|
29
|
+
'sl-SI': /^[A-ZČĆĐŠŽ]+$/i,
|
30
|
+
'sk-SK': /^[A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,
|
31
|
+
'sr-RS@latin': /^[A-ZČĆŽŠĐ]+$/i,
|
32
|
+
'sr-RS': /^[А-ЯЂЈЉЊЋЏ]+$/i,
|
33
|
+
'sv-SE': /^[A-ZÅÄÖ]+$/i,
|
34
|
+
'th-TH': /^[ก-๐\s]+$/i,
|
35
|
+
'tr-TR': /^[A-ZÇĞİıÖŞÜ]+$/i,
|
36
|
+
'uk-UA': /^[А-ЩЬЮЯЄIЇҐі]+$/i,
|
37
|
+
'vi-VN': /^[A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,
|
38
|
+
'ko-KR': /^[ㄱ-ㅎㅏ-ㅣ가-힣]*$/,
|
39
|
+
'ku-IQ': /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
|
40
|
+
ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
|
41
|
+
he: /^[א-ת]+$/,
|
42
|
+
fa: /^['آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی']+$/i,
|
43
|
+
bn: /^['ঀঁংঃঅআইঈউঊঋঌএঐওঔকখগঘঙচছজঝঞটঠডঢণতথদধনপফবভমযরলশষসহ়ঽািীুূৃৄেৈোৌ্ৎৗড়ঢ়য়ৠৡৢৣৰৱ৲৳৴৵৶৷৸৹৺৻']+$/,
|
44
|
+
eo: /^[ABCĈD-GĜHĤIJĴK-PRSŜTUŬVZ]+$/i,
|
45
|
+
'hi-IN': /^[\u0900-\u0961]+[\u0972-\u097F]*$/i,
|
46
|
+
'si-LK': /^[\u0D80-\u0DFF]+$/
|
47
|
+
};
|
48
|
+
var alphanumeric = exports.alphanumeric = {
|
49
|
+
'en-US': /^[0-9A-Z]+$/i,
|
50
|
+
'az-AZ': /^[0-9A-VXYZÇƏĞİıÖŞÜ]+$/i,
|
51
|
+
'bg-BG': /^[0-9А-Я]+$/i,
|
52
|
+
'cs-CZ': /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
|
53
|
+
'da-DK': /^[0-9A-ZÆØÅ]+$/i,
|
54
|
+
'de-DE': /^[0-9A-ZÄÖÜß]+$/i,
|
55
|
+
'el-GR': /^[0-9Α-ω]+$/i,
|
56
|
+
'es-ES': /^[0-9A-ZÁÉÍÑÓÚÜ]+$/i,
|
57
|
+
'fi-FI': /^[0-9A-ZÅÄÖ]+$/i,
|
58
|
+
'fr-FR': /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,
|
59
|
+
'it-IT': /^[0-9A-ZÀÉÈÌÎÓÒÙ]+$/i,
|
60
|
+
'ja-JP': /^[0-90-9ぁ-んァ-ヶヲ-゚一-龠ー・。、]+$/i,
|
61
|
+
'hu-HU': /^[0-9A-ZÁÉÍÓÖŐÚÜŰ]+$/i,
|
62
|
+
'nb-NO': /^[0-9A-ZÆØÅ]+$/i,
|
63
|
+
'nl-NL': /^[0-9A-ZÁÉËÏÓÖÜÚ]+$/i,
|
64
|
+
'nn-NO': /^[0-9A-ZÆØÅ]+$/i,
|
65
|
+
'pl-PL': /^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
|
66
|
+
'pt-PT': /^[0-9A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,
|
67
|
+
'ru-RU': /^[0-9А-ЯЁ]+$/i,
|
68
|
+
'kk-KZ': /^[0-9А-ЯЁ\u04D8\u04B0\u0406\u04A2\u0492\u04AE\u049A\u04E8\u04BA]+$/i,
|
69
|
+
'sl-SI': /^[0-9A-ZČĆĐŠŽ]+$/i,
|
70
|
+
'sk-SK': /^[0-9A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,
|
71
|
+
'sr-RS@latin': /^[0-9A-ZČĆŽŠĐ]+$/i,
|
72
|
+
'sr-RS': /^[0-9А-ЯЂЈЉЊЋЏ]+$/i,
|
73
|
+
'sv-SE': /^[0-9A-ZÅÄÖ]+$/i,
|
74
|
+
'th-TH': /^[ก-๙\s]+$/i,
|
75
|
+
'tr-TR': /^[0-9A-ZÇĞİıÖŞÜ]+$/i,
|
76
|
+
'uk-UA': /^[0-9А-ЩЬЮЯЄIЇҐі]+$/i,
|
77
|
+
'ko-KR': /^[0-9ㄱ-ㅎㅏ-ㅣ가-힣]*$/,
|
78
|
+
'ku-IQ': /^[٠١٢٣٤٥٦٧٨٩0-9ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
|
79
|
+
'vi-VN': /^[0-9A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,
|
80
|
+
ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
|
81
|
+
he: /^[0-9א-ת]+$/,
|
82
|
+
fa: /^['0-9آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی۱۲۳۴۵۶۷۸۹۰']+$/i,
|
83
|
+
bn: /^['ঀঁংঃঅআইঈউঊঋঌএঐওঔকখগঘঙচছজঝঞটঠডঢণতথদধনপফবভমযরলশষসহ়ঽািীুূৃৄেৈোৌ্ৎৗড়ঢ়য়ৠৡৢৣ০১২৩৪৫৬৭৮৯ৰৱ৲৳৴৵৶৷৸৹৺৻']+$/,
|
84
|
+
eo: /^[0-9ABCĈD-GĜHĤIJĴK-PRSŜTUŬVZ]+$/i,
|
85
|
+
'hi-IN': /^[\u0900-\u0963]+[\u0966-\u097F]*$/i,
|
86
|
+
'si-LK': /^[0-9\u0D80-\u0DFF]+$/
|
87
|
+
};
|
88
|
+
var decimal = exports.decimal = {
|
89
|
+
'en-US': '.',
|
90
|
+
ar: '٫'
|
91
|
+
};
|
92
|
+
var englishLocales = exports.englishLocales = ['AU', 'GB', 'HK', 'IN', 'NZ', 'ZA', 'ZM'];
|
93
|
+
for (var locale, i = 0; i < englishLocales.length; i++) {
|
94
|
+
locale = "en-".concat(englishLocales[i]);
|
95
|
+
alpha[locale] = alpha['en-US'];
|
96
|
+
alphanumeric[locale] = alphanumeric['en-US'];
|
97
|
+
decimal[locale] = decimal['en-US'];
|
98
|
+
}
|
99
|
+
|
100
|
+
// Source: http://www.localeplanet.com/java/
|
101
|
+
var arabicLocales = exports.arabicLocales = ['AE', 'BH', 'DZ', 'EG', 'IQ', 'JO', 'KW', 'LB', 'LY', 'MA', 'QM', 'QA', 'SA', 'SD', 'SY', 'TN', 'YE'];
|
102
|
+
for (var _locale, _i = 0; _i < arabicLocales.length; _i++) {
|
103
|
+
_locale = "ar-".concat(arabicLocales[_i]);
|
104
|
+
alpha[_locale] = alpha.ar;
|
105
|
+
alphanumeric[_locale] = alphanumeric.ar;
|
106
|
+
decimal[_locale] = decimal.ar;
|
107
|
+
}
|
108
|
+
var farsiLocales = exports.farsiLocales = ['IR', 'AF'];
|
109
|
+
for (var _locale2, _i2 = 0; _i2 < farsiLocales.length; _i2++) {
|
110
|
+
_locale2 = "fa-".concat(farsiLocales[_i2]);
|
111
|
+
alphanumeric[_locale2] = alphanumeric.fa;
|
112
|
+
decimal[_locale2] = decimal.ar;
|
113
|
+
}
|
114
|
+
var bengaliLocales = exports.bengaliLocales = ['BD', 'IN'];
|
115
|
+
for (var _locale3, _i3 = 0; _i3 < bengaliLocales.length; _i3++) {
|
116
|
+
_locale3 = "bn-".concat(bengaliLocales[_i3]);
|
117
|
+
alpha[_locale3] = alpha.bn;
|
118
|
+
alphanumeric[_locale3] = alphanumeric.bn;
|
119
|
+
decimal[_locale3] = decimal['en-US'];
|
120
|
+
}
|
121
|
+
|
122
|
+
// Source: https://en.wikipedia.org/wiki/Decimal_mark
|
123
|
+
var dotDecimal = exports.dotDecimal = ['ar-EG', 'ar-LB', 'ar-LY'];
|
124
|
+
var commaDecimal = exports.commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-ZM', 'eo', 'es-ES', 'fr-CA', 'fr-FR', 'id-ID', 'it-IT', 'ku-IQ', 'hi-IN', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'kk-KZ', 'si-LK', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA', 'vi-VN'];
|
125
|
+
for (var _i4 = 0; _i4 < dotDecimal.length; _i4++) {
|
126
|
+
decimal[dotDecimal[_i4]] = decimal['en-US'];
|
127
|
+
}
|
128
|
+
for (var _i5 = 0; _i5 < commaDecimal.length; _i5++) {
|
129
|
+
decimal[commaDecimal[_i5]] = ',';
|
130
|
+
}
|
131
|
+
alpha['fr-CA'] = alpha['fr-FR'];
|
132
|
+
alphanumeric['fr-CA'] = alphanumeric['fr-FR'];
|
133
|
+
alpha['pt-BR'] = alpha['pt-PT'];
|
134
|
+
alphanumeric['pt-BR'] = alphanumeric['pt-PT'];
|
135
|
+
decimal['pt-BR'] = decimal['pt-PT'];
|
136
|
+
|
137
|
+
// see #862
|
138
|
+
alpha['pl-Pl'] = alpha['pl-PL'];
|
139
|
+
alphanumeric['pl-Pl'] = alphanumeric['pl-PL'];
|
140
|
+
decimal['pl-Pl'] = decimal['pl-PL'];
|
141
|
+
|
142
|
+
// see #1455
|
143
|
+
alpha['fa-AF'] = alpha.fa;
|
package/lib/blacklist.js
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = blacklist;
|
7
|
+
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9
|
+
function blacklist(str, chars) {
|
10
|
+
(0, _assertString.default)(str);
|
11
|
+
return str.replace(new RegExp("[".concat(chars, "]+"), 'g'), '');
|
12
|
+
}
|
13
|
+
module.exports = exports.default;
|
14
|
+
module.exports.default = exports.default;
|
package/lib/contains.js
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = contains;
|
7
|
+
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
8
|
+
var _toString = _interopRequireDefault(require("./util/toString"));
|
9
|
+
var _merge = _interopRequireDefault(require("./util/merge"));
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
+
var defaulContainsOptions = {
|
12
|
+
ignoreCase: false,
|
13
|
+
minOccurrences: 1
|
14
|
+
};
|
15
|
+
function contains(str, elem, options) {
|
16
|
+
(0, _assertString.default)(str);
|
17
|
+
options = (0, _merge.default)(options, defaulContainsOptions);
|
18
|
+
if (options.ignoreCase) {
|
19
|
+
return str.toLowerCase().split((0, _toString.default)(elem).toLowerCase()).length > options.minOccurrences;
|
20
|
+
}
|
21
|
+
return str.split((0, _toString.default)(elem)).length > options.minOccurrences;
|
22
|
+
}
|
23
|
+
module.exports = exports.default;
|
24
|
+
module.exports.default = exports.default;
|
package/lib/equals.js
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = equals;
|
7
|
+
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9
|
+
function equals(str, comparison) {
|
10
|
+
(0, _assertString.default)(str);
|
11
|
+
return str === comparison;
|
12
|
+
}
|
13
|
+
module.exports = exports.default;
|
14
|
+
module.exports.default = exports.default;
|
package/lib/escape.js
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = escape;
|
7
|
+
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9
|
+
function escape(str) {
|
10
|
+
(0, _assertString.default)(str);
|
11
|
+
return str.replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, ''').replace(/</g, '<').replace(/>/g, '>').replace(/\//g, '/').replace(/\\/g, '\').replace(/`/g, '`');
|
12
|
+
}
|
13
|
+
module.exports = exports.default;
|
14
|
+
module.exports.default = exports.default;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = isAbaRouting;
|
7
|
+
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9
|
+
// http://www.brainjar.com/js/validation/
|
10
|
+
// https://www.aba.com/news-research/research-analysis/routing-number-policy-procedures
|
11
|
+
// series reserved for future use are excluded
|
12
|
+
var isRoutingReg = /^(?!(1[3-9])|(20)|(3[3-9])|(4[0-9])|(5[0-9])|(60)|(7[3-9])|(8[1-9])|(9[0-2])|(9[3-9]))[0-9]{9}$/;
|
13
|
+
function isAbaRouting(str) {
|
14
|
+
(0, _assertString.default)(str);
|
15
|
+
if (!isRoutingReg.test(str)) return false;
|
16
|
+
var checkSumVal = 0;
|
17
|
+
for (var i = 0; i < str.length; i++) {
|
18
|
+
if (i % 3 === 0) checkSumVal += str[i] * 3;else if (i % 3 === 1) checkSumVal += str[i] * 7;else checkSumVal += str[i] * 1;
|
19
|
+
}
|
20
|
+
return checkSumVal % 10 === 0;
|
21
|
+
}
|
22
|
+
module.exports = exports.default;
|
23
|
+
module.exports.default = exports.default;
|