z-schema 3.18.4 → 3.21.0
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/README.md +10 -0
- package/dist/ZSchema-browser-min.js +1 -1
- package/dist/ZSchema-browser-min.js.map +1 -1
- package/dist/ZSchema-browser-test.js +1439 -671
- package/dist/ZSchema-browser.js +501 -157
- package/package.json +15 -17
- package/src/Errors.js +1 -0
- package/src/JsonValidation.js +6 -1
- package/src/Report.js +2 -1
- package/src/SchemaCache.js +9 -1
- package/src/Utils.js +14 -4
- package/src/ZSchema.js +41 -21
package/dist/ZSchema-browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ZSchema = f()}})(function(){var define,module,exports;return (function e
|
|
1
|
+
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ZSchema = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
|
2
2
|
(function (global){
|
|
3
3
|
/**
|
|
4
4
|
* lodash (Custom Build) <https://lodash.com/>
|
|
@@ -3042,6 +3042,10 @@ var _isNumeric = require('./lib/isNumeric');
|
|
|
3042
3042
|
|
|
3043
3043
|
var _isNumeric2 = _interopRequireDefault(_isNumeric);
|
|
3044
3044
|
|
|
3045
|
+
var _isPort = require('./lib/isPort');
|
|
3046
|
+
|
|
3047
|
+
var _isPort2 = _interopRequireDefault(_isPort);
|
|
3048
|
+
|
|
3045
3049
|
var _isLowercase = require('./lib/isLowercase');
|
|
3046
3050
|
|
|
3047
3051
|
var _isLowercase2 = _interopRequireDefault(_isLowercase);
|
|
@@ -3174,6 +3178,18 @@ var _isISO = require('./lib/isISO8601');
|
|
|
3174
3178
|
|
|
3175
3179
|
var _isISO2 = _interopRequireDefault(_isISO);
|
|
3176
3180
|
|
|
3181
|
+
var _isRFC = require('./lib/isRFC3339');
|
|
3182
|
+
|
|
3183
|
+
var _isRFC2 = _interopRequireDefault(_isRFC);
|
|
3184
|
+
|
|
3185
|
+
var _isISO31661Alpha = require('./lib/isISO31661Alpha2');
|
|
3186
|
+
|
|
3187
|
+
var _isISO31661Alpha2 = _interopRequireDefault(_isISO31661Alpha);
|
|
3188
|
+
|
|
3189
|
+
var _isISO31661Alpha3 = require('./lib/isISO31661Alpha3');
|
|
3190
|
+
|
|
3191
|
+
var _isISO31661Alpha4 = _interopRequireDefault(_isISO31661Alpha3);
|
|
3192
|
+
|
|
3177
3193
|
var _isBase = require('./lib/isBase64');
|
|
3178
3194
|
|
|
3179
3195
|
var _isBase2 = _interopRequireDefault(_isBase);
|
|
@@ -3182,6 +3198,10 @@ var _isDataURI = require('./lib/isDataURI');
|
|
|
3182
3198
|
|
|
3183
3199
|
var _isDataURI2 = _interopRequireDefault(_isDataURI);
|
|
3184
3200
|
|
|
3201
|
+
var _isMimeType = require('./lib/isMimeType');
|
|
3202
|
+
|
|
3203
|
+
var _isMimeType2 = _interopRequireDefault(_isMimeType);
|
|
3204
|
+
|
|
3185
3205
|
var _isLatLong = require('./lib/isLatLong');
|
|
3186
3206
|
|
|
3187
3207
|
var _isLatLong2 = _interopRequireDefault(_isLatLong);
|
|
@@ -3236,7 +3256,7 @@ var _toString2 = _interopRequireDefault(_toString);
|
|
|
3236
3256
|
|
|
3237
3257
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
3238
3258
|
|
|
3239
|
-
var version = '
|
|
3259
|
+
var version = '10.2.0';
|
|
3240
3260
|
|
|
3241
3261
|
var validator = {
|
|
3242
3262
|
version: version,
|
|
@@ -3256,6 +3276,7 @@ var validator = {
|
|
|
3256
3276
|
isAlpha: _isAlpha2.default,
|
|
3257
3277
|
isAlphanumeric: _isAlphanumeric2.default,
|
|
3258
3278
|
isNumeric: _isNumeric2.default,
|
|
3279
|
+
isPort: _isPort2.default,
|
|
3259
3280
|
isLowercase: _isLowercase2.default,
|
|
3260
3281
|
isUppercase: _isUppercase2.default,
|
|
3261
3282
|
isAscii: _isAscii2.default,
|
|
@@ -3288,10 +3309,15 @@ var validator = {
|
|
|
3288
3309
|
isISSN: _isISSN2.default,
|
|
3289
3310
|
isMobilePhone: _isMobilePhone2.default,
|
|
3290
3311
|
isPostalCode: _isPostalCode2.default,
|
|
3312
|
+
isPostalCodeLocales: _isPostalCode.locales,
|
|
3291
3313
|
isCurrency: _isCurrency2.default,
|
|
3292
3314
|
isISO8601: _isISO2.default,
|
|
3315
|
+
isRFC3339: _isRFC2.default,
|
|
3316
|
+
isISO31661Alpha2: _isISO31661Alpha2.default,
|
|
3317
|
+
isISO31661Alpha3: _isISO31661Alpha4.default,
|
|
3293
3318
|
isBase64: _isBase2.default,
|
|
3294
3319
|
isDataURI: _isDataURI2.default,
|
|
3320
|
+
isMimeType: _isMimeType2.default,
|
|
3295
3321
|
isLatLong: _isLatLong2.default,
|
|
3296
3322
|
ltrim: _ltrim2.default,
|
|
3297
3323
|
rtrim: _rtrim2.default,
|
|
@@ -3308,7 +3334,7 @@ var validator = {
|
|
|
3308
3334
|
|
|
3309
3335
|
exports.default = validator;
|
|
3310
3336
|
module.exports = exports['default'];
|
|
3311
|
-
},{"./lib/blacklist":6,"./lib/contains":7,"./lib/equals":8,"./lib/escape":9,"./lib/isAfter":10,"./lib/isAlpha":11,"./lib/isAlphanumeric":12,"./lib/isAscii":13,"./lib/isBase64":14,"./lib/isBefore":15,"./lib/isBoolean":16,"./lib/isByteLength":17,"./lib/isCreditCard":18,"./lib/isCurrency":19,"./lib/isDataURI":20,"./lib/isDecimal":21,"./lib/isDivisibleBy":22,"./lib/isEmail":23,"./lib/isEmpty":24,"./lib/isFQDN":25,"./lib/isFloat":26,"./lib/isFullWidth":27,"./lib/isHalfWidth":28,"./lib/isHash":29,"./lib/isHexColor":30,"./lib/isHexadecimal":31,"./lib/isIP":32,"./lib/isISBN":33,"./lib/isISIN":34,"./lib/
|
|
3337
|
+
},{"./lib/blacklist":6,"./lib/contains":7,"./lib/equals":8,"./lib/escape":9,"./lib/isAfter":10,"./lib/isAlpha":11,"./lib/isAlphanumeric":12,"./lib/isAscii":13,"./lib/isBase64":14,"./lib/isBefore":15,"./lib/isBoolean":16,"./lib/isByteLength":17,"./lib/isCreditCard":18,"./lib/isCurrency":19,"./lib/isDataURI":20,"./lib/isDecimal":21,"./lib/isDivisibleBy":22,"./lib/isEmail":23,"./lib/isEmpty":24,"./lib/isFQDN":25,"./lib/isFloat":26,"./lib/isFullWidth":27,"./lib/isHalfWidth":28,"./lib/isHash":29,"./lib/isHexColor":30,"./lib/isHexadecimal":31,"./lib/isIP":32,"./lib/isISBN":33,"./lib/isISIN":34,"./lib/isISO31661Alpha2":35,"./lib/isISO31661Alpha3":36,"./lib/isISO8601":37,"./lib/isISRC":38,"./lib/isISSN":39,"./lib/isIn":40,"./lib/isInt":41,"./lib/isJSON":42,"./lib/isLatLong":43,"./lib/isLength":44,"./lib/isLowercase":45,"./lib/isMACAddress":46,"./lib/isMD5":47,"./lib/isMimeType":48,"./lib/isMobilePhone":49,"./lib/isMongoId":50,"./lib/isMultibyte":51,"./lib/isNumeric":52,"./lib/isPort":53,"./lib/isPostalCode":54,"./lib/isRFC3339":55,"./lib/isSurrogatePair":56,"./lib/isURL":57,"./lib/isUUID":58,"./lib/isUppercase":59,"./lib/isVariableWidth":60,"./lib/isWhitelisted":61,"./lib/ltrim":62,"./lib/matches":63,"./lib/normalizeEmail":64,"./lib/rtrim":65,"./lib/stripLow":66,"./lib/toBoolean":67,"./lib/toDate":68,"./lib/toFloat":69,"./lib/toInt":70,"./lib/trim":71,"./lib/unescape":72,"./lib/util/toString":75,"./lib/whitelist":76}],5:[function(require,module,exports){
|
|
3312
3338
|
'use strict';
|
|
3313
3339
|
|
|
3314
3340
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3316,9 +3342,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3316
3342
|
});
|
|
3317
3343
|
var alpha = exports.alpha = {
|
|
3318
3344
|
'en-US': /^[A-Z]+$/i,
|
|
3345
|
+
'bg-BG': /^[А-Я]+$/i,
|
|
3319
3346
|
'cs-CZ': /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
|
|
3320
3347
|
'da-DK': /^[A-ZÆØÅ]+$/i,
|
|
3321
3348
|
'de-DE': /^[A-ZÄÖÜß]+$/i,
|
|
3349
|
+
'el-GR': /^[Α-ω]+$/i,
|
|
3322
3350
|
'es-ES': /^[A-ZÁÉÍÑÓÚÜ]+$/i,
|
|
3323
3351
|
'fr-FR': /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,
|
|
3324
3352
|
'it-IT': /^[A-ZÀÉÈÌÎÓÒÙ]+$/i,
|
|
@@ -3329,19 +3357,22 @@ var alpha = exports.alpha = {
|
|
|
3329
3357
|
'pl-PL': /^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
|
|
3330
3358
|
'pt-PT': /^[A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i,
|
|
3331
3359
|
'ru-RU': /^[А-ЯЁ]+$/i,
|
|
3360
|
+
'sk-SK': /^[A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,
|
|
3332
3361
|
'sr-RS@latin': /^[A-ZČĆŽŠĐ]+$/i,
|
|
3333
3362
|
'sr-RS': /^[А-ЯЂЈЉЊЋЏ]+$/i,
|
|
3334
3363
|
'sv-SE': /^[A-ZÅÄÖ]+$/i,
|
|
3335
3364
|
'tr-TR': /^[A-ZÇĞİıÖŞÜ]+$/i,
|
|
3336
|
-
'uk-UA': /^[А-ЩЬЮЯЄI
|
|
3365
|
+
'uk-UA': /^[А-ЩЬЮЯЄIЇҐі]+$/i,
|
|
3337
3366
|
ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/
|
|
3338
3367
|
};
|
|
3339
3368
|
|
|
3340
3369
|
var alphanumeric = exports.alphanumeric = {
|
|
3341
3370
|
'en-US': /^[0-9A-Z]+$/i,
|
|
3371
|
+
'bg-BG': /^[0-9А-Я]+$/i,
|
|
3342
3372
|
'cs-CZ': /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
|
|
3343
3373
|
'da-DK': /^[0-9A-ZÆØÅ]+$/i,
|
|
3344
3374
|
'de-DE': /^[0-9A-ZÄÖÜß]+$/i,
|
|
3375
|
+
'el-GR': /^[0-9Α-ω]+$/i,
|
|
3345
3376
|
'es-ES': /^[0-9A-ZÁÉÍÑÓÚÜ]+$/i,
|
|
3346
3377
|
'fr-FR': /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,
|
|
3347
3378
|
'it-IT': /^[0-9A-ZÀÉÈÌÎÓÒÙ]+$/i,
|
|
@@ -3352,25 +3383,29 @@ var alphanumeric = exports.alphanumeric = {
|
|
|
3352
3383
|
'pl-PL': /^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
|
|
3353
3384
|
'pt-PT': /^[0-9A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i,
|
|
3354
3385
|
'ru-RU': /^[0-9А-ЯЁ]+$/i,
|
|
3386
|
+
'sk-SK': /^[0-9A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,
|
|
3355
3387
|
'sr-RS@latin': /^[0-9A-ZČĆŽŠĐ]+$/i,
|
|
3356
3388
|
'sr-RS': /^[0-9А-ЯЂЈЉЊЋЏ]+$/i,
|
|
3357
3389
|
'sv-SE': /^[0-9A-ZÅÄÖ]+$/i,
|
|
3358
3390
|
'tr-TR': /^[0-9A-ZÇĞİıÖŞÜ]+$/i,
|
|
3359
|
-
'uk-UA': /^[0-9А-ЩЬЮЯЄI
|
|
3391
|
+
'uk-UA': /^[0-9А-ЩЬЮЯЄIЇҐі]+$/i,
|
|
3360
3392
|
ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/
|
|
3361
3393
|
};
|
|
3362
3394
|
|
|
3395
|
+
var decimal = exports.decimal = {
|
|
3396
|
+
'en-US': '.',
|
|
3397
|
+
ar: '٫'
|
|
3398
|
+
};
|
|
3399
|
+
|
|
3363
3400
|
var englishLocales = exports.englishLocales = ['AU', 'GB', 'HK', 'IN', 'NZ', 'ZA', 'ZM'];
|
|
3364
3401
|
|
|
3365
3402
|
for (var locale, i = 0; i < englishLocales.length; i++) {
|
|
3366
3403
|
locale = 'en-' + englishLocales[i];
|
|
3367
3404
|
alpha[locale] = alpha['en-US'];
|
|
3368
3405
|
alphanumeric[locale] = alphanumeric['en-US'];
|
|
3406
|
+
decimal[locale] = decimal['en-US'];
|
|
3369
3407
|
}
|
|
3370
3408
|
|
|
3371
|
-
alpha['pt-BR'] = alpha['pt-PT'];
|
|
3372
|
-
alphanumeric['pt-BR'] = alphanumeric['pt-PT'];
|
|
3373
|
-
|
|
3374
3409
|
// Source: http://www.localeplanet.com/java/
|
|
3375
3410
|
var arabicLocales = exports.arabicLocales = ['AE', 'BH', 'DZ', 'EG', 'IQ', 'JO', 'KW', 'LB', 'LY', 'MA', 'QM', 'QA', 'SA', 'SD', 'SY', 'TN', 'YE'];
|
|
3376
3411
|
|
|
@@ -3378,7 +3413,24 @@ for (var _locale, _i = 0; _i < arabicLocales.length; _i++) {
|
|
|
3378
3413
|
_locale = 'ar-' + arabicLocales[_i];
|
|
3379
3414
|
alpha[_locale] = alpha.ar;
|
|
3380
3415
|
alphanumeric[_locale] = alphanumeric.ar;
|
|
3416
|
+
decimal[_locale] = decimal.ar;
|
|
3417
|
+
}
|
|
3418
|
+
|
|
3419
|
+
// Source: https://en.wikipedia.org/wiki/Decimal_mark
|
|
3420
|
+
var dotDecimal = exports.dotDecimal = [];
|
|
3421
|
+
var commaDecimal = exports.commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'es-ES', 'fr-FR', 'it-IT', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-Pl', 'pt-PT', 'ru-RU', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA'];
|
|
3422
|
+
|
|
3423
|
+
for (var _i2 = 0; _i2 < dotDecimal.length; _i2++) {
|
|
3424
|
+
decimal[dotDecimal[_i2]] = decimal['en-US'];
|
|
3381
3425
|
}
|
|
3426
|
+
|
|
3427
|
+
for (var _i3 = 0; _i3 < commaDecimal.length; _i3++) {
|
|
3428
|
+
decimal[commaDecimal[_i3]] = ',';
|
|
3429
|
+
}
|
|
3430
|
+
|
|
3431
|
+
alpha['pt-BR'] = alpha['pt-PT'];
|
|
3432
|
+
alphanumeric['pt-BR'] = alphanumeric['pt-PT'];
|
|
3433
|
+
decimal['pt-BR'] = decimal['pt-PT'];
|
|
3382
3434
|
},{}],6:[function(require,module,exports){
|
|
3383
3435
|
'use strict';
|
|
3384
3436
|
|
|
@@ -3398,7 +3450,7 @@ function blacklist(str, chars) {
|
|
|
3398
3450
|
return str.replace(new RegExp('[' + chars + ']+', 'g'), '');
|
|
3399
3451
|
}
|
|
3400
3452
|
module.exports = exports['default'];
|
|
3401
|
-
},{"./util/assertString":
|
|
3453
|
+
},{"./util/assertString":73}],7:[function(require,module,exports){
|
|
3402
3454
|
'use strict';
|
|
3403
3455
|
|
|
3404
3456
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3421,7 +3473,7 @@ function contains(str, elem) {
|
|
|
3421
3473
|
return str.indexOf((0, _toString2.default)(elem)) >= 0;
|
|
3422
3474
|
}
|
|
3423
3475
|
module.exports = exports['default'];
|
|
3424
|
-
},{"./util/assertString":
|
|
3476
|
+
},{"./util/assertString":73,"./util/toString":75}],8:[function(require,module,exports){
|
|
3425
3477
|
'use strict';
|
|
3426
3478
|
|
|
3427
3479
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3440,7 +3492,7 @@ function equals(str, comparison) {
|
|
|
3440
3492
|
return str === comparison;
|
|
3441
3493
|
}
|
|
3442
3494
|
module.exports = exports['default'];
|
|
3443
|
-
},{"./util/assertString":
|
|
3495
|
+
},{"./util/assertString":73}],9:[function(require,module,exports){
|
|
3444
3496
|
'use strict';
|
|
3445
3497
|
|
|
3446
3498
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3459,7 +3511,7 @@ function escape(str) {
|
|
|
3459
3511
|
return str.replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, ''').replace(/</g, '<').replace(/>/g, '>').replace(/\//g, '/').replace(/\\/g, '\').replace(/`/g, '`');
|
|
3460
3512
|
}
|
|
3461
3513
|
module.exports = exports['default'];
|
|
3462
|
-
},{"./util/assertString":
|
|
3514
|
+
},{"./util/assertString":73}],10:[function(require,module,exports){
|
|
3463
3515
|
'use strict';
|
|
3464
3516
|
|
|
3465
3517
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3486,7 +3538,7 @@ function isAfter(str) {
|
|
|
3486
3538
|
return !!(original && comparison && original > comparison);
|
|
3487
3539
|
}
|
|
3488
3540
|
module.exports = exports['default'];
|
|
3489
|
-
},{"./toDate":
|
|
3541
|
+
},{"./toDate":68,"./util/assertString":73}],11:[function(require,module,exports){
|
|
3490
3542
|
'use strict';
|
|
3491
3543
|
|
|
3492
3544
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3512,7 +3564,7 @@ function isAlpha(str) {
|
|
|
3512
3564
|
throw new Error('Invalid locale \'' + locale + '\'');
|
|
3513
3565
|
}
|
|
3514
3566
|
module.exports = exports['default'];
|
|
3515
|
-
},{"./alpha":5,"./util/assertString":
|
|
3567
|
+
},{"./alpha":5,"./util/assertString":73}],12:[function(require,module,exports){
|
|
3516
3568
|
'use strict';
|
|
3517
3569
|
|
|
3518
3570
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3538,7 +3590,7 @@ function isAlphanumeric(str) {
|
|
|
3538
3590
|
throw new Error('Invalid locale \'' + locale + '\'');
|
|
3539
3591
|
}
|
|
3540
3592
|
module.exports = exports['default'];
|
|
3541
|
-
},{"./alpha":5,"./util/assertString":
|
|
3593
|
+
},{"./alpha":5,"./util/assertString":73}],13:[function(require,module,exports){
|
|
3542
3594
|
'use strict';
|
|
3543
3595
|
|
|
3544
3596
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3561,7 +3613,7 @@ function isAscii(str) {
|
|
|
3561
3613
|
return ascii.test(str);
|
|
3562
3614
|
}
|
|
3563
3615
|
module.exports = exports['default'];
|
|
3564
|
-
},{"./util/assertString":
|
|
3616
|
+
},{"./util/assertString":73}],14:[function(require,module,exports){
|
|
3565
3617
|
'use strict';
|
|
3566
3618
|
|
|
3567
3619
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3587,7 +3639,7 @@ function isBase64(str) {
|
|
|
3587
3639
|
return firstPaddingChar === -1 || firstPaddingChar === len - 1 || firstPaddingChar === len - 2 && str[len - 1] === '=';
|
|
3588
3640
|
}
|
|
3589
3641
|
module.exports = exports['default'];
|
|
3590
|
-
},{"./util/assertString":
|
|
3642
|
+
},{"./util/assertString":73}],15:[function(require,module,exports){
|
|
3591
3643
|
'use strict';
|
|
3592
3644
|
|
|
3593
3645
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3614,7 +3666,7 @@ function isBefore(str) {
|
|
|
3614
3666
|
return !!(original && comparison && original < comparison);
|
|
3615
3667
|
}
|
|
3616
3668
|
module.exports = exports['default'];
|
|
3617
|
-
},{"./toDate":
|
|
3669
|
+
},{"./toDate":68,"./util/assertString":73}],16:[function(require,module,exports){
|
|
3618
3670
|
'use strict';
|
|
3619
3671
|
|
|
3620
3672
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3633,7 +3685,7 @@ function isBoolean(str) {
|
|
|
3633
3685
|
return ['true', 'false', '1', '0'].indexOf(str) >= 0;
|
|
3634
3686
|
}
|
|
3635
3687
|
module.exports = exports['default'];
|
|
3636
|
-
},{"./util/assertString":
|
|
3688
|
+
},{"./util/assertString":73}],17:[function(require,module,exports){
|
|
3637
3689
|
'use strict';
|
|
3638
3690
|
|
|
3639
3691
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3667,7 +3719,7 @@ function isByteLength(str, options) {
|
|
|
3667
3719
|
return len >= min && (typeof max === 'undefined' || len <= max);
|
|
3668
3720
|
}
|
|
3669
3721
|
module.exports = exports['default'];
|
|
3670
|
-
},{"./util/assertString":
|
|
3722
|
+
},{"./util/assertString":73}],18:[function(require,module,exports){
|
|
3671
3723
|
'use strict';
|
|
3672
3724
|
|
|
3673
3725
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3682,7 +3734,7 @@ var _assertString2 = _interopRequireDefault(_assertString);
|
|
|
3682
3734
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
3683
3735
|
|
|
3684
3736
|
/* eslint-disable max-len */
|
|
3685
|
-
var creditCard = /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|
|
|
3737
|
+
var creditCard = /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14})$/;
|
|
3686
3738
|
/* eslint-enable max-len */
|
|
3687
3739
|
|
|
3688
3740
|
function isCreditCard(str) {
|
|
@@ -3713,7 +3765,7 @@ function isCreditCard(str) {
|
|
|
3713
3765
|
return !!(sum % 10 === 0 ? sanitized : false);
|
|
3714
3766
|
}
|
|
3715
3767
|
module.exports = exports['default'];
|
|
3716
|
-
},{"./util/assertString":
|
|
3768
|
+
},{"./util/assertString":73}],19:[function(require,module,exports){
|
|
3717
3769
|
'use strict';
|
|
3718
3770
|
|
|
3719
3771
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3806,7 +3858,7 @@ function isCurrency(str, options) {
|
|
|
3806
3858
|
return currencyRegex(options).test(str);
|
|
3807
3859
|
}
|
|
3808
3860
|
module.exports = exports['default'];
|
|
3809
|
-
},{"./util/assertString":
|
|
3861
|
+
},{"./util/assertString":73,"./util/merge":74}],20:[function(require,module,exports){
|
|
3810
3862
|
'use strict';
|
|
3811
3863
|
|
|
3812
3864
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3820,14 +3872,43 @@ var _assertString2 = _interopRequireDefault(_assertString);
|
|
|
3820
3872
|
|
|
3821
3873
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
3822
3874
|
|
|
3823
|
-
var
|
|
3875
|
+
var validMediaType = /^[a-z]+\/[a-z0-9\-\+]+$/i;
|
|
3876
|
+
|
|
3877
|
+
var validAttribute = /^[a-z\-]+=[a-z0-9\-]+$/i;
|
|
3878
|
+
|
|
3879
|
+
var validData = /^[a-z0-9!\$&'\(\)\*\+,;=\-\._~:@\/\?%\s]*$/i;
|
|
3824
3880
|
|
|
3825
3881
|
function isDataURI(str) {
|
|
3826
3882
|
(0, _assertString2.default)(str);
|
|
3827
|
-
|
|
3883
|
+
var data = str.split(',');
|
|
3884
|
+
if (data.length < 2) {
|
|
3885
|
+
return false;
|
|
3886
|
+
}
|
|
3887
|
+
var attributes = data.shift().trim().split(';');
|
|
3888
|
+
var schemeAndMediaType = attributes.shift();
|
|
3889
|
+
if (schemeAndMediaType.substr(0, 5) !== 'data:') {
|
|
3890
|
+
return false;
|
|
3891
|
+
}
|
|
3892
|
+
var mediaType = schemeAndMediaType.substr(5);
|
|
3893
|
+
if (mediaType !== '' && !validMediaType.test(mediaType)) {
|
|
3894
|
+
return false;
|
|
3895
|
+
}
|
|
3896
|
+
for (var i = 0; i < attributes.length; i++) {
|
|
3897
|
+
if (i === attributes.length - 1 && attributes[i].toLowerCase() === 'base64') {
|
|
3898
|
+
// ok
|
|
3899
|
+
} else if (!validAttribute.test(attributes[i])) {
|
|
3900
|
+
return false;
|
|
3901
|
+
}
|
|
3902
|
+
}
|
|
3903
|
+
for (var _i = 0; _i < data.length; _i++) {
|
|
3904
|
+
if (!validData.test(data[_i])) {
|
|
3905
|
+
return false;
|
|
3906
|
+
}
|
|
3907
|
+
}
|
|
3908
|
+
return true;
|
|
3828
3909
|
}
|
|
3829
3910
|
module.exports = exports['default'];
|
|
3830
|
-
},{"./util/assertString":
|
|
3911
|
+
},{"./util/assertString":73}],21:[function(require,module,exports){
|
|
3831
3912
|
'use strict';
|
|
3832
3913
|
|
|
3833
3914
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3835,20 +3916,41 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3835
3916
|
});
|
|
3836
3917
|
exports.default = isDecimal;
|
|
3837
3918
|
|
|
3919
|
+
var _merge = require('./util/merge');
|
|
3920
|
+
|
|
3921
|
+
var _merge2 = _interopRequireDefault(_merge);
|
|
3922
|
+
|
|
3838
3923
|
var _assertString = require('./util/assertString');
|
|
3839
3924
|
|
|
3840
3925
|
var _assertString2 = _interopRequireDefault(_assertString);
|
|
3841
3926
|
|
|
3927
|
+
var _alpha = require('./alpha');
|
|
3928
|
+
|
|
3842
3929
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
3843
3930
|
|
|
3844
|
-
|
|
3931
|
+
function decimalRegExp(options) {
|
|
3932
|
+
var regExp = new RegExp('^[-+]?([0-9]+)?(\\' + _alpha.decimal[options.locale] + '[0-9]{' + options.decimal_digits + '})' + (options.force_decimal ? '' : '?') + '$');
|
|
3933
|
+
return regExp;
|
|
3934
|
+
}
|
|
3935
|
+
|
|
3936
|
+
var default_decimal_options = {
|
|
3937
|
+
force_decimal: false,
|
|
3938
|
+
decimal_digits: '1,',
|
|
3939
|
+
locale: 'en-US'
|
|
3940
|
+
};
|
|
3845
3941
|
|
|
3846
|
-
|
|
3942
|
+
var blacklist = ['', '-', '+'];
|
|
3943
|
+
|
|
3944
|
+
function isDecimal(str, options) {
|
|
3847
3945
|
(0, _assertString2.default)(str);
|
|
3848
|
-
|
|
3946
|
+
options = (0, _merge2.default)(options, default_decimal_options);
|
|
3947
|
+
if (options.locale in _alpha.decimal) {
|
|
3948
|
+
return !blacklist.includes(str.replace(/ /g, '')) && decimalRegExp(options).test(str);
|
|
3949
|
+
}
|
|
3950
|
+
throw new Error('Invalid locale \'' + options.locale + '\'');
|
|
3849
3951
|
}
|
|
3850
3952
|
module.exports = exports['default'];
|
|
3851
|
-
},{"./util/assertString":
|
|
3953
|
+
},{"./alpha":5,"./util/assertString":73,"./util/merge":74}],22:[function(require,module,exports){
|
|
3852
3954
|
'use strict';
|
|
3853
3955
|
|
|
3854
3956
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3871,7 +3973,7 @@ function isDivisibleBy(str, num) {
|
|
|
3871
3973
|
return (0, _toFloat2.default)(str) % parseInt(num, 10) === 0;
|
|
3872
3974
|
}
|
|
3873
3975
|
module.exports = exports['default'];
|
|
3874
|
-
},{"./toFloat":
|
|
3976
|
+
},{"./toFloat":69,"./util/assertString":73}],23:[function(require,module,exports){
|
|
3875
3977
|
'use strict';
|
|
3876
3978
|
|
|
3877
3979
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3932,8 +4034,16 @@ function isEmail(str, options) {
|
|
|
3932
4034
|
var user = parts.join('@');
|
|
3933
4035
|
|
|
3934
4036
|
var lower_domain = domain.toLowerCase();
|
|
4037
|
+
|
|
3935
4038
|
if (lower_domain === 'gmail.com' || lower_domain === 'googlemail.com') {
|
|
3936
|
-
|
|
4039
|
+
/*
|
|
4040
|
+
Previously we removed dots for gmail addresses before validating.
|
|
4041
|
+
This was removed because it allows `multiple..dots@gmail.com`
|
|
4042
|
+
to be reported as valid, but it is not.
|
|
4043
|
+
Gmail only normalizes single dots, removing them from here is pointless,
|
|
4044
|
+
should be done in normalizeEmail
|
|
4045
|
+
*/
|
|
4046
|
+
user = user.toLowerCase();
|
|
3937
4047
|
}
|
|
3938
4048
|
|
|
3939
4049
|
if (!(0, _isByteLength2.default)(user, { max: 64 }) || !(0, _isByteLength2.default)(domain, { max: 254 })) {
|
|
@@ -3961,7 +4071,7 @@ function isEmail(str, options) {
|
|
|
3961
4071
|
return true;
|
|
3962
4072
|
}
|
|
3963
4073
|
module.exports = exports['default'];
|
|
3964
|
-
},{"./isByteLength":17,"./isFQDN":25,"./util/assertString":
|
|
4074
|
+
},{"./isByteLength":17,"./isFQDN":25,"./util/assertString":73,"./util/merge":74}],24:[function(require,module,exports){
|
|
3965
4075
|
'use strict';
|
|
3966
4076
|
|
|
3967
4077
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3980,13 +4090,13 @@ function isEmpty(str) {
|
|
|
3980
4090
|
return str.length === 0;
|
|
3981
4091
|
}
|
|
3982
4092
|
module.exports = exports['default'];
|
|
3983
|
-
},{"./util/assertString":
|
|
4093
|
+
},{"./util/assertString":73}],25:[function(require,module,exports){
|
|
3984
4094
|
'use strict';
|
|
3985
4095
|
|
|
3986
4096
|
Object.defineProperty(exports, "__esModule", {
|
|
3987
4097
|
value: true
|
|
3988
4098
|
});
|
|
3989
|
-
exports.default =
|
|
4099
|
+
exports.default = isFQDN;
|
|
3990
4100
|
|
|
3991
4101
|
var _assertString = require('./util/assertString');
|
|
3992
4102
|
|
|
@@ -4004,7 +4114,7 @@ var default_fqdn_options = {
|
|
|
4004
4114
|
allow_trailing_dot: false
|
|
4005
4115
|
};
|
|
4006
4116
|
|
|
4007
|
-
function
|
|
4117
|
+
function isFQDN(str, options) {
|
|
4008
4118
|
(0, _assertString2.default)(str);
|
|
4009
4119
|
options = (0, _merge2.default)(options, default_fqdn_options);
|
|
4010
4120
|
|
|
@@ -4013,6 +4123,11 @@ function isFDQN(str, options) {
|
|
|
4013
4123
|
str = str.substring(0, str.length - 1);
|
|
4014
4124
|
}
|
|
4015
4125
|
var parts = str.split('.');
|
|
4126
|
+
for (var i = 0; i < parts.length; i++) {
|
|
4127
|
+
if (parts[i].length > 63) {
|
|
4128
|
+
return false;
|
|
4129
|
+
}
|
|
4130
|
+
}
|
|
4016
4131
|
if (options.require_tld) {
|
|
4017
4132
|
var tld = parts.pop();
|
|
4018
4133
|
if (!parts.length || !/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {
|
|
@@ -4023,8 +4138,8 @@ function isFDQN(str, options) {
|
|
|
4023
4138
|
return false;
|
|
4024
4139
|
}
|
|
4025
4140
|
}
|
|
4026
|
-
for (var part,
|
|
4027
|
-
part = parts[
|
|
4141
|
+
for (var part, _i = 0; _i < parts.length; _i++) {
|
|
4142
|
+
part = parts[_i];
|
|
4028
4143
|
if (options.allow_underscores) {
|
|
4029
4144
|
part = part.replace(/_/g, '');
|
|
4030
4145
|
}
|
|
@@ -4042,7 +4157,7 @@ function isFDQN(str, options) {
|
|
|
4042
4157
|
return true;
|
|
4043
4158
|
}
|
|
4044
4159
|
module.exports = exports['default'];
|
|
4045
|
-
},{"./util/assertString":
|
|
4160
|
+
},{"./util/assertString":73,"./util/merge":74}],26:[function(require,module,exports){
|
|
4046
4161
|
'use strict';
|
|
4047
4162
|
|
|
4048
4163
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4054,20 +4169,22 @@ var _assertString = require('./util/assertString');
|
|
|
4054
4169
|
|
|
4055
4170
|
var _assertString2 = _interopRequireDefault(_assertString);
|
|
4056
4171
|
|
|
4057
|
-
|
|
4172
|
+
var _alpha = require('./alpha');
|
|
4058
4173
|
|
|
4059
|
-
|
|
4174
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
4060
4175
|
|
|
4061
4176
|
function isFloat(str, options) {
|
|
4062
4177
|
(0, _assertString2.default)(str);
|
|
4063
4178
|
options = options || {};
|
|
4064
|
-
|
|
4179
|
+
var float = new RegExp('^(?:[-+])?(?:[0-9]+)?(?:\\' + (options.locale ? _alpha.decimal[options.locale] : '.') + '[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$');
|
|
4180
|
+
if (str === '' || str === '.' || str === '-' || str === '+') {
|
|
4065
4181
|
return false;
|
|
4066
4182
|
}
|
|
4067
|
-
|
|
4183
|
+
var value = parseFloat(str.replace(',', '.'));
|
|
4184
|
+
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);
|
|
4068
4185
|
}
|
|
4069
4186
|
module.exports = exports['default'];
|
|
4070
|
-
},{"./util/assertString":
|
|
4187
|
+
},{"./alpha":5,"./util/assertString":73}],27:[function(require,module,exports){
|
|
4071
4188
|
'use strict';
|
|
4072
4189
|
|
|
4073
4190
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4088,7 +4205,7 @@ function isFullWidth(str) {
|
|
|
4088
4205
|
(0, _assertString2.default)(str);
|
|
4089
4206
|
return fullWidth.test(str);
|
|
4090
4207
|
}
|
|
4091
|
-
},{"./util/assertString":
|
|
4208
|
+
},{"./util/assertString":73}],28:[function(require,module,exports){
|
|
4092
4209
|
'use strict';
|
|
4093
4210
|
|
|
4094
4211
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4109,7 +4226,7 @@ function isHalfWidth(str) {
|
|
|
4109
4226
|
(0, _assertString2.default)(str);
|
|
4110
4227
|
return halfWidth.test(str);
|
|
4111
4228
|
}
|
|
4112
|
-
},{"./util/assertString":
|
|
4229
|
+
},{"./util/assertString":73}],29:[function(require,module,exports){
|
|
4113
4230
|
'use strict';
|
|
4114
4231
|
|
|
4115
4232
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4145,7 +4262,7 @@ function isHash(str, algorithm) {
|
|
|
4145
4262
|
return hash.test(str);
|
|
4146
4263
|
}
|
|
4147
4264
|
module.exports = exports['default'];
|
|
4148
|
-
},{"./util/assertString":
|
|
4265
|
+
},{"./util/assertString":73}],30:[function(require,module,exports){
|
|
4149
4266
|
'use strict';
|
|
4150
4267
|
|
|
4151
4268
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4166,7 +4283,7 @@ function isHexColor(str) {
|
|
|
4166
4283
|
return hexcolor.test(str);
|
|
4167
4284
|
}
|
|
4168
4285
|
module.exports = exports['default'];
|
|
4169
|
-
},{"./util/assertString":
|
|
4286
|
+
},{"./util/assertString":73}],31:[function(require,module,exports){
|
|
4170
4287
|
'use strict';
|
|
4171
4288
|
|
|
4172
4289
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4187,7 +4304,7 @@ function isHexadecimal(str) {
|
|
|
4187
4304
|
return hexadecimal.test(str);
|
|
4188
4305
|
}
|
|
4189
4306
|
module.exports = exports['default'];
|
|
4190
|
-
},{"./util/assertString":
|
|
4307
|
+
},{"./util/assertString":73}],32:[function(require,module,exports){
|
|
4191
4308
|
'use strict';
|
|
4192
4309
|
|
|
4193
4310
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4269,7 +4386,7 @@ function isIP(str) {
|
|
|
4269
4386
|
return false;
|
|
4270
4387
|
}
|
|
4271
4388
|
module.exports = exports['default'];
|
|
4272
|
-
},{"./util/assertString":
|
|
4389
|
+
},{"./util/assertString":73}],33:[function(require,module,exports){
|
|
4273
4390
|
'use strict';
|
|
4274
4391
|
|
|
4275
4392
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4327,7 +4444,7 @@ function isISBN(str) {
|
|
|
4327
4444
|
return false;
|
|
4328
4445
|
}
|
|
4329
4446
|
module.exports = exports['default'];
|
|
4330
|
-
},{"./util/assertString":
|
|
4447
|
+
},{"./util/assertString":73}],34:[function(require,module,exports){
|
|
4331
4448
|
'use strict';
|
|
4332
4449
|
|
|
4333
4450
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4376,7 +4493,51 @@ function isISIN(str) {
|
|
|
4376
4493
|
return parseInt(str.substr(str.length - 1), 10) === (10000 - sum) % 10;
|
|
4377
4494
|
}
|
|
4378
4495
|
module.exports = exports['default'];
|
|
4379
|
-
},{"./util/assertString":
|
|
4496
|
+
},{"./util/assertString":73}],35:[function(require,module,exports){
|
|
4497
|
+
'use strict';
|
|
4498
|
+
|
|
4499
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4500
|
+
value: true
|
|
4501
|
+
});
|
|
4502
|
+
exports.default = isISO31661Alpha2;
|
|
4503
|
+
|
|
4504
|
+
var _assertString = require('./util/assertString');
|
|
4505
|
+
|
|
4506
|
+
var _assertString2 = _interopRequireDefault(_assertString);
|
|
4507
|
+
|
|
4508
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
4509
|
+
|
|
4510
|
+
// from https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
|
4511
|
+
var validISO31661Alpha2CountriesCodes = ['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', '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'];
|
|
4512
|
+
|
|
4513
|
+
function isISO31661Alpha2(str) {
|
|
4514
|
+
(0, _assertString2.default)(str);
|
|
4515
|
+
return validISO31661Alpha2CountriesCodes.includes(str.toUpperCase());
|
|
4516
|
+
}
|
|
4517
|
+
module.exports = exports['default'];
|
|
4518
|
+
},{"./util/assertString":73}],36:[function(require,module,exports){
|
|
4519
|
+
'use strict';
|
|
4520
|
+
|
|
4521
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4522
|
+
value: true
|
|
4523
|
+
});
|
|
4524
|
+
exports.default = isISO31661Alpha3;
|
|
4525
|
+
|
|
4526
|
+
var _assertString = require('./util/assertString');
|
|
4527
|
+
|
|
4528
|
+
var _assertString2 = _interopRequireDefault(_assertString);
|
|
4529
|
+
|
|
4530
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
4531
|
+
|
|
4532
|
+
// from https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
|
|
4533
|
+
var validISO31661Alpha3CountriesCodes = ['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'];
|
|
4534
|
+
|
|
4535
|
+
function isISO31661Alpha3(str) {
|
|
4536
|
+
(0, _assertString2.default)(str);
|
|
4537
|
+
return validISO31661Alpha3CountriesCodes.includes(str.toUpperCase());
|
|
4538
|
+
}
|
|
4539
|
+
module.exports = exports['default'];
|
|
4540
|
+
},{"./util/assertString":73}],37:[function(require,module,exports){
|
|
4380
4541
|
'use strict';
|
|
4381
4542
|
|
|
4382
4543
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4400,7 +4561,7 @@ function isISO8601(str) {
|
|
|
4400
4561
|
return iso8601.test(str);
|
|
4401
4562
|
}
|
|
4402
4563
|
module.exports = exports['default'];
|
|
4403
|
-
},{"./util/assertString":
|
|
4564
|
+
},{"./util/assertString":73}],38:[function(require,module,exports){
|
|
4404
4565
|
'use strict';
|
|
4405
4566
|
|
|
4406
4567
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4422,7 +4583,7 @@ function isISRC(str) {
|
|
|
4422
4583
|
return isrc.test(str);
|
|
4423
4584
|
}
|
|
4424
4585
|
module.exports = exports['default'];
|
|
4425
|
-
},{"./util/assertString":
|
|
4586
|
+
},{"./util/assertString":73}],39:[function(require,module,exports){
|
|
4426
4587
|
'use strict';
|
|
4427
4588
|
|
|
4428
4589
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4481,7 +4642,7 @@ function isISSN(str) {
|
|
|
4481
4642
|
return checksum % 11 === 0;
|
|
4482
4643
|
}
|
|
4483
4644
|
module.exports = exports['default'];
|
|
4484
|
-
},{"./util/assertString":
|
|
4645
|
+
},{"./util/assertString":73}],40:[function(require,module,exports){
|
|
4485
4646
|
'use strict';
|
|
4486
4647
|
|
|
4487
4648
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4521,7 +4682,7 @@ function isIn(str, options) {
|
|
|
4521
4682
|
return false;
|
|
4522
4683
|
}
|
|
4523
4684
|
module.exports = exports['default'];
|
|
4524
|
-
},{"./util/assertString":
|
|
4685
|
+
},{"./util/assertString":73,"./util/toString":75}],41:[function(require,module,exports){
|
|
4525
4686
|
'use strict';
|
|
4526
4687
|
|
|
4527
4688
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4555,7 +4716,7 @@ function isInt(str, options) {
|
|
|
4555
4716
|
return regex.test(str) && minCheckPassed && maxCheckPassed && ltCheckPassed && gtCheckPassed;
|
|
4556
4717
|
}
|
|
4557
4718
|
module.exports = exports['default'];
|
|
4558
|
-
},{"./util/assertString":
|
|
4719
|
+
},{"./util/assertString":73}],42:[function(require,module,exports){
|
|
4559
4720
|
'use strict';
|
|
4560
4721
|
|
|
4561
4722
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4581,7 +4742,7 @@ function isJSON(str) {
|
|
|
4581
4742
|
return false;
|
|
4582
4743
|
}
|
|
4583
4744
|
module.exports = exports['default'];
|
|
4584
|
-
},{"./util/assertString":
|
|
4745
|
+
},{"./util/assertString":73}],43:[function(require,module,exports){
|
|
4585
4746
|
'use strict';
|
|
4586
4747
|
|
|
4587
4748
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4605,7 +4766,7 @@ var lat = /^\(?[+-]?(90(\.0+)?|[1-8]?\d(\.\d+)?)$/;
|
|
|
4605
4766
|
var long = /^\s?[+-]?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)\)?$/;
|
|
4606
4767
|
|
|
4607
4768
|
module.exports = exports['default'];
|
|
4608
|
-
},{"./util/assertString":
|
|
4769
|
+
},{"./util/assertString":73}],44:[function(require,module,exports){
|
|
4609
4770
|
'use strict';
|
|
4610
4771
|
|
|
4611
4772
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4640,7 +4801,7 @@ function isLength(str, options) {
|
|
|
4640
4801
|
return len >= min && (typeof max === 'undefined' || len <= max);
|
|
4641
4802
|
}
|
|
4642
4803
|
module.exports = exports['default'];
|
|
4643
|
-
},{"./util/assertString":
|
|
4804
|
+
},{"./util/assertString":73}],45:[function(require,module,exports){
|
|
4644
4805
|
'use strict';
|
|
4645
4806
|
|
|
4646
4807
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4659,7 +4820,7 @@ function isLowercase(str) {
|
|
|
4659
4820
|
return str === str.toLowerCase();
|
|
4660
4821
|
}
|
|
4661
4822
|
module.exports = exports['default'];
|
|
4662
|
-
},{"./util/assertString":
|
|
4823
|
+
},{"./util/assertString":73}],46:[function(require,module,exports){
|
|
4663
4824
|
'use strict';
|
|
4664
4825
|
|
|
4665
4826
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4680,7 +4841,7 @@ function isMACAddress(str) {
|
|
|
4680
4841
|
return macAddress.test(str);
|
|
4681
4842
|
}
|
|
4682
4843
|
module.exports = exports['default'];
|
|
4683
|
-
},{"./util/assertString":
|
|
4844
|
+
},{"./util/assertString":73}],47:[function(require,module,exports){
|
|
4684
4845
|
'use strict';
|
|
4685
4846
|
|
|
4686
4847
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4701,7 +4862,60 @@ function isMD5(str) {
|
|
|
4701
4862
|
return md5.test(str);
|
|
4702
4863
|
}
|
|
4703
4864
|
module.exports = exports['default'];
|
|
4704
|
-
},{"./util/assertString":
|
|
4865
|
+
},{"./util/assertString":73}],48:[function(require,module,exports){
|
|
4866
|
+
'use strict';
|
|
4867
|
+
|
|
4868
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4869
|
+
value: true
|
|
4870
|
+
});
|
|
4871
|
+
exports.default = isMimeType;
|
|
4872
|
+
|
|
4873
|
+
var _assertString = require('./util/assertString');
|
|
4874
|
+
|
|
4875
|
+
var _assertString2 = _interopRequireDefault(_assertString);
|
|
4876
|
+
|
|
4877
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
4878
|
+
|
|
4879
|
+
/*
|
|
4880
|
+
Checks if the provided string matches to a correct Media type format (MIME type)
|
|
4881
|
+
|
|
4882
|
+
This function only checks is the string format follows the
|
|
4883
|
+
etablished rules by the according RFC specifications.
|
|
4884
|
+
This function supports 'charset' in textual media types
|
|
4885
|
+
(https://tools.ietf.org/html/rfc6657).
|
|
4886
|
+
|
|
4887
|
+
This function does not check against all the media types listed
|
|
4888
|
+
by the IANA (https://www.iana.org/assignments/media-types/media-types.xhtml)
|
|
4889
|
+
because of lightness purposes : it would require to include
|
|
4890
|
+
all these MIME types in this librairy, which would weigh it
|
|
4891
|
+
significantly. This kind of effort maybe is not worth for the use that
|
|
4892
|
+
this function has in this entire librairy.
|
|
4893
|
+
|
|
4894
|
+
More informations in the RFC specifications :
|
|
4895
|
+
- https://tools.ietf.org/html/rfc2045
|
|
4896
|
+
- https://tools.ietf.org/html/rfc2046
|
|
4897
|
+
- https://tools.ietf.org/html/rfc7231#section-3.1.1.1
|
|
4898
|
+
- https://tools.ietf.org/html/rfc7231#section-3.1.1.5
|
|
4899
|
+
*/
|
|
4900
|
+
|
|
4901
|
+
// Match simple MIME types
|
|
4902
|
+
// NB :
|
|
4903
|
+
// Subtype length must not exceed 100 characters.
|
|
4904
|
+
// This rule does not comply to the RFC specs (what is the max length ?).
|
|
4905
|
+
var mimeTypeSimple = /^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+]{1,100}$/i; // eslint-disable-line max-len
|
|
4906
|
+
|
|
4907
|
+
// Handle "charset" in "text/*"
|
|
4908
|
+
var 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
|
|
4909
|
+
|
|
4910
|
+
// Handle "boundary" in "multipart/*"
|
|
4911
|
+
var 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
|
|
4912
|
+
|
|
4913
|
+
function isMimeType(str) {
|
|
4914
|
+
(0, _assertString2.default)(str);
|
|
4915
|
+
return mimeTypeSimple.test(str) || mimeTypeText.test(str) || mimeTypeMultipart.test(str);
|
|
4916
|
+
}
|
|
4917
|
+
module.exports = exports['default'];
|
|
4918
|
+
},{"./util/assertString":73}],49:[function(require,module,exports){
|
|
4705
4919
|
'use strict';
|
|
4706
4920
|
|
|
4707
4921
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4721,37 +4935,44 @@ var phones = {
|
|
|
4721
4935
|
'ar-DZ': /^(\+?213|0)(5|6|7)\d{8}$/,
|
|
4722
4936
|
'ar-EG': /^((\+?20)|0)?1[012]\d{8}$/,
|
|
4723
4937
|
'ar-JO': /^(\+?962|0)?7[789]\d{7}$/,
|
|
4724
|
-
'ar-SY': /^(!?(\+?963)|0)?9\d{8}$/,
|
|
4725
4938
|
'ar-SA': /^(!?(\+?966)|0)?5\d{8}$/,
|
|
4726
|
-
'
|
|
4939
|
+
'ar-SY': /^(!?(\+?963)|0)?9\d{8}$/,
|
|
4940
|
+
'be-BY': /^(\+?375)?(24|25|29|33|44)\d{7}$/,
|
|
4941
|
+
'bg-BG': /^(\+?359|0)?8[789]\d{7}$/,
|
|
4727
4942
|
'cs-CZ': /^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,
|
|
4728
|
-
'
|
|
4943
|
+
'da-DK': /^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/,
|
|
4729
4944
|
'de-DE': /^(\+?49[ \.\-])?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,
|
|
4730
|
-
'
|
|
4731
|
-
'el-GR': /^(\+?30)?(69\d{8})$/,
|
|
4945
|
+
'el-GR': /^(\+?30|0)?(69\d{8})$/,
|
|
4732
4946
|
'en-AU': /^(\+?61|0)4\d{8}$/,
|
|
4733
4947
|
'en-GB': /^(\+?44|0)7\d{9}$/,
|
|
4734
|
-
'en-HK': /^(\+?852\-?)?[
|
|
4735
|
-
'en-IN': /^(\+?91|0)?[
|
|
4948
|
+
'en-HK': /^(\+?852\-?)?[456789]\d{3}\-?\d{4}$/,
|
|
4949
|
+
'en-IN': /^(\+?91|0)?[6789]\d{9}$/,
|
|
4736
4950
|
'en-KE': /^(\+?254|0)?[7]\d{8}$/,
|
|
4737
4951
|
'en-NG': /^(\+?234|0)?[789]\d{9}$/,
|
|
4738
4952
|
'en-NZ': /^(\+?64|0)2\d{7,9}$/,
|
|
4739
|
-
'en-
|
|
4953
|
+
'en-PK': /^((\+92)|(0092))-{0,1}\d{3}-{0,1}\d{7}$|^\d{11}$|^\d{4}-\d{7}$/,
|
|
4740
4954
|
'en-RW': /^(\+?250|0)?[7]\d{8}$/,
|
|
4955
|
+
'en-SG': /^(\+65)?[89]\d{7}$/,
|
|
4741
4956
|
'en-TZ': /^(\+?255|0)?[67]\d{8}$/,
|
|
4957
|
+
'en-UG': /^(\+?256|0)?[7]\d{8}$/,
|
|
4958
|
+
'en-US': /^(\+?1)?[2-9]\d{2}[2-9](?!11)\d{6}$/,
|
|
4742
4959
|
'en-ZA': /^(\+?27|0)\d{9}$/,
|
|
4743
4960
|
'en-ZM': /^(\+?26)?09[567]\d{7}$/,
|
|
4744
4961
|
'es-ES': /^(\+?34)?(6\d{1}|7[1234])\d{7}$/,
|
|
4745
|
-
'
|
|
4962
|
+
'et-EE': /^(\+?372)?\s?(5|8[1-4])\s?([0-9]\s?){6,7}$/,
|
|
4746
4963
|
'fa-IR': /^(\+?98[\-\s]?|0)9[0-39]\d[\-\s]?\d{3}[\-\s]?\d{4}$/,
|
|
4964
|
+
'fi-FI': /^(\+?358|0)\s?(4(0|1|2|4|5|6)?|50)\s?(\d\s?){4,8}\d$/,
|
|
4965
|
+
'fo-FO': /^(\+?298)?\s?\d{2}\s?\d{2}\s?\d{2}$/,
|
|
4747
4966
|
'fr-FR': /^(\+?33|0)[67]\d{8}$/,
|
|
4748
|
-
'he-IL': /^(\+972|0)([23489]|5[
|
|
4967
|
+
'he-IL': /^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}/,
|
|
4749
4968
|
'hu-HU': /^(\+?36)(20|30|70)\d{7}$/,
|
|
4750
|
-
'lt-LT': /^(\+370|8)\d{8}$/,
|
|
4751
4969
|
'id-ID': /^(\+?62|0[1-9])[\s|\d]+$/,
|
|
4752
4970
|
'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/,
|
|
4971
|
+
'ja-JP': /^(\+?81|0)[789]0[ \-]?[1-9]\d{2}[ \-]?\d{5}$/,
|
|
4972
|
+
'kk-KZ': /^(\+?7|8)?7\d{9}$/,
|
|
4973
|
+
'kl-GL': /^(\+?299)?\s?\d{2}\s?\d{2}\s?\d{2}$/,
|
|
4753
4974
|
'ko-KR': /^((\+?82)[ \-]?)?0?1([0|1|6|7|8|9]{1})[ \-]?\d{3,4}[ \-]?\d{4}$/,
|
|
4754
|
-
'
|
|
4975
|
+
'lt-LT': /^(\+370|8)\d{8}$/,
|
|
4755
4976
|
'ms-MY': /^(\+?6?01){1}(([145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,
|
|
4756
4977
|
'nb-NO': /^(\+?47)?[49]\d{7}$/,
|
|
4757
4978
|
'nl-BE': /^(\+?32|0)4?\d{8}$/,
|
|
@@ -4760,12 +4981,14 @@ var phones = {
|
|
|
4760
4981
|
'pt-BR': /^(\+?55|0)\-?[1-9]{2}\-?[2-9]{1}\d{3,4}\-?\d{4}$/,
|
|
4761
4982
|
'pt-PT': /^(\+?351)?9[1236]\d{7}$/,
|
|
4762
4983
|
'ro-RO': /^(\+?4?0)\s?7\d{2}(\/|\s|\.|\-)?\d{3}(\s|\.|\-)?\d{3}$/,
|
|
4763
|
-
'en-PK': /^((\+92)|(0092))-{0,1}\d{3}-{0,1}\d{7}$|^\d{11}$|^\d{4}-\d{7}$/,
|
|
4764
4984
|
'ru-RU': /^(\+?7|8)?9\d{9}$/,
|
|
4985
|
+
'sk-SK': /^(\+?421)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,
|
|
4765
4986
|
'sr-RS': /^(\+3816|06)[- \d]{5,9}$/,
|
|
4987
|
+
'th-TH': /^(\+66|66|0)\d{9}$/,
|
|
4766
4988
|
'tr-TR': /^(\+?90|0)?5\d{9}$/,
|
|
4989
|
+
'uk-UA': /^(\+?38|8)?0\d{9}$/,
|
|
4767
4990
|
'vi-VN': /^(\+?84|0)?((1(2([0-9])|6([2-9])|88|99))|(9((?!5)[0-9])))([0-9]{7})$/,
|
|
4768
|
-
'zh-CN': /^(\+?0?86\-?)?1[
|
|
4991
|
+
'zh-CN': /^(\+?0?86\-?)?1[3456789]\d{9}$/,
|
|
4769
4992
|
'zh-TW': /^(\+?886\-?|0)?9\d{8}$/
|
|
4770
4993
|
};
|
|
4771
4994
|
/* eslint-enable max-len */
|
|
@@ -4775,8 +4998,11 @@ phones['en-CA'] = phones['en-US'];
|
|
|
4775
4998
|
phones['fr-BE'] = phones['nl-BE'];
|
|
4776
4999
|
phones['zh-HK'] = phones['en-HK'];
|
|
4777
5000
|
|
|
4778
|
-
function isMobilePhone(str, locale) {
|
|
5001
|
+
function isMobilePhone(str, locale, options) {
|
|
4779
5002
|
(0, _assertString2.default)(str);
|
|
5003
|
+
if (options && options.strictMode && !str.startsWith('+')) {
|
|
5004
|
+
return false;
|
|
5005
|
+
}
|
|
4780
5006
|
if (locale in phones) {
|
|
4781
5007
|
return phones[locale].test(str);
|
|
4782
5008
|
} else if (locale === 'any') {
|
|
@@ -4793,7 +5019,7 @@ function isMobilePhone(str, locale) {
|
|
|
4793
5019
|
throw new Error('Invalid locale \'' + locale + '\'');
|
|
4794
5020
|
}
|
|
4795
5021
|
module.exports = exports['default'];
|
|
4796
|
-
},{"./util/assertString":
|
|
5022
|
+
},{"./util/assertString":73}],50:[function(require,module,exports){
|
|
4797
5023
|
'use strict';
|
|
4798
5024
|
|
|
4799
5025
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4816,7 +5042,7 @@ function isMongoId(str) {
|
|
|
4816
5042
|
return (0, _isHexadecimal2.default)(str) && str.length === 24;
|
|
4817
5043
|
}
|
|
4818
5044
|
module.exports = exports['default'];
|
|
4819
|
-
},{"./isHexadecimal":31,"./util/assertString":
|
|
5045
|
+
},{"./isHexadecimal":31,"./util/assertString":73}],51:[function(require,module,exports){
|
|
4820
5046
|
'use strict';
|
|
4821
5047
|
|
|
4822
5048
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4839,7 +5065,7 @@ function isMultibyte(str) {
|
|
|
4839
5065
|
return multibyte.test(str);
|
|
4840
5066
|
}
|
|
4841
5067
|
module.exports = exports['default'];
|
|
4842
|
-
},{"./util/assertString":
|
|
5068
|
+
},{"./util/assertString":73}],52:[function(require,module,exports){
|
|
4843
5069
|
'use strict';
|
|
4844
5070
|
|
|
4845
5071
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4853,14 +5079,32 @@ var _assertString2 = _interopRequireDefault(_assertString);
|
|
|
4853
5079
|
|
|
4854
5080
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
4855
5081
|
|
|
4856
|
-
var numeric = /^[
|
|
5082
|
+
var numeric = /^[+-]?([0-9]*[.])?[0-9]+$/;
|
|
4857
5083
|
|
|
4858
5084
|
function isNumeric(str) {
|
|
4859
5085
|
(0, _assertString2.default)(str);
|
|
4860
5086
|
return numeric.test(str);
|
|
4861
5087
|
}
|
|
4862
5088
|
module.exports = exports['default'];
|
|
4863
|
-
},{"./util/assertString":
|
|
5089
|
+
},{"./util/assertString":73}],53:[function(require,module,exports){
|
|
5090
|
+
'use strict';
|
|
5091
|
+
|
|
5092
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5093
|
+
value: true
|
|
5094
|
+
});
|
|
5095
|
+
exports.default = isPort;
|
|
5096
|
+
|
|
5097
|
+
var _isInt = require('./isInt');
|
|
5098
|
+
|
|
5099
|
+
var _isInt2 = _interopRequireDefault(_isInt);
|
|
5100
|
+
|
|
5101
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
5102
|
+
|
|
5103
|
+
function isPort(str) {
|
|
5104
|
+
return (0, _isInt2.default)(str, { min: 0, max: 65535 });
|
|
5105
|
+
}
|
|
5106
|
+
module.exports = exports['default'];
|
|
5107
|
+
},{"./isInt":41}],54:[function(require,module,exports){
|
|
4864
5108
|
'use strict';
|
|
4865
5109
|
|
|
4866
5110
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4900,8 +5144,9 @@ var sixDigit = /^\d{6}$/;
|
|
|
4900
5144
|
|
|
4901
5145
|
var patterns = {
|
|
4902
5146
|
AT: fourDigit,
|
|
4903
|
-
AU:
|
|
5147
|
+
AU: fourDigit,
|
|
4904
5148
|
BE: fourDigit,
|
|
5149
|
+
BG: fourDigit,
|
|
4905
5150
|
CA: /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,
|
|
4906
5151
|
CH: fourDigit,
|
|
4907
5152
|
CZ: /^\d{3}\s?\d{2}$/,
|
|
@@ -4924,11 +5169,12 @@ var patterns = {
|
|
|
4924
5169
|
NL: /^\d{4}\s?[a-z]{2}$/i,
|
|
4925
5170
|
NO: fourDigit,
|
|
4926
5171
|
PL: /^\d{2}\-\d{3}$/,
|
|
4927
|
-
PT: /^\d{4}
|
|
5172
|
+
PT: /^\d{4}\-\d{3}?$/,
|
|
4928
5173
|
RO: sixDigit,
|
|
4929
5174
|
RU: sixDigit,
|
|
4930
5175
|
SA: fiveDigit,
|
|
4931
5176
|
SE: /^\d{3}\s?\d{2}$/,
|
|
5177
|
+
SK: /^\d{3}\s?\d{2}$/,
|
|
4932
5178
|
TW: /^\d{3}(\d{2})?$/,
|
|
4933
5179
|
US: /^\d{5}(-\d{4})?$/,
|
|
4934
5180
|
ZA: fourDigit,
|
|
@@ -4936,7 +5182,47 @@ var patterns = {
|
|
|
4936
5182
|
};
|
|
4937
5183
|
|
|
4938
5184
|
var locales = exports.locales = Object.keys(patterns);
|
|
4939
|
-
},{"./util/assertString":
|
|
5185
|
+
},{"./util/assertString":73}],55:[function(require,module,exports){
|
|
5186
|
+
'use strict';
|
|
5187
|
+
|
|
5188
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5189
|
+
value: true
|
|
5190
|
+
});
|
|
5191
|
+
exports.default = isRFC3339;
|
|
5192
|
+
|
|
5193
|
+
var _assertString = require('./util/assertString');
|
|
5194
|
+
|
|
5195
|
+
var _assertString2 = _interopRequireDefault(_assertString);
|
|
5196
|
+
|
|
5197
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
5198
|
+
|
|
5199
|
+
/* Based on https://tools.ietf.org/html/rfc3339#section-5.6 */
|
|
5200
|
+
|
|
5201
|
+
var dateFullYear = /[0-9]{4}/;
|
|
5202
|
+
var dateMonth = /(0[1-9]|1[0-2])/;
|
|
5203
|
+
var dateMDay = /([12]\d|0[1-9]|3[01])/;
|
|
5204
|
+
|
|
5205
|
+
var timeHour = /([01][0-9]|2[0-3])/;
|
|
5206
|
+
var timeMinute = /[0-5][0-9]/;
|
|
5207
|
+
var timeSecond = /([0-5][0-9]|60)/;
|
|
5208
|
+
|
|
5209
|
+
var timeSecFrac = /(\.[0-9]+)?/;
|
|
5210
|
+
var timeNumOffset = new RegExp('[-+]' + timeHour.source + ':' + timeMinute.source);
|
|
5211
|
+
var timeOffset = new RegExp('([zZ]|' + timeNumOffset.source + ')');
|
|
5212
|
+
|
|
5213
|
+
var partialTime = new RegExp(timeHour.source + ':' + timeMinute.source + ':' + timeSecond.source + timeSecFrac.source);
|
|
5214
|
+
|
|
5215
|
+
var fullDate = new RegExp(dateFullYear.source + '-' + dateMonth.source + '-' + dateMDay.source);
|
|
5216
|
+
var fullTime = new RegExp('' + partialTime.source + timeOffset.source);
|
|
5217
|
+
|
|
5218
|
+
var rfc3339 = new RegExp(fullDate.source + '[ tT]' + fullTime.source);
|
|
5219
|
+
|
|
5220
|
+
function isRFC3339(str) {
|
|
5221
|
+
(0, _assertString2.default)(str);
|
|
5222
|
+
return rfc3339.test(str);
|
|
5223
|
+
}
|
|
5224
|
+
module.exports = exports['default'];
|
|
5225
|
+
},{"./util/assertString":73}],56:[function(require,module,exports){
|
|
4940
5226
|
'use strict';
|
|
4941
5227
|
|
|
4942
5228
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4957,7 +5243,7 @@ function isSurrogatePair(str) {
|
|
|
4957
5243
|
return surrogatePair.test(str);
|
|
4958
5244
|
}
|
|
4959
5245
|
module.exports = exports['default'];
|
|
4960
|
-
},{"./util/assertString":
|
|
5246
|
+
},{"./util/assertString":73}],57:[function(require,module,exports){
|
|
4961
5247
|
'use strict';
|
|
4962
5248
|
|
|
4963
5249
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5105,7 +5391,7 @@ function isURL(url, options) {
|
|
|
5105
5391
|
return true;
|
|
5106
5392
|
}
|
|
5107
5393
|
module.exports = exports['default'];
|
|
5108
|
-
},{"./isFQDN":25,"./isIP":32,"./util/assertString":
|
|
5394
|
+
},{"./isFQDN":25,"./isIP":32,"./util/assertString":73,"./util/merge":74}],58:[function(require,module,exports){
|
|
5109
5395
|
'use strict';
|
|
5110
5396
|
|
|
5111
5397
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5134,7 +5420,7 @@ function isUUID(str) {
|
|
|
5134
5420
|
return pattern && pattern.test(str);
|
|
5135
5421
|
}
|
|
5136
5422
|
module.exports = exports['default'];
|
|
5137
|
-
},{"./util/assertString":
|
|
5423
|
+
},{"./util/assertString":73}],59:[function(require,module,exports){
|
|
5138
5424
|
'use strict';
|
|
5139
5425
|
|
|
5140
5426
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5153,7 +5439,7 @@ function isUppercase(str) {
|
|
|
5153
5439
|
return str === str.toUpperCase();
|
|
5154
5440
|
}
|
|
5155
5441
|
module.exports = exports['default'];
|
|
5156
|
-
},{"./util/assertString":
|
|
5442
|
+
},{"./util/assertString":73}],60:[function(require,module,exports){
|
|
5157
5443
|
'use strict';
|
|
5158
5444
|
|
|
5159
5445
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5176,7 +5462,7 @@ function isVariableWidth(str) {
|
|
|
5176
5462
|
return _isFullWidth.fullWidth.test(str) && _isHalfWidth.halfWidth.test(str);
|
|
5177
5463
|
}
|
|
5178
5464
|
module.exports = exports['default'];
|
|
5179
|
-
},{"./isFullWidth":27,"./isHalfWidth":28,"./util/assertString":
|
|
5465
|
+
},{"./isFullWidth":27,"./isHalfWidth":28,"./util/assertString":73}],61:[function(require,module,exports){
|
|
5180
5466
|
'use strict';
|
|
5181
5467
|
|
|
5182
5468
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5200,7 +5486,7 @@ function isWhitelisted(str, chars) {
|
|
|
5200
5486
|
return true;
|
|
5201
5487
|
}
|
|
5202
5488
|
module.exports = exports['default'];
|
|
5203
|
-
},{"./util/assertString":
|
|
5489
|
+
},{"./util/assertString":73}],62:[function(require,module,exports){
|
|
5204
5490
|
'use strict';
|
|
5205
5491
|
|
|
5206
5492
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5220,7 +5506,7 @@ function ltrim(str, chars) {
|
|
|
5220
5506
|
return str.replace(pattern, '');
|
|
5221
5507
|
}
|
|
5222
5508
|
module.exports = exports['default'];
|
|
5223
|
-
},{"./util/assertString":
|
|
5509
|
+
},{"./util/assertString":73}],63:[function(require,module,exports){
|
|
5224
5510
|
'use strict';
|
|
5225
5511
|
|
|
5226
5512
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5242,7 +5528,7 @@ function matches(str, pattern, modifiers) {
|
|
|
5242
5528
|
return pattern.test(str);
|
|
5243
5529
|
}
|
|
5244
5530
|
module.exports = exports['default'];
|
|
5245
|
-
},{"./util/assertString":
|
|
5531
|
+
},{"./util/assertString":73}],64:[function(require,module,exports){
|
|
5246
5532
|
'use strict';
|
|
5247
5533
|
|
|
5248
5534
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5250,10 +5536,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5250
5536
|
});
|
|
5251
5537
|
exports.default = normalizeEmail;
|
|
5252
5538
|
|
|
5253
|
-
var _isEmail = require('./isEmail');
|
|
5254
|
-
|
|
5255
|
-
var _isEmail2 = _interopRequireDefault(_isEmail);
|
|
5256
|
-
|
|
5257
5539
|
var _merge = require('./util/merge');
|
|
5258
5540
|
|
|
5259
5541
|
var _merge2 = _interopRequireDefault(_merge);
|
|
@@ -5289,6 +5571,10 @@ var default_normalize_email_options = {
|
|
|
5289
5571
|
// Removes the subaddress (e.g. "-foo") from the email address
|
|
5290
5572
|
yahoo_remove_subaddress: true,
|
|
5291
5573
|
|
|
5574
|
+
// The following conversions are specific to Yandex
|
|
5575
|
+
// Lowercases the local part of the Yandex address (known to be case-insensitive)
|
|
5576
|
+
yandex_lowercase: true,
|
|
5577
|
+
|
|
5292
5578
|
// The following conversions are specific to iCloud
|
|
5293
5579
|
// Lowercases the local part of the iCloud address (known to be case-insensitive)
|
|
5294
5580
|
icloud_lowercase: true,
|
|
@@ -5309,12 +5595,19 @@ var outlookdotcom_domains = ['hotmail.at', 'hotmail.be', 'hotmail.ca', 'hotmail.
|
|
|
5309
5595
|
// This list is likely incomplete
|
|
5310
5596
|
var yahoo_domains = ['rocketmail.com', 'yahoo.ca', 'yahoo.co.uk', 'yahoo.com', 'yahoo.de', 'yahoo.fr', 'yahoo.in', 'yahoo.it', 'ymail.com'];
|
|
5311
5597
|
|
|
5312
|
-
|
|
5313
|
-
|
|
5598
|
+
// List of domains used by yandex.ru
|
|
5599
|
+
var yandex_domains = ['yandex.ru', 'yandex.ua', 'yandex.kz', 'yandex.com', 'yandex.by', 'ya.ru'];
|
|
5314
5600
|
|
|
5315
|
-
|
|
5316
|
-
|
|
5601
|
+
// replace single dots, but not multiple consecutive dots
|
|
5602
|
+
function dotsReplacer(match) {
|
|
5603
|
+
if (match.length > 1) {
|
|
5604
|
+
return match;
|
|
5317
5605
|
}
|
|
5606
|
+
return '';
|
|
5607
|
+
}
|
|
5608
|
+
|
|
5609
|
+
function normalizeEmail(email, options) {
|
|
5610
|
+
options = (0, _merge2.default)(options, default_normalize_email_options);
|
|
5318
5611
|
|
|
5319
5612
|
var raw_parts = email.split('@');
|
|
5320
5613
|
var domain = raw_parts.pop();
|
|
@@ -5330,7 +5623,8 @@ function normalizeEmail(email, options) {
|
|
|
5330
5623
|
parts[0] = parts[0].split('+')[0];
|
|
5331
5624
|
}
|
|
5332
5625
|
if (options.gmail_remove_dots) {
|
|
5333
|
-
|
|
5626
|
+
// this does not replace consecutive dots like example..email@gmail.com
|
|
5627
|
+
parts[0] = parts[0].replace(/\.+/g, dotsReplacer);
|
|
5334
5628
|
}
|
|
5335
5629
|
if (!parts[0].length) {
|
|
5336
5630
|
return false;
|
|
@@ -5373,6 +5667,11 @@ function normalizeEmail(email, options) {
|
|
|
5373
5667
|
if (options.all_lowercase || options.yahoo_lowercase) {
|
|
5374
5668
|
parts[0] = parts[0].toLowerCase();
|
|
5375
5669
|
}
|
|
5670
|
+
} else if (~yandex_domains.indexOf(parts[1])) {
|
|
5671
|
+
if (options.all_lowercase || options.yandex_lowercase) {
|
|
5672
|
+
parts[0] = parts[0].toLowerCase();
|
|
5673
|
+
}
|
|
5674
|
+
parts[1] = 'yandex.ru'; // all yandex domains are equal, 1st preffered
|
|
5376
5675
|
} else if (options.all_lowercase) {
|
|
5377
5676
|
// Any other address
|
|
5378
5677
|
parts[0] = parts[0].toLowerCase();
|
|
@@ -5380,7 +5679,7 @@ function normalizeEmail(email, options) {
|
|
|
5380
5679
|
return parts.join('@');
|
|
5381
5680
|
}
|
|
5382
5681
|
module.exports = exports['default'];
|
|
5383
|
-
},{"./
|
|
5682
|
+
},{"./util/merge":74}],65:[function(require,module,exports){
|
|
5384
5683
|
'use strict';
|
|
5385
5684
|
|
|
5386
5685
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5406,7 +5705,7 @@ function rtrim(str, chars) {
|
|
|
5406
5705
|
return idx < str.length ? str.substr(0, idx + 1) : str;
|
|
5407
5706
|
}
|
|
5408
5707
|
module.exports = exports['default'];
|
|
5409
|
-
},{"./util/assertString":
|
|
5708
|
+
},{"./util/assertString":73}],66:[function(require,module,exports){
|
|
5410
5709
|
'use strict';
|
|
5411
5710
|
|
|
5412
5711
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5430,7 +5729,7 @@ function stripLow(str, keep_new_lines) {
|
|
|
5430
5729
|
return (0, _blacklist2.default)(str, chars);
|
|
5431
5730
|
}
|
|
5432
5731
|
module.exports = exports['default'];
|
|
5433
|
-
},{"./blacklist":6,"./util/assertString":
|
|
5732
|
+
},{"./blacklist":6,"./util/assertString":73}],67:[function(require,module,exports){
|
|
5434
5733
|
'use strict';
|
|
5435
5734
|
|
|
5436
5735
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5452,7 +5751,7 @@ function toBoolean(str, strict) {
|
|
|
5452
5751
|
return str !== '0' && str !== 'false' && str !== '';
|
|
5453
5752
|
}
|
|
5454
5753
|
module.exports = exports['default'];
|
|
5455
|
-
},{"./util/assertString":
|
|
5754
|
+
},{"./util/assertString":73}],68:[function(require,module,exports){
|
|
5456
5755
|
'use strict';
|
|
5457
5756
|
|
|
5458
5757
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5472,7 +5771,7 @@ function toDate(date) {
|
|
|
5472
5771
|
return !isNaN(date) ? new Date(date) : null;
|
|
5473
5772
|
}
|
|
5474
5773
|
module.exports = exports['default'];
|
|
5475
|
-
},{"./util/assertString":
|
|
5774
|
+
},{"./util/assertString":73}],69:[function(require,module,exports){
|
|
5476
5775
|
'use strict';
|
|
5477
5776
|
|
|
5478
5777
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5491,7 +5790,7 @@ function toFloat(str) {
|
|
|
5491
5790
|
return parseFloat(str);
|
|
5492
5791
|
}
|
|
5493
5792
|
module.exports = exports['default'];
|
|
5494
|
-
},{"./util/assertString":
|
|
5793
|
+
},{"./util/assertString":73}],70:[function(require,module,exports){
|
|
5495
5794
|
'use strict';
|
|
5496
5795
|
|
|
5497
5796
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5510,7 +5809,7 @@ function toInt(str, radix) {
|
|
|
5510
5809
|
return parseInt(str, radix || 10);
|
|
5511
5810
|
}
|
|
5512
5811
|
module.exports = exports['default'];
|
|
5513
|
-
},{"./util/assertString":
|
|
5812
|
+
},{"./util/assertString":73}],71:[function(require,module,exports){
|
|
5514
5813
|
'use strict';
|
|
5515
5814
|
|
|
5516
5815
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5532,7 +5831,7 @@ function trim(str, chars) {
|
|
|
5532
5831
|
return (0, _rtrim2.default)((0, _ltrim2.default)(str, chars), chars);
|
|
5533
5832
|
}
|
|
5534
5833
|
module.exports = exports['default'];
|
|
5535
|
-
},{"./ltrim":
|
|
5834
|
+
},{"./ltrim":62,"./rtrim":65}],72:[function(require,module,exports){
|
|
5536
5835
|
'use strict';
|
|
5537
5836
|
|
|
5538
5837
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5551,7 +5850,7 @@ function unescape(str) {
|
|
|
5551
5850
|
return str.replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, "'").replace(/</g, '<').replace(/>/g, '>').replace(///g, '/').replace(/\/g, '\\').replace(/`/g, '`');
|
|
5552
5851
|
}
|
|
5553
5852
|
module.exports = exports['default'];
|
|
5554
|
-
},{"./util/assertString":
|
|
5853
|
+
},{"./util/assertString":73}],73:[function(require,module,exports){
|
|
5555
5854
|
'use strict';
|
|
5556
5855
|
|
|
5557
5856
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5566,7 +5865,7 @@ function assertString(input) {
|
|
|
5566
5865
|
}
|
|
5567
5866
|
}
|
|
5568
5867
|
module.exports = exports['default'];
|
|
5569
|
-
},{}],
|
|
5868
|
+
},{}],74:[function(require,module,exports){
|
|
5570
5869
|
'use strict';
|
|
5571
5870
|
|
|
5572
5871
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5585,7 +5884,7 @@ function merge() {
|
|
|
5585
5884
|
return obj;
|
|
5586
5885
|
}
|
|
5587
5886
|
module.exports = exports['default'];
|
|
5588
|
-
},{}],
|
|
5887
|
+
},{}],75:[function(require,module,exports){
|
|
5589
5888
|
'use strict';
|
|
5590
5889
|
|
|
5591
5890
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5608,7 +5907,7 @@ function toString(input) {
|
|
|
5608
5907
|
return String(input);
|
|
5609
5908
|
}
|
|
5610
5909
|
module.exports = exports['default'];
|
|
5611
|
-
},{}],
|
|
5910
|
+
},{}],76:[function(require,module,exports){
|
|
5612
5911
|
'use strict';
|
|
5613
5912
|
|
|
5614
5913
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5627,7 +5926,7 @@ function whitelist(str, chars) {
|
|
|
5627
5926
|
return str.replace(new RegExp('[^' + chars + ']+', 'g'), '');
|
|
5628
5927
|
}
|
|
5629
5928
|
module.exports = exports['default'];
|
|
5630
|
-
},{"./util/assertString":
|
|
5929
|
+
},{"./util/assertString":73}],77:[function(require,module,exports){
|
|
5631
5930
|
"use strict";
|
|
5632
5931
|
|
|
5633
5932
|
module.exports = {
|
|
@@ -5635,6 +5934,7 @@ module.exports = {
|
|
|
5635
5934
|
INVALID_TYPE: "Expected type {0} but found type {1}",
|
|
5636
5935
|
INVALID_FORMAT: "Object didn't pass validation for format {0}: {1}",
|
|
5637
5936
|
ENUM_MISMATCH: "No enum match for: {0}",
|
|
5937
|
+
ENUM_CASE_MISMATCH: "Enum does not match case for: {0}",
|
|
5638
5938
|
ANY_OF_MISSING: "Data does not match any schemas from 'anyOf'",
|
|
5639
5939
|
ONE_OF_MISSING: "Data does not match any schemas from 'oneOf'",
|
|
5640
5940
|
ONE_OF_MULTIPLE: "Data is valid against more than one schema from 'oneOf'",
|
|
@@ -5688,7 +5988,7 @@ module.exports = {
|
|
|
5688
5988
|
|
|
5689
5989
|
};
|
|
5690
5990
|
|
|
5691
|
-
},{}],
|
|
5991
|
+
},{}],78:[function(require,module,exports){
|
|
5692
5992
|
/*jshint maxlen: false*/
|
|
5693
5993
|
|
|
5694
5994
|
var validator = require("validator");
|
|
@@ -5819,7 +6119,7 @@ var FormatValidators = {
|
|
|
5819
6119
|
|
|
5820
6120
|
module.exports = FormatValidators;
|
|
5821
6121
|
|
|
5822
|
-
},{"validator":4}],
|
|
6122
|
+
},{"validator":4}],79:[function(require,module,exports){
|
|
5823
6123
|
"use strict";
|
|
5824
6124
|
|
|
5825
6125
|
var FormatValidators = require("./FormatValidators"),
|
|
@@ -6068,15 +6368,20 @@ var JsonValidators = {
|
|
|
6068
6368
|
enum: function (report, schema, json) {
|
|
6069
6369
|
// http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.5.1.2
|
|
6070
6370
|
var match = false,
|
|
6371
|
+
caseInsensitiveMatch = false,
|
|
6071
6372
|
idx = schema.enum.length;
|
|
6072
6373
|
while (idx--) {
|
|
6073
6374
|
if (Utils.areEqual(json, schema.enum[idx])) {
|
|
6074
6375
|
match = true;
|
|
6075
6376
|
break;
|
|
6377
|
+
} else if (Utils.areEqual(json, schema.enum[idx]), { caseInsensitiveComparison: true }) {
|
|
6378
|
+
caseInsensitiveMatch = true;
|
|
6076
6379
|
}
|
|
6077
6380
|
}
|
|
6381
|
+
|
|
6078
6382
|
if (match === false) {
|
|
6079
|
-
|
|
6383
|
+
var error = caseInsensitiveMatch && this.options.enumCaseInsensitiveComparison ? "ENUM_CASE_MISMATCH" : "ENUM_MISMATCH";
|
|
6384
|
+
report.addError(error, [json], null, schema.description);
|
|
6080
6385
|
}
|
|
6081
6386
|
},
|
|
6082
6387
|
/*
|
|
@@ -6362,7 +6667,7 @@ exports.validate = function (report, schema, json) {
|
|
|
6362
6667
|
|
|
6363
6668
|
};
|
|
6364
6669
|
|
|
6365
|
-
},{"./FormatValidators":
|
|
6670
|
+
},{"./FormatValidators":78,"./Report":81,"./Utils":85}],80:[function(require,module,exports){
|
|
6366
6671
|
// Number.isFinite polyfill
|
|
6367
6672
|
// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite
|
|
6368
6673
|
if (typeof Number.isFinite !== "function") {
|
|
@@ -6380,7 +6685,7 @@ if (typeof Number.isFinite !== "function") {
|
|
|
6380
6685
|
};
|
|
6381
6686
|
}
|
|
6382
6687
|
|
|
6383
|
-
},{}],
|
|
6688
|
+
},{}],81:[function(require,module,exports){
|
|
6384
6689
|
(function (process){
|
|
6385
6690
|
"use strict";
|
|
6386
6691
|
|
|
@@ -6441,7 +6746,8 @@ Report.prototype.processAsyncTasks = function (timeout, callback) {
|
|
|
6441
6746
|
};
|
|
6442
6747
|
}
|
|
6443
6748
|
|
|
6444
|
-
if
|
|
6749
|
+
// finish if tasks are completed or there are any errors and breaking on first error was requested
|
|
6750
|
+
if (tasksCount === 0 || (this.errors.length > 0 && this.options.breakOnFirstError)) {
|
|
6445
6751
|
finish();
|
|
6446
6752
|
return;
|
|
6447
6753
|
}
|
|
@@ -6586,7 +6892,7 @@ Report.prototype.addCustomError = function (errorCode, errorMessage, params, sub
|
|
|
6586
6892
|
module.exports = Report;
|
|
6587
6893
|
|
|
6588
6894
|
}).call(this,require('_process'))
|
|
6589
|
-
},{"./Errors":
|
|
6895
|
+
},{"./Errors":77,"./Utils":85,"_process":3,"lodash.get":1}],82:[function(require,module,exports){
|
|
6590
6896
|
"use strict";
|
|
6591
6897
|
|
|
6592
6898
|
var isequal = require("lodash.isequal");
|
|
@@ -6710,7 +7016,15 @@ exports.getSchemaByUri = function (report, uri, root) {
|
|
|
6710
7016
|
|
|
6711
7017
|
var remoteReport = new Report(report);
|
|
6712
7018
|
if (SchemaCompilation.compileSchema.call(this, remoteReport, result)) {
|
|
6713
|
-
|
|
7019
|
+
var savedOptions = this.options;
|
|
7020
|
+
try {
|
|
7021
|
+
// If custom validationOptions were provided to setRemoteReference(),
|
|
7022
|
+
// use them instead of the default options
|
|
7023
|
+
this.options = result.__$validationOptions || this.options;
|
|
7024
|
+
SchemaValidation.validateSchema.call(this, remoteReport, result);
|
|
7025
|
+
} finally {
|
|
7026
|
+
this.options = savedOptions;
|
|
7027
|
+
}
|
|
6714
7028
|
}
|
|
6715
7029
|
var remoteReportIsValid = remoteReport.isValid();
|
|
6716
7030
|
if (!remoteReportIsValid) {
|
|
@@ -6742,7 +7056,7 @@ exports.getSchemaByUri = function (report, uri, root) {
|
|
|
6742
7056
|
|
|
6743
7057
|
exports.getRemotePath = getRemotePath;
|
|
6744
7058
|
|
|
6745
|
-
},{"./Report":
|
|
7059
|
+
},{"./Report":81,"./SchemaCompilation":83,"./SchemaValidation":84,"./Utils":85,"lodash.isequal":2}],83:[function(require,module,exports){
|
|
6746
7060
|
"use strict";
|
|
6747
7061
|
|
|
6748
7062
|
var Report = require("./Report");
|
|
@@ -7043,7 +7357,7 @@ exports.compileSchema = function (report, schema) {
|
|
|
7043
7357
|
|
|
7044
7358
|
};
|
|
7045
7359
|
|
|
7046
|
-
},{"./Report":
|
|
7360
|
+
},{"./Report":81,"./SchemaCache":82,"./Utils":85}],84:[function(require,module,exports){
|
|
7047
7361
|
"use strict";
|
|
7048
7362
|
|
|
7049
7363
|
var FormatValidators = require("./FormatValidators"),
|
|
@@ -7652,7 +7966,7 @@ exports.validateSchema = function (report, schema) {
|
|
|
7652
7966
|
return isValid;
|
|
7653
7967
|
};
|
|
7654
7968
|
|
|
7655
|
-
},{"./FormatValidators":
|
|
7969
|
+
},{"./FormatValidators":78,"./JsonValidation":79,"./Report":81,"./Utils":85}],85:[function(require,module,exports){
|
|
7656
7970
|
"use strict";
|
|
7657
7971
|
|
|
7658
7972
|
exports.isAbsoluteUri = function (uri) {
|
|
@@ -7696,7 +8010,11 @@ exports.whatIs = function (what) {
|
|
|
7696
8010
|
|
|
7697
8011
|
};
|
|
7698
8012
|
|
|
7699
|
-
exports.areEqual = function areEqual(json1, json2) {
|
|
8013
|
+
exports.areEqual = function areEqual(json1, json2, options) {
|
|
8014
|
+
|
|
8015
|
+
options = options || {};
|
|
8016
|
+
var caseInsensitiveComparison = options.caseInsensitiveComparison || false;
|
|
8017
|
+
|
|
7700
8018
|
// http://json-schema.org/latest/json-schema-core.html#rfc.section.3.6
|
|
7701
8019
|
|
|
7702
8020
|
// Two JSON values are said to be equal if and only if:
|
|
@@ -7707,6 +8025,12 @@ exports.areEqual = function areEqual(json1, json2) {
|
|
|
7707
8025
|
if (json1 === json2) {
|
|
7708
8026
|
return true;
|
|
7709
8027
|
}
|
|
8028
|
+
if (
|
|
8029
|
+
caseInsensitiveComparison === true &&
|
|
8030
|
+
typeof json1 === "string" && typeof json2 === "string" &&
|
|
8031
|
+
json1.toUpperCase() === json2.toUpperCase()) {
|
|
8032
|
+
return true;
|
|
8033
|
+
}
|
|
7710
8034
|
|
|
7711
8035
|
var i, len;
|
|
7712
8036
|
|
|
@@ -7719,7 +8043,7 @@ exports.areEqual = function areEqual(json1, json2) {
|
|
|
7719
8043
|
// items at the same index are equal according to this definition; or
|
|
7720
8044
|
len = json1.length;
|
|
7721
8045
|
for (i = 0; i < len; i++) {
|
|
7722
|
-
if (!areEqual(json1[i], json2[i])) {
|
|
8046
|
+
if (!areEqual(json1[i], json2[i], { caseInsensitiveComparison: caseInsensitiveComparison })) {
|
|
7723
8047
|
return false;
|
|
7724
8048
|
}
|
|
7725
8049
|
}
|
|
@@ -7731,13 +8055,13 @@ exports.areEqual = function areEqual(json1, json2) {
|
|
|
7731
8055
|
// have the same set of property names; and
|
|
7732
8056
|
var keys1 = Object.keys(json1);
|
|
7733
8057
|
var keys2 = Object.keys(json2);
|
|
7734
|
-
if (!areEqual(keys1, keys2)) {
|
|
8058
|
+
if (!areEqual(keys1, keys2, { caseInsensitiveComparison: caseInsensitiveComparison })) {
|
|
7735
8059
|
return false;
|
|
7736
8060
|
}
|
|
7737
8061
|
// values for a same property name are equal according to this definition.
|
|
7738
8062
|
len = keys1.length;
|
|
7739
8063
|
for (i = 0; i < len; i++) {
|
|
7740
|
-
if (!areEqual(json1[keys1[i]], json2[keys1[i]])) {
|
|
8064
|
+
if (!areEqual(json1[keys1[i]], json2[keys1[i]], { caseInsensitiveComparison: caseInsensitiveComparison })) {
|
|
7741
8065
|
return false;
|
|
7742
8066
|
}
|
|
7743
8067
|
}
|
|
@@ -7871,7 +8195,7 @@ exports.ucs2decode = function (string) {
|
|
|
7871
8195
|
};
|
|
7872
8196
|
/*jshint +W016*/
|
|
7873
8197
|
|
|
7874
|
-
},{}],
|
|
8198
|
+
},{}],86:[function(require,module,exports){
|
|
7875
8199
|
(function (process){
|
|
7876
8200
|
"use strict";
|
|
7877
8201
|
|
|
@@ -7897,6 +8221,8 @@ var defaultOptions = {
|
|
|
7897
8221
|
forceAdditional: false,
|
|
7898
8222
|
// assume additionalProperties and additionalItems are defined as "false" where appropriate
|
|
7899
8223
|
assumeAdditional: false,
|
|
8224
|
+
// do case insensitive comparison for enums
|
|
8225
|
+
enumCaseInsensitiveComparison: false,
|
|
7900
8226
|
// force items to be defined on "array" types
|
|
7901
8227
|
forceItems: false,
|
|
7902
8228
|
// force minItems to be defined on "array" types
|
|
@@ -7935,15 +8261,8 @@ var defaultOptions = {
|
|
|
7935
8261
|
customValidator: null
|
|
7936
8262
|
};
|
|
7937
8263
|
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
*/
|
|
7941
|
-
function ZSchema(options) {
|
|
7942
|
-
this.cache = {};
|
|
7943
|
-
this.referenceCache = [];
|
|
7944
|
-
|
|
7945
|
-
this.setRemoteReference("http://json-schema.org/draft-04/schema", Draft4Schema);
|
|
7946
|
-
this.setRemoteReference("http://json-schema.org/draft-04/hyper-schema", Draft4HyperSchema);
|
|
8264
|
+
function normalizeOptions(options) {
|
|
8265
|
+
var normalized;
|
|
7947
8266
|
|
|
7948
8267
|
// options
|
|
7949
8268
|
if (typeof options === "object") {
|
|
@@ -7969,22 +8288,40 @@ function ZSchema(options) {
|
|
|
7969
8288
|
}
|
|
7970
8289
|
}
|
|
7971
8290
|
|
|
7972
|
-
|
|
8291
|
+
normalized = options;
|
|
7973
8292
|
} else {
|
|
7974
|
-
|
|
8293
|
+
normalized = Utils.clone(defaultOptions);
|
|
7975
8294
|
}
|
|
7976
8295
|
|
|
7977
|
-
if (
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
8296
|
+
if (normalized.strictMode === true) {
|
|
8297
|
+
normalized.forceAdditional = true;
|
|
8298
|
+
normalized.forceItems = true;
|
|
8299
|
+
normalized.forceMaxLength = true;
|
|
8300
|
+
normalized.forceProperties = true;
|
|
8301
|
+
normalized.noExtraKeywords = true;
|
|
8302
|
+
normalized.noTypeless = true;
|
|
8303
|
+
normalized.noEmptyStrings = true;
|
|
8304
|
+
normalized.noEmptyArrays = true;
|
|
7986
8305
|
}
|
|
7987
8306
|
|
|
8307
|
+
return normalized;
|
|
8308
|
+
}
|
|
8309
|
+
|
|
8310
|
+
/*
|
|
8311
|
+
constructor
|
|
8312
|
+
*/
|
|
8313
|
+
function ZSchema(options) {
|
|
8314
|
+
this.cache = {};
|
|
8315
|
+
this.referenceCache = [];
|
|
8316
|
+
this.validateOptions = {};
|
|
8317
|
+
|
|
8318
|
+
this.options = normalizeOptions(options);
|
|
8319
|
+
|
|
8320
|
+
// Disable strict validation for the built-in schemas
|
|
8321
|
+
var metaschemaOptions = normalizeOptions({ });
|
|
8322
|
+
|
|
8323
|
+
this.setRemoteReference("http://json-schema.org/draft-04/schema", Draft4Schema, metaschemaOptions);
|
|
8324
|
+
this.setRemoteReference("http://json-schema.org/draft-04/hyper-schema", Draft4HyperSchema, metaschemaOptions);
|
|
7988
8325
|
}
|
|
7989
8326
|
|
|
7990
8327
|
/*
|
|
@@ -8023,6 +8360,8 @@ ZSchema.prototype.validate = function (json, schema, options, callback) {
|
|
|
8023
8360
|
}
|
|
8024
8361
|
if (!options) { options = {}; }
|
|
8025
8362
|
|
|
8363
|
+
this.validateOptions = options;
|
|
8364
|
+
|
|
8026
8365
|
var whatIs = Utils.whatIs(schema);
|
|
8027
8366
|
if (whatIs !== "string" && whatIs !== "object") {
|
|
8028
8367
|
var e = new Error("Invalid .validate call - schema must be an string or object but " + whatIs + " was passed!");
|
|
@@ -8132,12 +8471,17 @@ ZSchema.prototype.getMissingRemoteReferences = function () {
|
|
|
8132
8471
|
}
|
|
8133
8472
|
return missingRemoteReferences;
|
|
8134
8473
|
};
|
|
8135
|
-
ZSchema.prototype.setRemoteReference = function (uri, schema) {
|
|
8474
|
+
ZSchema.prototype.setRemoteReference = function (uri, schema, validationOptions) {
|
|
8136
8475
|
if (typeof schema === "string") {
|
|
8137
8476
|
schema = JSON.parse(schema);
|
|
8138
8477
|
} else {
|
|
8139
8478
|
schema = Utils.cloneDeep(schema);
|
|
8140
8479
|
}
|
|
8480
|
+
|
|
8481
|
+
if (validationOptions) {
|
|
8482
|
+
schema.__$validationOptions = normalizeOptions(validationOptions);
|
|
8483
|
+
}
|
|
8484
|
+
|
|
8141
8485
|
SchemaCache.cacheSchemaByUri.call(this, uri, schema);
|
|
8142
8486
|
};
|
|
8143
8487
|
ZSchema.prototype.getResolvedSchema = function (schema) {
|
|
@@ -8227,7 +8571,7 @@ ZSchema.getDefaultOptions = function () {
|
|
|
8227
8571
|
module.exports = ZSchema;
|
|
8228
8572
|
|
|
8229
8573
|
}).call(this,require('_process'))
|
|
8230
|
-
},{"./FormatValidators":
|
|
8574
|
+
},{"./FormatValidators":78,"./JsonValidation":79,"./Polyfills":80,"./Report":81,"./SchemaCache":82,"./SchemaCompilation":83,"./SchemaValidation":84,"./Utils":85,"./schemas/hyper-schema.json":87,"./schemas/schema.json":88,"_process":3,"lodash.get":1}],87:[function(require,module,exports){
|
|
8231
8575
|
module.exports={
|
|
8232
8576
|
"$schema": "http://json-schema.org/draft-04/hyper-schema#",
|
|
8233
8577
|
"id": "http://json-schema.org/draft-04/hyper-schema#",
|
|
@@ -8387,7 +8731,7 @@ module.exports={
|
|
|
8387
8731
|
}
|
|
8388
8732
|
|
|
8389
8733
|
|
|
8390
|
-
},{}],
|
|
8734
|
+
},{}],88:[function(require,module,exports){
|
|
8391
8735
|
module.exports={
|
|
8392
8736
|
"id": "http://json-schema.org/draft-04/schema#",
|
|
8393
8737
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
@@ -8540,5 +8884,5 @@ module.exports={
|
|
|
8540
8884
|
"default": {}
|
|
8541
8885
|
}
|
|
8542
8886
|
|
|
8543
|
-
},{}]},{},[
|
|
8544
|
-
});
|
|
8887
|
+
},{}]},{},[77,78,79,80,81,82,83,84,85,86])(86)
|
|
8888
|
+
});
|