z-schema 3.18.1 → 3.19.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 +55 -54
- package/dist/ZSchema-browser-min.js +1 -3
- package/dist/ZSchema-browser-min.js.map +1 -1
- package/dist/ZSchema-browser-test.js +5746 -4016
- package/dist/ZSchema-browser.js +1853 -985
- package/package.json +19 -19
- package/src/SchemaCache.js +9 -1
- package/src/ZSchema.js +36 -21
package/dist/ZSchema-browser.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
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(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
|
2
2
|
(function (global){
|
|
3
3
|
/**
|
|
4
|
-
* lodash
|
|
4
|
+
* lodash (Custom Build) <https://lodash.com/>
|
|
5
5
|
* Build: `lodash modularize exports="npm" -o ./`
|
|
6
6
|
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
|
7
7
|
* Released under MIT license <https://lodash.com/license>
|
|
@@ -24,9 +24,15 @@ var funcTag = '[object Function]',
|
|
|
24
24
|
symbolTag = '[object Symbol]';
|
|
25
25
|
|
|
26
26
|
/** Used to match property names within property paths. */
|
|
27
|
-
var
|
|
27
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
28
|
+
reIsPlainProp = /^\w*$/,
|
|
29
|
+
reLeadingDot = /^\./,
|
|
30
|
+
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
28
31
|
|
|
29
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Used to match `RegExp`
|
|
34
|
+
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
35
|
+
*/
|
|
30
36
|
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
31
37
|
|
|
32
38
|
/** Used to match backslashes in property paths. */
|
|
@@ -35,53 +41,25 @@ var reEscapeChar = /\\(\\)?/g;
|
|
|
35
41
|
/** Used to detect host constructors (Safari). */
|
|
36
42
|
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
37
43
|
|
|
38
|
-
/** Used to determine if values are of the language type `Object`. */
|
|
39
|
-
var objectTypes = {
|
|
40
|
-
'function': true,
|
|
41
|
-
'object': true
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/** Detect free variable `exports`. */
|
|
45
|
-
var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType)
|
|
46
|
-
? exports
|
|
47
|
-
: undefined;
|
|
48
|
-
|
|
49
|
-
/** Detect free variable `module`. */
|
|
50
|
-
var freeModule = (objectTypes[typeof module] && module && !module.nodeType)
|
|
51
|
-
? module
|
|
52
|
-
: undefined;
|
|
53
|
-
|
|
54
44
|
/** Detect free variable `global` from Node.js. */
|
|
55
|
-
var freeGlobal =
|
|
45
|
+
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
|
56
46
|
|
|
57
47
|
/** Detect free variable `self`. */
|
|
58
|
-
var freeSelf =
|
|
59
|
-
|
|
60
|
-
/** Detect free variable `window`. */
|
|
61
|
-
var freeWindow = checkGlobal(objectTypes[typeof window] && window);
|
|
62
|
-
|
|
63
|
-
/** Detect `this` as the global object. */
|
|
64
|
-
var thisGlobal = checkGlobal(objectTypes[typeof this] && this);
|
|
48
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
65
49
|
|
|
66
|
-
/**
|
|
67
|
-
|
|
68
|
-
*
|
|
69
|
-
* The `this` value is used if it's the global object to avoid Greasemonkey's
|
|
70
|
-
* restricted `window` object, otherwise the `window` object is used.
|
|
71
|
-
*/
|
|
72
|
-
var root = freeGlobal ||
|
|
73
|
-
((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) ||
|
|
74
|
-
freeSelf || thisGlobal || Function('return this')();
|
|
50
|
+
/** Used as a reference to the global object. */
|
|
51
|
+
var root = freeGlobal || freeSelf || Function('return this')();
|
|
75
52
|
|
|
76
53
|
/**
|
|
77
|
-
*
|
|
54
|
+
* Gets the value at `key` of `object`.
|
|
78
55
|
*
|
|
79
56
|
* @private
|
|
80
|
-
* @param {
|
|
81
|
-
* @
|
|
57
|
+
* @param {Object} [object] The object to query.
|
|
58
|
+
* @param {string} key The key of the property to get.
|
|
59
|
+
* @returns {*} Returns the property value.
|
|
82
60
|
*/
|
|
83
|
-
function
|
|
84
|
-
return
|
|
61
|
+
function getValue(object, key) {
|
|
62
|
+
return object == null ? undefined : object[key];
|
|
85
63
|
}
|
|
86
64
|
|
|
87
65
|
/**
|
|
@@ -105,16 +83,27 @@ function isHostObject(value) {
|
|
|
105
83
|
|
|
106
84
|
/** Used for built-in method references. */
|
|
107
85
|
var arrayProto = Array.prototype,
|
|
86
|
+
funcProto = Function.prototype,
|
|
108
87
|
objectProto = Object.prototype;
|
|
109
88
|
|
|
89
|
+
/** Used to detect overreaching core-js shims. */
|
|
90
|
+
var coreJsData = root['__core-js_shared__'];
|
|
91
|
+
|
|
92
|
+
/** Used to detect methods masquerading as native. */
|
|
93
|
+
var maskSrcKey = (function() {
|
|
94
|
+
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
|
95
|
+
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
96
|
+
}());
|
|
97
|
+
|
|
110
98
|
/** Used to resolve the decompiled source of functions. */
|
|
111
|
-
var funcToString =
|
|
99
|
+
var funcToString = funcProto.toString;
|
|
112
100
|
|
|
113
101
|
/** Used to check objects for own properties. */
|
|
114
102
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
115
103
|
|
|
116
104
|
/**
|
|
117
|
-
* Used to resolve the
|
|
105
|
+
* Used to resolve the
|
|
106
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
118
107
|
* of values.
|
|
119
108
|
*/
|
|
120
109
|
var objectToString = objectProto.toString;
|
|
@@ -138,234 +127,314 @@ var symbolProto = Symbol ? Symbol.prototype : undefined,
|
|
|
138
127
|
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
139
128
|
|
|
140
129
|
/**
|
|
141
|
-
* Creates
|
|
130
|
+
* Creates a hash object.
|
|
142
131
|
*
|
|
143
132
|
* @private
|
|
144
133
|
* @constructor
|
|
145
|
-
* @
|
|
134
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
135
|
+
*/
|
|
136
|
+
function Hash(entries) {
|
|
137
|
+
var index = -1,
|
|
138
|
+
length = entries ? entries.length : 0;
|
|
139
|
+
|
|
140
|
+
this.clear();
|
|
141
|
+
while (++index < length) {
|
|
142
|
+
var entry = entries[index];
|
|
143
|
+
this.set(entry[0], entry[1]);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Removes all key-value entries from the hash.
|
|
149
|
+
*
|
|
150
|
+
* @private
|
|
151
|
+
* @name clear
|
|
152
|
+
* @memberOf Hash
|
|
146
153
|
*/
|
|
147
|
-
function
|
|
154
|
+
function hashClear() {
|
|
155
|
+
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
156
|
+
}
|
|
148
157
|
|
|
149
158
|
/**
|
|
150
159
|
* Removes `key` and its value from the hash.
|
|
151
160
|
*
|
|
152
161
|
* @private
|
|
162
|
+
* @name delete
|
|
163
|
+
* @memberOf Hash
|
|
153
164
|
* @param {Object} hash The hash to modify.
|
|
154
165
|
* @param {string} key The key of the value to remove.
|
|
155
166
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
156
167
|
*/
|
|
157
|
-
function hashDelete(
|
|
158
|
-
return
|
|
168
|
+
function hashDelete(key) {
|
|
169
|
+
return this.has(key) && delete this.__data__[key];
|
|
159
170
|
}
|
|
160
171
|
|
|
161
172
|
/**
|
|
162
173
|
* Gets the hash value for `key`.
|
|
163
174
|
*
|
|
164
175
|
* @private
|
|
165
|
-
* @
|
|
176
|
+
* @name get
|
|
177
|
+
* @memberOf Hash
|
|
166
178
|
* @param {string} key The key of the value to get.
|
|
167
179
|
* @returns {*} Returns the entry value.
|
|
168
180
|
*/
|
|
169
|
-
function hashGet(
|
|
181
|
+
function hashGet(key) {
|
|
182
|
+
var data = this.__data__;
|
|
170
183
|
if (nativeCreate) {
|
|
171
|
-
var result =
|
|
184
|
+
var result = data[key];
|
|
172
185
|
return result === HASH_UNDEFINED ? undefined : result;
|
|
173
186
|
}
|
|
174
|
-
return hasOwnProperty.call(
|
|
187
|
+
return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
|
175
188
|
}
|
|
176
189
|
|
|
177
190
|
/**
|
|
178
191
|
* Checks if a hash value for `key` exists.
|
|
179
192
|
*
|
|
180
193
|
* @private
|
|
181
|
-
* @
|
|
194
|
+
* @name has
|
|
195
|
+
* @memberOf Hash
|
|
182
196
|
* @param {string} key The key of the entry to check.
|
|
183
197
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
184
198
|
*/
|
|
185
|
-
function hashHas(
|
|
186
|
-
|
|
199
|
+
function hashHas(key) {
|
|
200
|
+
var data = this.__data__;
|
|
201
|
+
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
|
|
187
202
|
}
|
|
188
203
|
|
|
189
204
|
/**
|
|
190
205
|
* Sets the hash `key` to `value`.
|
|
191
206
|
*
|
|
192
207
|
* @private
|
|
193
|
-
* @
|
|
208
|
+
* @name set
|
|
209
|
+
* @memberOf Hash
|
|
194
210
|
* @param {string} key The key of the value to set.
|
|
195
211
|
* @param {*} value The value to set.
|
|
212
|
+
* @returns {Object} Returns the hash instance.
|
|
196
213
|
*/
|
|
197
|
-
function hashSet(
|
|
198
|
-
|
|
214
|
+
function hashSet(key, value) {
|
|
215
|
+
var data = this.__data__;
|
|
216
|
+
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
|
217
|
+
return this;
|
|
199
218
|
}
|
|
200
219
|
|
|
201
|
-
//
|
|
202
|
-
Hash.prototype =
|
|
220
|
+
// Add methods to `Hash`.
|
|
221
|
+
Hash.prototype.clear = hashClear;
|
|
222
|
+
Hash.prototype['delete'] = hashDelete;
|
|
223
|
+
Hash.prototype.get = hashGet;
|
|
224
|
+
Hash.prototype.has = hashHas;
|
|
225
|
+
Hash.prototype.set = hashSet;
|
|
203
226
|
|
|
204
227
|
/**
|
|
205
|
-
* Creates
|
|
228
|
+
* Creates an list cache object.
|
|
206
229
|
*
|
|
207
230
|
* @private
|
|
208
231
|
* @constructor
|
|
209
|
-
* @param {Array} [
|
|
232
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
210
233
|
*/
|
|
211
|
-
function
|
|
234
|
+
function ListCache(entries) {
|
|
212
235
|
var index = -1,
|
|
213
|
-
length =
|
|
236
|
+
length = entries ? entries.length : 0;
|
|
214
237
|
|
|
215
238
|
this.clear();
|
|
216
239
|
while (++index < length) {
|
|
217
|
-
var entry =
|
|
240
|
+
var entry = entries[index];
|
|
218
241
|
this.set(entry[0], entry[1]);
|
|
219
242
|
}
|
|
220
243
|
}
|
|
221
244
|
|
|
222
245
|
/**
|
|
223
|
-
* Removes all key-value entries from the
|
|
246
|
+
* Removes all key-value entries from the list cache.
|
|
224
247
|
*
|
|
225
248
|
* @private
|
|
226
249
|
* @name clear
|
|
227
|
-
* @memberOf
|
|
250
|
+
* @memberOf ListCache
|
|
228
251
|
*/
|
|
229
|
-
function
|
|
230
|
-
this.__data__ =
|
|
231
|
-
'hash': new Hash,
|
|
232
|
-
'map': Map ? new Map : [],
|
|
233
|
-
'string': new Hash
|
|
234
|
-
};
|
|
252
|
+
function listCacheClear() {
|
|
253
|
+
this.__data__ = [];
|
|
235
254
|
}
|
|
236
255
|
|
|
237
256
|
/**
|
|
238
|
-
* Removes `key` and its value from the
|
|
257
|
+
* Removes `key` and its value from the list cache.
|
|
239
258
|
*
|
|
240
259
|
* @private
|
|
241
260
|
* @name delete
|
|
242
|
-
* @memberOf
|
|
261
|
+
* @memberOf ListCache
|
|
243
262
|
* @param {string} key The key of the value to remove.
|
|
244
263
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
245
264
|
*/
|
|
246
|
-
function
|
|
247
|
-
var data = this.__data__
|
|
248
|
-
|
|
249
|
-
|
|
265
|
+
function listCacheDelete(key) {
|
|
266
|
+
var data = this.__data__,
|
|
267
|
+
index = assocIndexOf(data, key);
|
|
268
|
+
|
|
269
|
+
if (index < 0) {
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
var lastIndex = data.length - 1;
|
|
273
|
+
if (index == lastIndex) {
|
|
274
|
+
data.pop();
|
|
275
|
+
} else {
|
|
276
|
+
splice.call(data, index, 1);
|
|
250
277
|
}
|
|
251
|
-
return
|
|
278
|
+
return true;
|
|
252
279
|
}
|
|
253
280
|
|
|
254
281
|
/**
|
|
255
|
-
* Gets the
|
|
282
|
+
* Gets the list cache value for `key`.
|
|
256
283
|
*
|
|
257
284
|
* @private
|
|
258
285
|
* @name get
|
|
259
|
-
* @memberOf
|
|
286
|
+
* @memberOf ListCache
|
|
260
287
|
* @param {string} key The key of the value to get.
|
|
261
288
|
* @returns {*} Returns the entry value.
|
|
262
289
|
*/
|
|
263
|
-
function
|
|
264
|
-
var data = this.__data__
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
return Map ? data.map.get(key) : assocGet(data.map, key);
|
|
290
|
+
function listCacheGet(key) {
|
|
291
|
+
var data = this.__data__,
|
|
292
|
+
index = assocIndexOf(data, key);
|
|
293
|
+
|
|
294
|
+
return index < 0 ? undefined : data[index][1];
|
|
269
295
|
}
|
|
270
296
|
|
|
271
297
|
/**
|
|
272
|
-
* Checks if a
|
|
298
|
+
* Checks if a list cache value for `key` exists.
|
|
273
299
|
*
|
|
274
300
|
* @private
|
|
275
301
|
* @name has
|
|
276
|
-
* @memberOf
|
|
302
|
+
* @memberOf ListCache
|
|
277
303
|
* @param {string} key The key of the entry to check.
|
|
278
304
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
279
305
|
*/
|
|
280
|
-
function
|
|
281
|
-
|
|
282
|
-
if (isKeyable(key)) {
|
|
283
|
-
return hashHas(typeof key == 'string' ? data.string : data.hash, key);
|
|
284
|
-
}
|
|
285
|
-
return Map ? data.map.has(key) : assocHas(data.map, key);
|
|
306
|
+
function listCacheHas(key) {
|
|
307
|
+
return assocIndexOf(this.__data__, key) > -1;
|
|
286
308
|
}
|
|
287
309
|
|
|
288
310
|
/**
|
|
289
|
-
* Sets the
|
|
311
|
+
* Sets the list cache `key` to `value`.
|
|
290
312
|
*
|
|
291
313
|
* @private
|
|
292
314
|
* @name set
|
|
293
|
-
* @memberOf
|
|
315
|
+
* @memberOf ListCache
|
|
294
316
|
* @param {string} key The key of the value to set.
|
|
295
317
|
* @param {*} value The value to set.
|
|
296
|
-
* @returns {Object} Returns the
|
|
318
|
+
* @returns {Object} Returns the list cache instance.
|
|
297
319
|
*/
|
|
298
|
-
function
|
|
299
|
-
var data = this.__data__
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
data.
|
|
320
|
+
function listCacheSet(key, value) {
|
|
321
|
+
var data = this.__data__,
|
|
322
|
+
index = assocIndexOf(data, key);
|
|
323
|
+
|
|
324
|
+
if (index < 0) {
|
|
325
|
+
data.push([key, value]);
|
|
304
326
|
} else {
|
|
305
|
-
|
|
327
|
+
data[index][1] = value;
|
|
306
328
|
}
|
|
307
329
|
return this;
|
|
308
330
|
}
|
|
309
331
|
|
|
310
|
-
// Add methods to `
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
332
|
+
// Add methods to `ListCache`.
|
|
333
|
+
ListCache.prototype.clear = listCacheClear;
|
|
334
|
+
ListCache.prototype['delete'] = listCacheDelete;
|
|
335
|
+
ListCache.prototype.get = listCacheGet;
|
|
336
|
+
ListCache.prototype.has = listCacheHas;
|
|
337
|
+
ListCache.prototype.set = listCacheSet;
|
|
316
338
|
|
|
317
339
|
/**
|
|
318
|
-
*
|
|
340
|
+
* Creates a map cache object to store key-value pairs.
|
|
319
341
|
*
|
|
320
342
|
* @private
|
|
321
|
-
* @
|
|
343
|
+
* @constructor
|
|
344
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
345
|
+
*/
|
|
346
|
+
function MapCache(entries) {
|
|
347
|
+
var index = -1,
|
|
348
|
+
length = entries ? entries.length : 0;
|
|
349
|
+
|
|
350
|
+
this.clear();
|
|
351
|
+
while (++index < length) {
|
|
352
|
+
var entry = entries[index];
|
|
353
|
+
this.set(entry[0], entry[1]);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Removes all key-value entries from the map.
|
|
359
|
+
*
|
|
360
|
+
* @private
|
|
361
|
+
* @name clear
|
|
362
|
+
* @memberOf MapCache
|
|
363
|
+
*/
|
|
364
|
+
function mapCacheClear() {
|
|
365
|
+
this.__data__ = {
|
|
366
|
+
'hash': new Hash,
|
|
367
|
+
'map': new (Map || ListCache),
|
|
368
|
+
'string': new Hash
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Removes `key` and its value from the map.
|
|
374
|
+
*
|
|
375
|
+
* @private
|
|
376
|
+
* @name delete
|
|
377
|
+
* @memberOf MapCache
|
|
322
378
|
* @param {string} key The key of the value to remove.
|
|
323
379
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
324
380
|
*/
|
|
325
|
-
function
|
|
326
|
-
|
|
327
|
-
if (index < 0) {
|
|
328
|
-
return false;
|
|
329
|
-
}
|
|
330
|
-
var lastIndex = array.length - 1;
|
|
331
|
-
if (index == lastIndex) {
|
|
332
|
-
array.pop();
|
|
333
|
-
} else {
|
|
334
|
-
splice.call(array, index, 1);
|
|
335
|
-
}
|
|
336
|
-
return true;
|
|
381
|
+
function mapCacheDelete(key) {
|
|
382
|
+
return getMapData(this, key)['delete'](key);
|
|
337
383
|
}
|
|
338
384
|
|
|
339
385
|
/**
|
|
340
|
-
* Gets the
|
|
386
|
+
* Gets the map value for `key`.
|
|
341
387
|
*
|
|
342
388
|
* @private
|
|
343
|
-
* @
|
|
389
|
+
* @name get
|
|
390
|
+
* @memberOf MapCache
|
|
344
391
|
* @param {string} key The key of the value to get.
|
|
345
392
|
* @returns {*} Returns the entry value.
|
|
346
393
|
*/
|
|
347
|
-
function
|
|
348
|
-
|
|
349
|
-
return index < 0 ? undefined : array[index][1];
|
|
394
|
+
function mapCacheGet(key) {
|
|
395
|
+
return getMapData(this, key).get(key);
|
|
350
396
|
}
|
|
351
397
|
|
|
352
398
|
/**
|
|
353
|
-
* Checks if
|
|
399
|
+
* Checks if a map value for `key` exists.
|
|
354
400
|
*
|
|
355
401
|
* @private
|
|
356
|
-
* @
|
|
402
|
+
* @name has
|
|
403
|
+
* @memberOf MapCache
|
|
357
404
|
* @param {string} key The key of the entry to check.
|
|
358
405
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
359
406
|
*/
|
|
360
|
-
function
|
|
361
|
-
return
|
|
407
|
+
function mapCacheHas(key) {
|
|
408
|
+
return getMapData(this, key).has(key);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Sets the map `key` to `value`.
|
|
413
|
+
*
|
|
414
|
+
* @private
|
|
415
|
+
* @name set
|
|
416
|
+
* @memberOf MapCache
|
|
417
|
+
* @param {string} key The key of the value to set.
|
|
418
|
+
* @param {*} value The value to set.
|
|
419
|
+
* @returns {Object} Returns the map cache instance.
|
|
420
|
+
*/
|
|
421
|
+
function mapCacheSet(key, value) {
|
|
422
|
+
getMapData(this, key).set(key, value);
|
|
423
|
+
return this;
|
|
362
424
|
}
|
|
363
425
|
|
|
426
|
+
// Add methods to `MapCache`.
|
|
427
|
+
MapCache.prototype.clear = mapCacheClear;
|
|
428
|
+
MapCache.prototype['delete'] = mapCacheDelete;
|
|
429
|
+
MapCache.prototype.get = mapCacheGet;
|
|
430
|
+
MapCache.prototype.has = mapCacheHas;
|
|
431
|
+
MapCache.prototype.set = mapCacheSet;
|
|
432
|
+
|
|
364
433
|
/**
|
|
365
434
|
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
366
435
|
*
|
|
367
436
|
* @private
|
|
368
|
-
* @param {Array} array The array to
|
|
437
|
+
* @param {Array} array The array to inspect.
|
|
369
438
|
* @param {*} key The key to search for.
|
|
370
439
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
371
440
|
*/
|
|
@@ -380,20 +449,85 @@ function assocIndexOf(array, key) {
|
|
|
380
449
|
}
|
|
381
450
|
|
|
382
451
|
/**
|
|
383
|
-
*
|
|
452
|
+
* The base implementation of `_.get` without support for default values.
|
|
384
453
|
*
|
|
385
454
|
* @private
|
|
386
|
-
* @param {
|
|
387
|
-
* @param {string}
|
|
388
|
-
* @
|
|
455
|
+
* @param {Object} object The object to query.
|
|
456
|
+
* @param {Array|string} path The path of the property to get.
|
|
457
|
+
* @returns {*} Returns the resolved value.
|
|
389
458
|
*/
|
|
390
|
-
function
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
459
|
+
function baseGet(object, path) {
|
|
460
|
+
path = isKey(path, object) ? [path] : castPath(path);
|
|
461
|
+
|
|
462
|
+
var index = 0,
|
|
463
|
+
length = path.length;
|
|
464
|
+
|
|
465
|
+
while (object != null && index < length) {
|
|
466
|
+
object = object[toKey(path[index++])];
|
|
467
|
+
}
|
|
468
|
+
return (index && index == length) ? object : undefined;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* The base implementation of `_.isNative` without bad shim checks.
|
|
473
|
+
*
|
|
474
|
+
* @private
|
|
475
|
+
* @param {*} value The value to check.
|
|
476
|
+
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
477
|
+
* else `false`.
|
|
478
|
+
*/
|
|
479
|
+
function baseIsNative(value) {
|
|
480
|
+
if (!isObject(value) || isMasked(value)) {
|
|
481
|
+
return false;
|
|
482
|
+
}
|
|
483
|
+
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
|
|
484
|
+
return pattern.test(toSource(value));
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* The base implementation of `_.toString` which doesn't convert nullish
|
|
489
|
+
* values to empty strings.
|
|
490
|
+
*
|
|
491
|
+
* @private
|
|
492
|
+
* @param {*} value The value to process.
|
|
493
|
+
* @returns {string} Returns the string.
|
|
494
|
+
*/
|
|
495
|
+
function baseToString(value) {
|
|
496
|
+
// Exit early for strings to avoid a performance hit in some environments.
|
|
497
|
+
if (typeof value == 'string') {
|
|
498
|
+
return value;
|
|
499
|
+
}
|
|
500
|
+
if (isSymbol(value)) {
|
|
501
|
+
return symbolToString ? symbolToString.call(value) : '';
|
|
396
502
|
}
|
|
503
|
+
var result = (value + '');
|
|
504
|
+
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Casts `value` to a path array if it's not one.
|
|
509
|
+
*
|
|
510
|
+
* @private
|
|
511
|
+
* @param {*} value The value to inspect.
|
|
512
|
+
* @returns {Array} Returns the cast property path array.
|
|
513
|
+
*/
|
|
514
|
+
function castPath(value) {
|
|
515
|
+
return isArray(value) ? value : stringToPath(value);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Gets the data for `map`.
|
|
520
|
+
*
|
|
521
|
+
* @private
|
|
522
|
+
* @param {Object} map The map to query.
|
|
523
|
+
* @param {string} key The reference key.
|
|
524
|
+
* @returns {*} Returns the map data.
|
|
525
|
+
*/
|
|
526
|
+
function getMapData(map, key) {
|
|
527
|
+
var data = map.__data__;
|
|
528
|
+
return isKeyable(key)
|
|
529
|
+
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
530
|
+
: data.map;
|
|
397
531
|
}
|
|
398
532
|
|
|
399
533
|
/**
|
|
@@ -405,8 +539,29 @@ function assocSet(array, key, value) {
|
|
|
405
539
|
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
406
540
|
*/
|
|
407
541
|
function getNative(object, key) {
|
|
408
|
-
var value = object
|
|
409
|
-
return
|
|
542
|
+
var value = getValue(object, key);
|
|
543
|
+
return baseIsNative(value) ? value : undefined;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Checks if `value` is a property name and not a property path.
|
|
548
|
+
*
|
|
549
|
+
* @private
|
|
550
|
+
* @param {*} value The value to check.
|
|
551
|
+
* @param {Object} [object] The object to query keys on.
|
|
552
|
+
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
|
553
|
+
*/
|
|
554
|
+
function isKey(value, object) {
|
|
555
|
+
if (isArray(value)) {
|
|
556
|
+
return false;
|
|
557
|
+
}
|
|
558
|
+
var type = typeof value;
|
|
559
|
+
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
|
560
|
+
value == null || isSymbol(value)) {
|
|
561
|
+
return true;
|
|
562
|
+
}
|
|
563
|
+
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
|
564
|
+
(object != null && value in Object(object));
|
|
410
565
|
}
|
|
411
566
|
|
|
412
567
|
/**
|
|
@@ -418,8 +573,20 @@ function getNative(object, key) {
|
|
|
418
573
|
*/
|
|
419
574
|
function isKeyable(value) {
|
|
420
575
|
var type = typeof value;
|
|
421
|
-
return type == 'number' || type == '
|
|
422
|
-
(
|
|
576
|
+
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
577
|
+
? (value !== '__proto__')
|
|
578
|
+
: (value === null);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Checks if `func` has its source masked.
|
|
583
|
+
*
|
|
584
|
+
* @private
|
|
585
|
+
* @param {Function} func The function to check.
|
|
586
|
+
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
587
|
+
*/
|
|
588
|
+
function isMasked(func) {
|
|
589
|
+
return !!maskSrcKey && (maskSrcKey in func);
|
|
423
590
|
}
|
|
424
591
|
|
|
425
592
|
/**
|
|
@@ -430,16 +597,55 @@ function isKeyable(value) {
|
|
|
430
597
|
* @returns {Array} Returns the property path array.
|
|
431
598
|
*/
|
|
432
599
|
var stringToPath = memoize(function(string) {
|
|
600
|
+
string = toString(string);
|
|
601
|
+
|
|
433
602
|
var result = [];
|
|
434
|
-
|
|
603
|
+
if (reLeadingDot.test(string)) {
|
|
604
|
+
result.push('');
|
|
605
|
+
}
|
|
606
|
+
string.replace(rePropName, function(match, number, quote, string) {
|
|
435
607
|
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
|
|
436
608
|
});
|
|
437
609
|
return result;
|
|
438
610
|
});
|
|
439
611
|
|
|
612
|
+
/**
|
|
613
|
+
* Converts `value` to a string key if it's not a string or symbol.
|
|
614
|
+
*
|
|
615
|
+
* @private
|
|
616
|
+
* @param {*} value The value to inspect.
|
|
617
|
+
* @returns {string|symbol} Returns the key.
|
|
618
|
+
*/
|
|
619
|
+
function toKey(value) {
|
|
620
|
+
if (typeof value == 'string' || isSymbol(value)) {
|
|
621
|
+
return value;
|
|
622
|
+
}
|
|
623
|
+
var result = (value + '');
|
|
624
|
+
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
/**
|
|
628
|
+
* Converts `func` to its source code.
|
|
629
|
+
*
|
|
630
|
+
* @private
|
|
631
|
+
* @param {Function} func The function to process.
|
|
632
|
+
* @returns {string} Returns the source code.
|
|
633
|
+
*/
|
|
634
|
+
function toSource(func) {
|
|
635
|
+
if (func != null) {
|
|
636
|
+
try {
|
|
637
|
+
return funcToString.call(func);
|
|
638
|
+
} catch (e) {}
|
|
639
|
+
try {
|
|
640
|
+
return (func + '');
|
|
641
|
+
} catch (e) {}
|
|
642
|
+
}
|
|
643
|
+
return '';
|
|
644
|
+
}
|
|
645
|
+
|
|
440
646
|
/**
|
|
441
647
|
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
442
|
-
* provided it determines the cache key for storing the result based on the
|
|
648
|
+
* provided, it determines the cache key for storing the result based on the
|
|
443
649
|
* arguments provided to the memoized function. By default, the first argument
|
|
444
650
|
* provided to the memoized function is used as the map cache key. The `func`
|
|
445
651
|
* is invoked with the `this` binding of the memoized function.
|
|
@@ -447,7 +653,7 @@ var stringToPath = memoize(function(string) {
|
|
|
447
653
|
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
448
654
|
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
449
655
|
* constructor with one whose instances implement the
|
|
450
|
-
* [`Map`](http://ecma-international.org/ecma-262/
|
|
656
|
+
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
451
657
|
* method interface of `delete`, `get`, `has`, and `set`.
|
|
452
658
|
*
|
|
453
659
|
* @static
|
|
@@ -456,7 +662,7 @@ var stringToPath = memoize(function(string) {
|
|
|
456
662
|
* @category Function
|
|
457
663
|
* @param {Function} func The function to have its output memoized.
|
|
458
664
|
* @param {Function} [resolver] The function to resolve the cache key.
|
|
459
|
-
* @returns {Function} Returns the new
|
|
665
|
+
* @returns {Function} Returns the new memoized function.
|
|
460
666
|
* @example
|
|
461
667
|
*
|
|
462
668
|
* var object = { 'a': 1, 'b': 2 };
|
|
@@ -478,316 +684,66 @@ var stringToPath = memoize(function(string) {
|
|
|
478
684
|
* values(object);
|
|
479
685
|
* // => ['a', 'b']
|
|
480
686
|
*
|
|
481
|
-
* // Replace `_.memoize.Cache`.
|
|
482
|
-
* _.memoize.Cache = WeakMap;
|
|
483
|
-
*/
|
|
484
|
-
function memoize(func, resolver) {
|
|
485
|
-
if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
|
|
486
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
487
|
-
}
|
|
488
|
-
var memoized = function() {
|
|
489
|
-
var args = arguments,
|
|
490
|
-
key = resolver ? resolver.apply(this, args) : args[0],
|
|
491
|
-
cache = memoized.cache;
|
|
492
|
-
|
|
493
|
-
if (cache.has(key)) {
|
|
494
|
-
return cache.get(key);
|
|
495
|
-
}
|
|
496
|
-
var result = func.apply(this, args);
|
|
497
|
-
memoized.cache = cache.set(key, result);
|
|
498
|
-
return result;
|
|
499
|
-
};
|
|
500
|
-
memoized.cache = new (memoize.Cache || MapCache);
|
|
501
|
-
return memoized;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
// Assign cache to `_.memoize`.
|
|
505
|
-
memoize.Cache = MapCache;
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* Performs a
|
|
509
|
-
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
|
510
|
-
* comparison between two values to determine if they are equivalent.
|
|
511
|
-
*
|
|
512
|
-
* @static
|
|
513
|
-
* @memberOf _
|
|
514
|
-
* @since 4.0.0
|
|
515
|
-
* @category Lang
|
|
516
|
-
* @param {*} value The value to compare.
|
|
517
|
-
* @param {*} other The other value to compare.
|
|
518
|
-
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
519
|
-
* @example
|
|
520
|
-
*
|
|
521
|
-
* var object = { 'user': 'fred' };
|
|
522
|
-
* var other = { 'user': 'fred' };
|
|
523
|
-
*
|
|
524
|
-
* _.eq(object, object);
|
|
525
|
-
* // => true
|
|
526
|
-
*
|
|
527
|
-
* _.eq(object, other);
|
|
528
|
-
* // => false
|
|
529
|
-
*
|
|
530
|
-
* _.eq('a', 'a');
|
|
531
|
-
* // => true
|
|
532
|
-
*
|
|
533
|
-
* _.eq('a', Object('a'));
|
|
534
|
-
* // => false
|
|
535
|
-
*
|
|
536
|
-
* _.eq(NaN, NaN);
|
|
537
|
-
* // => true
|
|
538
|
-
*/
|
|
539
|
-
function eq(value, other) {
|
|
540
|
-
return value === other || (value !== value && other !== other);
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
/**
|
|
544
|
-
* Checks if `value` is classified as a `Function` object.
|
|
545
|
-
*
|
|
546
|
-
* @static
|
|
547
|
-
* @memberOf _
|
|
548
|
-
* @since 0.1.0
|
|
549
|
-
* @category Lang
|
|
550
|
-
* @param {*} value The value to check.
|
|
551
|
-
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
|
552
|
-
* else `false`.
|
|
553
|
-
* @example
|
|
554
|
-
*
|
|
555
|
-
* _.isFunction(_);
|
|
556
|
-
* // => true
|
|
557
|
-
*
|
|
558
|
-
* _.isFunction(/abc/);
|
|
559
|
-
* // => false
|
|
560
|
-
*/
|
|
561
|
-
function isFunction(value) {
|
|
562
|
-
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
563
|
-
// in Safari 8 which returns 'object' for typed array and weak map constructors,
|
|
564
|
-
// and PhantomJS 1.9 which returns 'function' for `NodeList` instances.
|
|
565
|
-
var tag = isObject(value) ? objectToString.call(value) : '';
|
|
566
|
-
return tag == funcTag || tag == genTag;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
/**
|
|
570
|
-
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
|
|
571
|
-
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
572
|
-
*
|
|
573
|
-
* @static
|
|
574
|
-
* @memberOf _
|
|
575
|
-
* @since 0.1.0
|
|
576
|
-
* @category Lang
|
|
577
|
-
* @param {*} value The value to check.
|
|
578
|
-
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
579
|
-
* @example
|
|
580
|
-
*
|
|
581
|
-
* _.isObject({});
|
|
582
|
-
* // => true
|
|
583
|
-
*
|
|
584
|
-
* _.isObject([1, 2, 3]);
|
|
585
|
-
* // => true
|
|
586
|
-
*
|
|
587
|
-
* _.isObject(_.noop);
|
|
588
|
-
* // => true
|
|
589
|
-
*
|
|
590
|
-
* _.isObject(null);
|
|
591
|
-
* // => false
|
|
592
|
-
*/
|
|
593
|
-
function isObject(value) {
|
|
594
|
-
var type = typeof value;
|
|
595
|
-
return !!value && (type == 'object' || type == 'function');
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
/**
|
|
599
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
600
|
-
* and has a `typeof` result of "object".
|
|
601
|
-
*
|
|
602
|
-
* @static
|
|
603
|
-
* @memberOf _
|
|
604
|
-
* @since 4.0.0
|
|
605
|
-
* @category Lang
|
|
606
|
-
* @param {*} value The value to check.
|
|
607
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
608
|
-
* @example
|
|
609
|
-
*
|
|
610
|
-
* _.isObjectLike({});
|
|
611
|
-
* // => true
|
|
612
|
-
*
|
|
613
|
-
* _.isObjectLike([1, 2, 3]);
|
|
614
|
-
* // => true
|
|
615
|
-
*
|
|
616
|
-
* _.isObjectLike(_.noop);
|
|
617
|
-
* // => false
|
|
618
|
-
*
|
|
619
|
-
* _.isObjectLike(null);
|
|
620
|
-
* // => false
|
|
621
|
-
*/
|
|
622
|
-
function isObjectLike(value) {
|
|
623
|
-
return !!value && typeof value == 'object';
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
/**
|
|
627
|
-
* Checks if `value` is a native function.
|
|
628
|
-
*
|
|
629
|
-
* @static
|
|
630
|
-
* @memberOf _
|
|
631
|
-
* @since 3.0.0
|
|
632
|
-
* @category Lang
|
|
633
|
-
* @param {*} value The value to check.
|
|
634
|
-
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
635
|
-
* else `false`.
|
|
636
|
-
* @example
|
|
637
|
-
*
|
|
638
|
-
* _.isNative(Array.prototype.push);
|
|
639
|
-
* // => true
|
|
640
|
-
*
|
|
641
|
-
* _.isNative(_);
|
|
642
|
-
* // => false
|
|
643
|
-
*/
|
|
644
|
-
function isNative(value) {
|
|
645
|
-
if (value == null) {
|
|
646
|
-
return false;
|
|
647
|
-
}
|
|
648
|
-
if (isFunction(value)) {
|
|
649
|
-
return reIsNative.test(funcToString.call(value));
|
|
650
|
-
}
|
|
651
|
-
return isObjectLike(value) &&
|
|
652
|
-
(isHostObject(value) ? reIsNative : reIsHostCtor).test(value);
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
/**
|
|
656
|
-
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
657
|
-
*
|
|
658
|
-
* @static
|
|
659
|
-
* @memberOf _
|
|
660
|
-
* @since 4.0.0
|
|
661
|
-
* @category Lang
|
|
662
|
-
* @param {*} value The value to check.
|
|
663
|
-
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
|
664
|
-
* else `false`.
|
|
665
|
-
* @example
|
|
666
|
-
*
|
|
667
|
-
* _.isSymbol(Symbol.iterator);
|
|
668
|
-
* // => true
|
|
669
|
-
*
|
|
670
|
-
* _.isSymbol('abc');
|
|
671
|
-
* // => false
|
|
672
|
-
*/
|
|
673
|
-
function isSymbol(value) {
|
|
674
|
-
return typeof value == 'symbol' ||
|
|
675
|
-
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
/**
|
|
679
|
-
* Converts `value` to a string if it's not one. An empty string is returned
|
|
680
|
-
* for `null` and `undefined` values. The sign of `-0` is preserved.
|
|
681
|
-
*
|
|
682
|
-
* @static
|
|
683
|
-
* @memberOf _
|
|
684
|
-
* @since 4.0.0
|
|
685
|
-
* @category Lang
|
|
686
|
-
* @param {*} value The value to process.
|
|
687
|
-
* @returns {string} Returns the string.
|
|
688
|
-
* @example
|
|
689
|
-
*
|
|
690
|
-
* _.toString(null);
|
|
691
|
-
* // => ''
|
|
692
|
-
*
|
|
693
|
-
* _.toString(-0);
|
|
694
|
-
* // => '-0'
|
|
695
|
-
*
|
|
696
|
-
* _.toString([1, 2, 3]);
|
|
697
|
-
* // => '1,2,3'
|
|
698
|
-
*/
|
|
699
|
-
function toString(value) {
|
|
700
|
-
// Exit early for strings to avoid a performance hit in some environments.
|
|
701
|
-
if (typeof value == 'string') {
|
|
702
|
-
return value;
|
|
703
|
-
}
|
|
704
|
-
if (value == null) {
|
|
705
|
-
return '';
|
|
706
|
-
}
|
|
707
|
-
if (isSymbol(value)) {
|
|
708
|
-
return symbolToString ? symbolToString.call(value) : '';
|
|
709
|
-
}
|
|
710
|
-
var result = (value + '');
|
|
711
|
-
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
module.exports = stringToPath;
|
|
715
|
-
|
|
716
|
-
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
717
|
-
},{}],2:[function(require,module,exports){
|
|
718
|
-
/**
|
|
719
|
-
* lodash 4.2.0 (Custom Build) <https://lodash.com/>
|
|
720
|
-
* Build: `lodash modularize exports="npm" -o ./`
|
|
721
|
-
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
|
722
|
-
* Released under MIT license <https://lodash.com/license>
|
|
723
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
724
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
725
|
-
*/
|
|
726
|
-
var stringToPath = require('lodash._stringtopath');
|
|
727
|
-
|
|
728
|
-
/** `Object#toString` result references. */
|
|
729
|
-
var symbolTag = '[object Symbol]';
|
|
730
|
-
|
|
731
|
-
/** Used to match property names within property paths. */
|
|
732
|
-
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
733
|
-
reIsPlainProp = /^\w*$/;
|
|
734
|
-
|
|
735
|
-
/** Used for built-in method references. */
|
|
736
|
-
var objectProto = Object.prototype;
|
|
737
|
-
|
|
738
|
-
/**
|
|
739
|
-
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
|
740
|
-
* of values.
|
|
741
|
-
*/
|
|
742
|
-
var objectToString = objectProto.toString;
|
|
743
|
-
|
|
744
|
-
/**
|
|
745
|
-
* Casts `value` to a path array if it's not one.
|
|
746
|
-
*
|
|
747
|
-
* @private
|
|
748
|
-
* @param {*} value The value to inspect.
|
|
749
|
-
* @returns {Array} Returns the cast property path array.
|
|
750
|
-
*/
|
|
751
|
-
function baseCastPath(value) {
|
|
752
|
-
return isArray(value) ? value : stringToPath(value);
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
/**
|
|
756
|
-
* The base implementation of `_.get` without support for default values.
|
|
757
|
-
*
|
|
758
|
-
* @private
|
|
759
|
-
* @param {Object} object The object to query.
|
|
760
|
-
* @param {Array|string} path The path of the property to get.
|
|
761
|
-
* @returns {*} Returns the resolved value.
|
|
687
|
+
* // Replace `_.memoize.Cache`.
|
|
688
|
+
* _.memoize.Cache = WeakMap;
|
|
762
689
|
*/
|
|
763
|
-
function
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
var index = 0,
|
|
767
|
-
length = path.length;
|
|
768
|
-
|
|
769
|
-
while (object != null && index < length) {
|
|
770
|
-
object = object[path[index++]];
|
|
690
|
+
function memoize(func, resolver) {
|
|
691
|
+
if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
|
|
692
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
771
693
|
}
|
|
772
|
-
|
|
694
|
+
var memoized = function() {
|
|
695
|
+
var args = arguments,
|
|
696
|
+
key = resolver ? resolver.apply(this, args) : args[0],
|
|
697
|
+
cache = memoized.cache;
|
|
698
|
+
|
|
699
|
+
if (cache.has(key)) {
|
|
700
|
+
return cache.get(key);
|
|
701
|
+
}
|
|
702
|
+
var result = func.apply(this, args);
|
|
703
|
+
memoized.cache = cache.set(key, result);
|
|
704
|
+
return result;
|
|
705
|
+
};
|
|
706
|
+
memoized.cache = new (memoize.Cache || MapCache);
|
|
707
|
+
return memoized;
|
|
773
708
|
}
|
|
774
709
|
|
|
710
|
+
// Assign cache to `_.memoize`.
|
|
711
|
+
memoize.Cache = MapCache;
|
|
712
|
+
|
|
775
713
|
/**
|
|
776
|
-
*
|
|
714
|
+
* Performs a
|
|
715
|
+
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
716
|
+
* comparison between two values to determine if they are equivalent.
|
|
777
717
|
*
|
|
778
|
-
* @
|
|
779
|
-
* @
|
|
780
|
-
* @
|
|
781
|
-
* @
|
|
718
|
+
* @static
|
|
719
|
+
* @memberOf _
|
|
720
|
+
* @since 4.0.0
|
|
721
|
+
* @category Lang
|
|
722
|
+
* @param {*} value The value to compare.
|
|
723
|
+
* @param {*} other The other value to compare.
|
|
724
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
725
|
+
* @example
|
|
726
|
+
*
|
|
727
|
+
* var object = { 'a': 1 };
|
|
728
|
+
* var other = { 'a': 1 };
|
|
729
|
+
*
|
|
730
|
+
* _.eq(object, object);
|
|
731
|
+
* // => true
|
|
732
|
+
*
|
|
733
|
+
* _.eq(object, other);
|
|
734
|
+
* // => false
|
|
735
|
+
*
|
|
736
|
+
* _.eq('a', 'a');
|
|
737
|
+
* // => true
|
|
738
|
+
*
|
|
739
|
+
* _.eq('a', Object('a'));
|
|
740
|
+
* // => false
|
|
741
|
+
*
|
|
742
|
+
* _.eq(NaN, NaN);
|
|
743
|
+
* // => true
|
|
782
744
|
*/
|
|
783
|
-
function
|
|
784
|
-
|
|
785
|
-
if (type == 'number' || type == 'symbol') {
|
|
786
|
-
return true;
|
|
787
|
-
}
|
|
788
|
-
return !isArray(value) &&
|
|
789
|
-
(isSymbol(value) || reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
|
790
|
-
(object != null && value in Object(object)));
|
|
745
|
+
function eq(value, other) {
|
|
746
|
+
return value === other || (value !== value && other !== other);
|
|
791
747
|
}
|
|
792
748
|
|
|
793
749
|
/**
|
|
@@ -796,11 +752,9 @@ function isKey(value, object) {
|
|
|
796
752
|
* @static
|
|
797
753
|
* @memberOf _
|
|
798
754
|
* @since 0.1.0
|
|
799
|
-
* @type {Function}
|
|
800
755
|
* @category Lang
|
|
801
756
|
* @param {*} value The value to check.
|
|
802
|
-
* @returns {boolean} Returns `true` if `value` is
|
|
803
|
-
* else `false`.
|
|
757
|
+
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
804
758
|
* @example
|
|
805
759
|
*
|
|
806
760
|
* _.isArray([1, 2, 3]);
|
|
@@ -817,6 +771,60 @@ function isKey(value, object) {
|
|
|
817
771
|
*/
|
|
818
772
|
var isArray = Array.isArray;
|
|
819
773
|
|
|
774
|
+
/**
|
|
775
|
+
* Checks if `value` is classified as a `Function` object.
|
|
776
|
+
*
|
|
777
|
+
* @static
|
|
778
|
+
* @memberOf _
|
|
779
|
+
* @since 0.1.0
|
|
780
|
+
* @category Lang
|
|
781
|
+
* @param {*} value The value to check.
|
|
782
|
+
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
783
|
+
* @example
|
|
784
|
+
*
|
|
785
|
+
* _.isFunction(_);
|
|
786
|
+
* // => true
|
|
787
|
+
*
|
|
788
|
+
* _.isFunction(/abc/);
|
|
789
|
+
* // => false
|
|
790
|
+
*/
|
|
791
|
+
function isFunction(value) {
|
|
792
|
+
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
793
|
+
// in Safari 8-9 which returns 'object' for typed array and other constructors.
|
|
794
|
+
var tag = isObject(value) ? objectToString.call(value) : '';
|
|
795
|
+
return tag == funcTag || tag == genTag;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* Checks if `value` is the
|
|
800
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
801
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
802
|
+
*
|
|
803
|
+
* @static
|
|
804
|
+
* @memberOf _
|
|
805
|
+
* @since 0.1.0
|
|
806
|
+
* @category Lang
|
|
807
|
+
* @param {*} value The value to check.
|
|
808
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
809
|
+
* @example
|
|
810
|
+
*
|
|
811
|
+
* _.isObject({});
|
|
812
|
+
* // => true
|
|
813
|
+
*
|
|
814
|
+
* _.isObject([1, 2, 3]);
|
|
815
|
+
* // => true
|
|
816
|
+
*
|
|
817
|
+
* _.isObject(_.noop);
|
|
818
|
+
* // => true
|
|
819
|
+
*
|
|
820
|
+
* _.isObject(null);
|
|
821
|
+
* // => false
|
|
822
|
+
*/
|
|
823
|
+
function isObject(value) {
|
|
824
|
+
var type = typeof value;
|
|
825
|
+
return !!value && (type == 'object' || type == 'function');
|
|
826
|
+
}
|
|
827
|
+
|
|
820
828
|
/**
|
|
821
829
|
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
822
830
|
* and has a `typeof` result of "object".
|
|
@@ -853,8 +861,7 @@ function isObjectLike(value) {
|
|
|
853
861
|
* @since 4.0.0
|
|
854
862
|
* @category Lang
|
|
855
863
|
* @param {*} value The value to check.
|
|
856
|
-
* @returns {boolean} Returns `true` if `value` is
|
|
857
|
-
* else `false`.
|
|
864
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
858
865
|
* @example
|
|
859
866
|
*
|
|
860
867
|
* _.isSymbol(Symbol.iterator);
|
|
@@ -868,9 +875,34 @@ function isSymbol(value) {
|
|
|
868
875
|
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
|
869
876
|
}
|
|
870
877
|
|
|
878
|
+
/**
|
|
879
|
+
* Converts `value` to a string. An empty string is returned for `null`
|
|
880
|
+
* and `undefined` values. The sign of `-0` is preserved.
|
|
881
|
+
*
|
|
882
|
+
* @static
|
|
883
|
+
* @memberOf _
|
|
884
|
+
* @since 4.0.0
|
|
885
|
+
* @category Lang
|
|
886
|
+
* @param {*} value The value to process.
|
|
887
|
+
* @returns {string} Returns the string.
|
|
888
|
+
* @example
|
|
889
|
+
*
|
|
890
|
+
* _.toString(null);
|
|
891
|
+
* // => ''
|
|
892
|
+
*
|
|
893
|
+
* _.toString(-0);
|
|
894
|
+
* // => '-0'
|
|
895
|
+
*
|
|
896
|
+
* _.toString([1, 2, 3]);
|
|
897
|
+
* // => '1,2,3'
|
|
898
|
+
*/
|
|
899
|
+
function toString(value) {
|
|
900
|
+
return value == null ? '' : baseToString(value);
|
|
901
|
+
}
|
|
902
|
+
|
|
871
903
|
/**
|
|
872
904
|
* Gets the value at `path` of `object`. If the resolved value is
|
|
873
|
-
* `undefined
|
|
905
|
+
* `undefined`, the `defaultValue` is returned in its place.
|
|
874
906
|
*
|
|
875
907
|
* @static
|
|
876
908
|
* @memberOf _
|
|
@@ -900,12 +932,13 @@ function get(object, path, defaultValue) {
|
|
|
900
932
|
|
|
901
933
|
module.exports = get;
|
|
902
934
|
|
|
903
|
-
},
|
|
935
|
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
936
|
+
},{}],2:[function(require,module,exports){
|
|
904
937
|
(function (global){
|
|
905
938
|
/**
|
|
906
|
-
*
|
|
939
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
907
940
|
* Build: `lodash modularize exports="npm" -o ./`
|
|
908
|
-
* Copyright
|
|
941
|
+
* Copyright JS Foundation and other contributors <https://js.foundation/>
|
|
909
942
|
* Released under MIT license <https://lodash.com/license>
|
|
910
943
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
911
944
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
@@ -917,9 +950,9 @@ var LARGE_ARRAY_SIZE = 200;
|
|
|
917
950
|
/** Used to stand-in for `undefined` hash values. */
|
|
918
951
|
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
919
952
|
|
|
920
|
-
/** Used to compose bitmasks for
|
|
921
|
-
var
|
|
922
|
-
|
|
953
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
954
|
+
var COMPARE_PARTIAL_FLAG = 1,
|
|
955
|
+
COMPARE_UNORDERED_FLAG = 2;
|
|
923
956
|
|
|
924
957
|
/** Used as references for various `Number` constants. */
|
|
925
958
|
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
@@ -927,6 +960,7 @@ var MAX_SAFE_INTEGER = 9007199254740991;
|
|
|
927
960
|
/** `Object#toString` result references. */
|
|
928
961
|
var argsTag = '[object Arguments]',
|
|
929
962
|
arrayTag = '[object Array]',
|
|
963
|
+
asyncTag = '[object AsyncFunction]',
|
|
930
964
|
boolTag = '[object Boolean]',
|
|
931
965
|
dateTag = '[object Date]',
|
|
932
966
|
errorTag = '[object Error]',
|
|
@@ -934,12 +968,15 @@ var argsTag = '[object Arguments]',
|
|
|
934
968
|
genTag = '[object GeneratorFunction]',
|
|
935
969
|
mapTag = '[object Map]',
|
|
936
970
|
numberTag = '[object Number]',
|
|
971
|
+
nullTag = '[object Null]',
|
|
937
972
|
objectTag = '[object Object]',
|
|
938
973
|
promiseTag = '[object Promise]',
|
|
974
|
+
proxyTag = '[object Proxy]',
|
|
939
975
|
regexpTag = '[object RegExp]',
|
|
940
976
|
setTag = '[object Set]',
|
|
941
977
|
stringTag = '[object String]',
|
|
942
978
|
symbolTag = '[object Symbol]',
|
|
979
|
+
undefinedTag = '[object Undefined]',
|
|
943
980
|
weakMapTag = '[object WeakMap]';
|
|
944
981
|
|
|
945
982
|
var arrayBufferTag = '[object ArrayBuffer]',
|
|
@@ -1006,13 +1043,56 @@ var freeProcess = moduleExports && freeGlobal.process;
|
|
|
1006
1043
|
/** Used to access faster Node.js helpers. */
|
|
1007
1044
|
var nodeUtil = (function() {
|
|
1008
1045
|
try {
|
|
1009
|
-
return freeProcess && freeProcess.binding('util');
|
|
1046
|
+
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
|
1010
1047
|
} catch (e) {}
|
|
1011
1048
|
}());
|
|
1012
1049
|
|
|
1013
1050
|
/* Node.js helper references. */
|
|
1014
1051
|
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
1015
1052
|
|
|
1053
|
+
/**
|
|
1054
|
+
* A specialized version of `_.filter` for arrays without support for
|
|
1055
|
+
* iteratee shorthands.
|
|
1056
|
+
*
|
|
1057
|
+
* @private
|
|
1058
|
+
* @param {Array} [array] The array to iterate over.
|
|
1059
|
+
* @param {Function} predicate The function invoked per iteration.
|
|
1060
|
+
* @returns {Array} Returns the new filtered array.
|
|
1061
|
+
*/
|
|
1062
|
+
function arrayFilter(array, predicate) {
|
|
1063
|
+
var index = -1,
|
|
1064
|
+
length = array == null ? 0 : array.length,
|
|
1065
|
+
resIndex = 0,
|
|
1066
|
+
result = [];
|
|
1067
|
+
|
|
1068
|
+
while (++index < length) {
|
|
1069
|
+
var value = array[index];
|
|
1070
|
+
if (predicate(value, index, array)) {
|
|
1071
|
+
result[resIndex++] = value;
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
return result;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
/**
|
|
1078
|
+
* Appends the elements of `values` to `array`.
|
|
1079
|
+
*
|
|
1080
|
+
* @private
|
|
1081
|
+
* @param {Array} array The array to modify.
|
|
1082
|
+
* @param {Array} values The values to append.
|
|
1083
|
+
* @returns {Array} Returns `array`.
|
|
1084
|
+
*/
|
|
1085
|
+
function arrayPush(array, values) {
|
|
1086
|
+
var index = -1,
|
|
1087
|
+
length = values.length,
|
|
1088
|
+
offset = array.length;
|
|
1089
|
+
|
|
1090
|
+
while (++index < length) {
|
|
1091
|
+
array[offset + index] = values[index];
|
|
1092
|
+
}
|
|
1093
|
+
return array;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1016
1096
|
/**
|
|
1017
1097
|
* A specialized version of `_.some` for arrays without support for iteratee
|
|
1018
1098
|
* shorthands.
|
|
@@ -1025,7 +1105,7 @@ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
|
1025
1105
|
*/
|
|
1026
1106
|
function arraySome(array, predicate) {
|
|
1027
1107
|
var index = -1,
|
|
1028
|
-
length = array ? array.length
|
|
1108
|
+
length = array == null ? 0 : array.length;
|
|
1029
1109
|
|
|
1030
1110
|
while (++index < length) {
|
|
1031
1111
|
if (predicate(array[index], index, array)) {
|
|
@@ -1068,34 +1148,27 @@ function baseUnary(func) {
|
|
|
1068
1148
|
}
|
|
1069
1149
|
|
|
1070
1150
|
/**
|
|
1071
|
-
*
|
|
1151
|
+
* Checks if a `cache` value for `key` exists.
|
|
1072
1152
|
*
|
|
1073
1153
|
* @private
|
|
1074
|
-
* @param {Object}
|
|
1075
|
-
* @param {string} key The key of the
|
|
1076
|
-
* @returns {
|
|
1154
|
+
* @param {Object} cache The cache to query.
|
|
1155
|
+
* @param {string} key The key of the entry to check.
|
|
1156
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1077
1157
|
*/
|
|
1078
|
-
function
|
|
1079
|
-
return
|
|
1158
|
+
function cacheHas(cache, key) {
|
|
1159
|
+
return cache.has(key);
|
|
1080
1160
|
}
|
|
1081
1161
|
|
|
1082
1162
|
/**
|
|
1083
|
-
*
|
|
1163
|
+
* Gets the value at `key` of `object`.
|
|
1084
1164
|
*
|
|
1085
1165
|
* @private
|
|
1086
|
-
* @param {
|
|
1087
|
-
* @
|
|
1166
|
+
* @param {Object} [object] The object to query.
|
|
1167
|
+
* @param {string} key The key of the property to get.
|
|
1168
|
+
* @returns {*} Returns the property value.
|
|
1088
1169
|
*/
|
|
1089
|
-
function
|
|
1090
|
-
|
|
1091
|
-
// despite having improperly defined `toString` methods.
|
|
1092
|
-
var result = false;
|
|
1093
|
-
if (value != null && typeof value.toString != 'function') {
|
|
1094
|
-
try {
|
|
1095
|
-
result = !!(value + '');
|
|
1096
|
-
} catch (e) {}
|
|
1097
|
-
}
|
|
1098
|
-
return result;
|
|
1170
|
+
function getValue(object, key) {
|
|
1171
|
+
return object == null ? undefined : object[key];
|
|
1099
1172
|
}
|
|
1100
1173
|
|
|
1101
1174
|
/**
|
|
@@ -1154,24 +1227,24 @@ var arrayProto = Array.prototype,
|
|
|
1154
1227
|
/** Used to detect overreaching core-js shims. */
|
|
1155
1228
|
var coreJsData = root['__core-js_shared__'];
|
|
1156
1229
|
|
|
1157
|
-
/** Used to detect methods masquerading as native. */
|
|
1158
|
-
var maskSrcKey = (function() {
|
|
1159
|
-
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
|
1160
|
-
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
1161
|
-
}());
|
|
1162
|
-
|
|
1163
1230
|
/** Used to resolve the decompiled source of functions. */
|
|
1164
1231
|
var funcToString = funcProto.toString;
|
|
1165
1232
|
|
|
1166
1233
|
/** Used to check objects for own properties. */
|
|
1167
1234
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
1168
1235
|
|
|
1236
|
+
/** Used to detect methods masquerading as native. */
|
|
1237
|
+
var maskSrcKey = (function() {
|
|
1238
|
+
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
|
1239
|
+
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
1240
|
+
}());
|
|
1241
|
+
|
|
1169
1242
|
/**
|
|
1170
1243
|
* Used to resolve the
|
|
1171
1244
|
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
1172
1245
|
* of values.
|
|
1173
1246
|
*/
|
|
1174
|
-
var
|
|
1247
|
+
var nativeObjectToString = objectProto.toString;
|
|
1175
1248
|
|
|
1176
1249
|
/** Used to detect if a method is native. */
|
|
1177
1250
|
var reIsNative = RegExp('^' +
|
|
@@ -1180,13 +1253,17 @@ var reIsNative = RegExp('^' +
|
|
|
1180
1253
|
);
|
|
1181
1254
|
|
|
1182
1255
|
/** Built-in value references. */
|
|
1183
|
-
var
|
|
1256
|
+
var Buffer = moduleExports ? root.Buffer : undefined,
|
|
1257
|
+
Symbol = root.Symbol,
|
|
1184
1258
|
Uint8Array = root.Uint8Array,
|
|
1185
1259
|
propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
|
1186
|
-
splice = arrayProto.splice
|
|
1260
|
+
splice = arrayProto.splice,
|
|
1261
|
+
symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
|
1187
1262
|
|
|
1188
1263
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1189
|
-
var
|
|
1264
|
+
var nativeGetSymbols = Object.getOwnPropertySymbols,
|
|
1265
|
+
nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
|
|
1266
|
+
nativeKeys = overArg(Object.keys, Object);
|
|
1190
1267
|
|
|
1191
1268
|
/* Built-in method references that are verified to be native. */
|
|
1192
1269
|
var DataView = getNative(root, 'DataView'),
|
|
@@ -1216,7 +1293,7 @@ var symbolProto = Symbol ? Symbol.prototype : undefined,
|
|
|
1216
1293
|
*/
|
|
1217
1294
|
function Hash(entries) {
|
|
1218
1295
|
var index = -1,
|
|
1219
|
-
length = entries ? entries.length
|
|
1296
|
+
length = entries == null ? 0 : entries.length;
|
|
1220
1297
|
|
|
1221
1298
|
this.clear();
|
|
1222
1299
|
while (++index < length) {
|
|
@@ -1234,6 +1311,7 @@ function Hash(entries) {
|
|
|
1234
1311
|
*/
|
|
1235
1312
|
function hashClear() {
|
|
1236
1313
|
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
1314
|
+
this.size = 0;
|
|
1237
1315
|
}
|
|
1238
1316
|
|
|
1239
1317
|
/**
|
|
@@ -1247,7 +1325,9 @@ function hashClear() {
|
|
|
1247
1325
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1248
1326
|
*/
|
|
1249
1327
|
function hashDelete(key) {
|
|
1250
|
-
|
|
1328
|
+
var result = this.has(key) && delete this.__data__[key];
|
|
1329
|
+
this.size -= result ? 1 : 0;
|
|
1330
|
+
return result;
|
|
1251
1331
|
}
|
|
1252
1332
|
|
|
1253
1333
|
/**
|
|
@@ -1279,7 +1359,7 @@ function hashGet(key) {
|
|
|
1279
1359
|
*/
|
|
1280
1360
|
function hashHas(key) {
|
|
1281
1361
|
var data = this.__data__;
|
|
1282
|
-
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
|
|
1362
|
+
return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
|
|
1283
1363
|
}
|
|
1284
1364
|
|
|
1285
1365
|
/**
|
|
@@ -1294,6 +1374,7 @@ function hashHas(key) {
|
|
|
1294
1374
|
*/
|
|
1295
1375
|
function hashSet(key, value) {
|
|
1296
1376
|
var data = this.__data__;
|
|
1377
|
+
this.size += this.has(key) ? 0 : 1;
|
|
1297
1378
|
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
|
1298
1379
|
return this;
|
|
1299
1380
|
}
|
|
@@ -1314,7 +1395,7 @@ Hash.prototype.set = hashSet;
|
|
|
1314
1395
|
*/
|
|
1315
1396
|
function ListCache(entries) {
|
|
1316
1397
|
var index = -1,
|
|
1317
|
-
length = entries ? entries.length
|
|
1398
|
+
length = entries == null ? 0 : entries.length;
|
|
1318
1399
|
|
|
1319
1400
|
this.clear();
|
|
1320
1401
|
while (++index < length) {
|
|
@@ -1332,6 +1413,7 @@ function ListCache(entries) {
|
|
|
1332
1413
|
*/
|
|
1333
1414
|
function listCacheClear() {
|
|
1334
1415
|
this.__data__ = [];
|
|
1416
|
+
this.size = 0;
|
|
1335
1417
|
}
|
|
1336
1418
|
|
|
1337
1419
|
/**
|
|
@@ -1356,6 +1438,7 @@ function listCacheDelete(key) {
|
|
|
1356
1438
|
} else {
|
|
1357
1439
|
splice.call(data, index, 1);
|
|
1358
1440
|
}
|
|
1441
|
+
--this.size;
|
|
1359
1442
|
return true;
|
|
1360
1443
|
}
|
|
1361
1444
|
|
|
@@ -1403,6 +1486,7 @@ function listCacheSet(key, value) {
|
|
|
1403
1486
|
index = assocIndexOf(data, key);
|
|
1404
1487
|
|
|
1405
1488
|
if (index < 0) {
|
|
1489
|
+
++this.size;
|
|
1406
1490
|
data.push([key, value]);
|
|
1407
1491
|
} else {
|
|
1408
1492
|
data[index][1] = value;
|
|
@@ -1426,7 +1510,7 @@ ListCache.prototype.set = listCacheSet;
|
|
|
1426
1510
|
*/
|
|
1427
1511
|
function MapCache(entries) {
|
|
1428
1512
|
var index = -1,
|
|
1429
|
-
length = entries ? entries.length
|
|
1513
|
+
length = entries == null ? 0 : entries.length;
|
|
1430
1514
|
|
|
1431
1515
|
this.clear();
|
|
1432
1516
|
while (++index < length) {
|
|
@@ -1443,6 +1527,7 @@ function MapCache(entries) {
|
|
|
1443
1527
|
* @memberOf MapCache
|
|
1444
1528
|
*/
|
|
1445
1529
|
function mapCacheClear() {
|
|
1530
|
+
this.size = 0;
|
|
1446
1531
|
this.__data__ = {
|
|
1447
1532
|
'hash': new Hash,
|
|
1448
1533
|
'map': new (Map || ListCache),
|
|
@@ -1460,7 +1545,9 @@ function mapCacheClear() {
|
|
|
1460
1545
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1461
1546
|
*/
|
|
1462
1547
|
function mapCacheDelete(key) {
|
|
1463
|
-
|
|
1548
|
+
var result = getMapData(this, key)['delete'](key);
|
|
1549
|
+
this.size -= result ? 1 : 0;
|
|
1550
|
+
return result;
|
|
1464
1551
|
}
|
|
1465
1552
|
|
|
1466
1553
|
/**
|
|
@@ -1500,7 +1587,11 @@ function mapCacheHas(key) {
|
|
|
1500
1587
|
* @returns {Object} Returns the map cache instance.
|
|
1501
1588
|
*/
|
|
1502
1589
|
function mapCacheSet(key, value) {
|
|
1503
|
-
getMapData(this, key)
|
|
1590
|
+
var data = getMapData(this, key),
|
|
1591
|
+
size = data.size;
|
|
1592
|
+
|
|
1593
|
+
data.set(key, value);
|
|
1594
|
+
this.size += data.size == size ? 0 : 1;
|
|
1504
1595
|
return this;
|
|
1505
1596
|
}
|
|
1506
1597
|
|
|
@@ -1521,7 +1612,7 @@ MapCache.prototype.set = mapCacheSet;
|
|
|
1521
1612
|
*/
|
|
1522
1613
|
function SetCache(values) {
|
|
1523
1614
|
var index = -1,
|
|
1524
|
-
length = values ? values.length
|
|
1615
|
+
length = values == null ? 0 : values.length;
|
|
1525
1616
|
|
|
1526
1617
|
this.__data__ = new MapCache;
|
|
1527
1618
|
while (++index < length) {
|
|
@@ -1569,7 +1660,8 @@ SetCache.prototype.has = setCacheHas;
|
|
|
1569
1660
|
* @param {Array} [entries] The key-value pairs to cache.
|
|
1570
1661
|
*/
|
|
1571
1662
|
function Stack(entries) {
|
|
1572
|
-
this.__data__ = new ListCache(entries);
|
|
1663
|
+
var data = this.__data__ = new ListCache(entries);
|
|
1664
|
+
this.size = data.size;
|
|
1573
1665
|
}
|
|
1574
1666
|
|
|
1575
1667
|
/**
|
|
@@ -1581,6 +1673,7 @@ function Stack(entries) {
|
|
|
1581
1673
|
*/
|
|
1582
1674
|
function stackClear() {
|
|
1583
1675
|
this.__data__ = new ListCache;
|
|
1676
|
+
this.size = 0;
|
|
1584
1677
|
}
|
|
1585
1678
|
|
|
1586
1679
|
/**
|
|
@@ -1593,7 +1686,11 @@ function stackClear() {
|
|
|
1593
1686
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1594
1687
|
*/
|
|
1595
1688
|
function stackDelete(key) {
|
|
1596
|
-
|
|
1689
|
+
var data = this.__data__,
|
|
1690
|
+
result = data['delete'](key);
|
|
1691
|
+
|
|
1692
|
+
this.size = data.size;
|
|
1693
|
+
return result;
|
|
1597
1694
|
}
|
|
1598
1695
|
|
|
1599
1696
|
/**
|
|
@@ -1633,16 +1730,18 @@ function stackHas(key) {
|
|
|
1633
1730
|
* @returns {Object} Returns the stack cache instance.
|
|
1634
1731
|
*/
|
|
1635
1732
|
function stackSet(key, value) {
|
|
1636
|
-
var
|
|
1637
|
-
if (
|
|
1638
|
-
var pairs =
|
|
1733
|
+
var data = this.__data__;
|
|
1734
|
+
if (data instanceof ListCache) {
|
|
1735
|
+
var pairs = data.__data__;
|
|
1639
1736
|
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
|
1640
1737
|
pairs.push([key, value]);
|
|
1738
|
+
this.size = ++data.size;
|
|
1641
1739
|
return this;
|
|
1642
1740
|
}
|
|
1643
|
-
|
|
1741
|
+
data = this.__data__ = new MapCache(pairs);
|
|
1644
1742
|
}
|
|
1645
|
-
|
|
1743
|
+
data.set(key, value);
|
|
1744
|
+
this.size = data.size;
|
|
1646
1745
|
return this;
|
|
1647
1746
|
}
|
|
1648
1747
|
|
|
@@ -1662,18 +1761,26 @@ Stack.prototype.set = stackSet;
|
|
|
1662
1761
|
* @returns {Array} Returns the array of property names.
|
|
1663
1762
|
*/
|
|
1664
1763
|
function arrayLikeKeys(value, inherited) {
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
skipIndexes = !!length;
|
|
1764
|
+
var isArr = isArray(value),
|
|
1765
|
+
isArg = !isArr && isArguments(value),
|
|
1766
|
+
isBuff = !isArr && !isArg && isBuffer(value),
|
|
1767
|
+
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
|
1768
|
+
skipIndexes = isArr || isArg || isBuff || isType,
|
|
1769
|
+
result = skipIndexes ? baseTimes(value.length, String) : [],
|
|
1770
|
+
length = result.length;
|
|
1673
1771
|
|
|
1674
1772
|
for (var key in value) {
|
|
1675
1773
|
if ((inherited || hasOwnProperty.call(value, key)) &&
|
|
1676
|
-
!(skipIndexes && (
|
|
1774
|
+
!(skipIndexes && (
|
|
1775
|
+
// Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1776
|
+
key == 'length' ||
|
|
1777
|
+
// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1778
|
+
(isBuff && (key == 'offset' || key == 'parent')) ||
|
|
1779
|
+
// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1780
|
+
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
|
1781
|
+
// Skip index properties.
|
|
1782
|
+
isIndex(key, length)
|
|
1783
|
+
))) {
|
|
1677
1784
|
result.push(key);
|
|
1678
1785
|
}
|
|
1679
1786
|
}
|
|
@@ -1699,14 +1806,46 @@ function assocIndexOf(array, key) {
|
|
|
1699
1806
|
}
|
|
1700
1807
|
|
|
1701
1808
|
/**
|
|
1702
|
-
* The base implementation of `
|
|
1809
|
+
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
|
|
1810
|
+
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
|
|
1811
|
+
* symbols of `object`.
|
|
1812
|
+
*
|
|
1813
|
+
* @private
|
|
1814
|
+
* @param {Object} object The object to query.
|
|
1815
|
+
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
1816
|
+
* @param {Function} symbolsFunc The function to get the symbols of `object`.
|
|
1817
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
1818
|
+
*/
|
|
1819
|
+
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
1820
|
+
var result = keysFunc(object);
|
|
1821
|
+
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
/**
|
|
1825
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
1703
1826
|
*
|
|
1704
1827
|
* @private
|
|
1705
1828
|
* @param {*} value The value to query.
|
|
1706
1829
|
* @returns {string} Returns the `toStringTag`.
|
|
1707
1830
|
*/
|
|
1708
1831
|
function baseGetTag(value) {
|
|
1709
|
-
|
|
1832
|
+
if (value == null) {
|
|
1833
|
+
return value === undefined ? undefinedTag : nullTag;
|
|
1834
|
+
}
|
|
1835
|
+
return (symToStringTag && symToStringTag in Object(value))
|
|
1836
|
+
? getRawTag(value)
|
|
1837
|
+
: objectToString(value);
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
/**
|
|
1841
|
+
* The base implementation of `_.isArguments`.
|
|
1842
|
+
*
|
|
1843
|
+
* @private
|
|
1844
|
+
* @param {*} value The value to check.
|
|
1845
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
1846
|
+
*/
|
|
1847
|
+
function baseIsArguments(value) {
|
|
1848
|
+
return isObjectLike(value) && baseGetTag(value) == argsTag;
|
|
1710
1849
|
}
|
|
1711
1850
|
|
|
1712
1851
|
/**
|
|
@@ -1716,22 +1855,21 @@ function baseGetTag(value) {
|
|
|
1716
1855
|
* @private
|
|
1717
1856
|
* @param {*} value The value to compare.
|
|
1718
1857
|
* @param {*} other The other value to compare.
|
|
1858
|
+
* @param {boolean} bitmask The bitmask flags.
|
|
1859
|
+
* 1 - Unordered comparison
|
|
1860
|
+
* 2 - Partial comparison
|
|
1719
1861
|
* @param {Function} [customizer] The function to customize comparisons.
|
|
1720
|
-
* @param {boolean} [bitmask] The bitmask of comparison flags.
|
|
1721
|
-
* The bitmask may be composed of the following flags:
|
|
1722
|
-
* 1 - Unordered comparison
|
|
1723
|
-
* 2 - Partial comparison
|
|
1724
1862
|
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
|
|
1725
1863
|
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
1726
1864
|
*/
|
|
1727
|
-
function baseIsEqual(value, other,
|
|
1865
|
+
function baseIsEqual(value, other, bitmask, customizer, stack) {
|
|
1728
1866
|
if (value === other) {
|
|
1729
1867
|
return true;
|
|
1730
1868
|
}
|
|
1731
|
-
if (value == null || other == null || (!
|
|
1869
|
+
if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
|
|
1732
1870
|
return value !== value && other !== other;
|
|
1733
1871
|
}
|
|
1734
|
-
return baseIsEqualDeep(value, other,
|
|
1872
|
+
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
|
1735
1873
|
}
|
|
1736
1874
|
|
|
1737
1875
|
/**
|
|
@@ -1742,38 +1880,39 @@ function baseIsEqual(value, other, customizer, bitmask, stack) {
|
|
|
1742
1880
|
* @private
|
|
1743
1881
|
* @param {Object} object The object to compare.
|
|
1744
1882
|
* @param {Object} other The other object to compare.
|
|
1883
|
+
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
1884
|
+
* @param {Function} customizer The function to customize comparisons.
|
|
1745
1885
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
1746
|
-
* @param {Function} [customizer] The function to customize comparisons.
|
|
1747
|
-
* @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
|
|
1748
|
-
* for more details.
|
|
1749
1886
|
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
|
|
1750
1887
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
1751
1888
|
*/
|
|
1752
|
-
function baseIsEqualDeep(object, other,
|
|
1889
|
+
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
1753
1890
|
var objIsArr = isArray(object),
|
|
1754
1891
|
othIsArr = isArray(other),
|
|
1755
|
-
objTag = arrayTag,
|
|
1756
|
-
othTag = arrayTag;
|
|
1892
|
+
objTag = objIsArr ? arrayTag : getTag(object),
|
|
1893
|
+
othTag = othIsArr ? arrayTag : getTag(other);
|
|
1757
1894
|
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
othTag = getTag(other);
|
|
1764
|
-
othTag = othTag == argsTag ? objectTag : othTag;
|
|
1765
|
-
}
|
|
1766
|
-
var objIsObj = objTag == objectTag && !isHostObject(object),
|
|
1767
|
-
othIsObj = othTag == objectTag && !isHostObject(other),
|
|
1895
|
+
objTag = objTag == argsTag ? objectTag : objTag;
|
|
1896
|
+
othTag = othTag == argsTag ? objectTag : othTag;
|
|
1897
|
+
|
|
1898
|
+
var objIsObj = objTag == objectTag,
|
|
1899
|
+
othIsObj = othTag == objectTag,
|
|
1768
1900
|
isSameTag = objTag == othTag;
|
|
1769
1901
|
|
|
1902
|
+
if (isSameTag && isBuffer(object)) {
|
|
1903
|
+
if (!isBuffer(other)) {
|
|
1904
|
+
return false;
|
|
1905
|
+
}
|
|
1906
|
+
objIsArr = true;
|
|
1907
|
+
objIsObj = false;
|
|
1908
|
+
}
|
|
1770
1909
|
if (isSameTag && !objIsObj) {
|
|
1771
1910
|
stack || (stack = new Stack);
|
|
1772
1911
|
return (objIsArr || isTypedArray(object))
|
|
1773
|
-
? equalArrays(object, other,
|
|
1774
|
-
: equalByTag(object, other, objTag,
|
|
1912
|
+
? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
|
|
1913
|
+
: equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
1775
1914
|
}
|
|
1776
|
-
if (!(bitmask &
|
|
1915
|
+
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
1777
1916
|
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
|
1778
1917
|
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
|
1779
1918
|
|
|
@@ -1782,14 +1921,14 @@ function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
|
|
|
1782
1921
|
othUnwrapped = othIsWrapped ? other.value() : other;
|
|
1783
1922
|
|
|
1784
1923
|
stack || (stack = new Stack);
|
|
1785
|
-
return equalFunc(objUnwrapped, othUnwrapped,
|
|
1924
|
+
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
|
1786
1925
|
}
|
|
1787
1926
|
}
|
|
1788
1927
|
if (!isSameTag) {
|
|
1789
1928
|
return false;
|
|
1790
1929
|
}
|
|
1791
1930
|
stack || (stack = new Stack);
|
|
1792
|
-
return equalObjects(object, other,
|
|
1931
|
+
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
|
1793
1932
|
}
|
|
1794
1933
|
|
|
1795
1934
|
/**
|
|
@@ -1804,7 +1943,7 @@ function baseIsNative(value) {
|
|
|
1804
1943
|
if (!isObject(value) || isMasked(value)) {
|
|
1805
1944
|
return false;
|
|
1806
1945
|
}
|
|
1807
|
-
var pattern =
|
|
1946
|
+
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
|
1808
1947
|
return pattern.test(toSource(value));
|
|
1809
1948
|
}
|
|
1810
1949
|
|
|
@@ -1817,7 +1956,7 @@ function baseIsNative(value) {
|
|
|
1817
1956
|
*/
|
|
1818
1957
|
function baseIsTypedArray(value) {
|
|
1819
1958
|
return isObjectLike(value) &&
|
|
1820
|
-
isLength(value.length) && !!typedArrayTags[
|
|
1959
|
+
isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
|
1821
1960
|
}
|
|
1822
1961
|
|
|
1823
1962
|
/**
|
|
@@ -1847,15 +1986,14 @@ function baseKeys(object) {
|
|
|
1847
1986
|
* @private
|
|
1848
1987
|
* @param {Array} array The array to compare.
|
|
1849
1988
|
* @param {Array} other The other array to compare.
|
|
1850
|
-
* @param {
|
|
1989
|
+
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
1851
1990
|
* @param {Function} customizer The function to customize comparisons.
|
|
1852
|
-
* @param {
|
|
1853
|
-
* for more details.
|
|
1991
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
1854
1992
|
* @param {Object} stack Tracks traversed `array` and `other` objects.
|
|
1855
1993
|
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
|
1856
1994
|
*/
|
|
1857
|
-
function equalArrays(array, other,
|
|
1858
|
-
var isPartial = bitmask &
|
|
1995
|
+
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
1996
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
|
1859
1997
|
arrLength = array.length,
|
|
1860
1998
|
othLength = other.length;
|
|
1861
1999
|
|
|
@@ -1869,7 +2007,7 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
|
|
|
1869
2007
|
}
|
|
1870
2008
|
var index = -1,
|
|
1871
2009
|
result = true,
|
|
1872
|
-
seen = (bitmask &
|
|
2010
|
+
seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
|
|
1873
2011
|
|
|
1874
2012
|
stack.set(array, other);
|
|
1875
2013
|
stack.set(other, array);
|
|
@@ -1894,9 +2032,9 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
|
|
|
1894
2032
|
// Recursively compare arrays (susceptible to call stack limits).
|
|
1895
2033
|
if (seen) {
|
|
1896
2034
|
if (!arraySome(other, function(othValue, othIndex) {
|
|
1897
|
-
if (!seen
|
|
1898
|
-
(arrValue === othValue || equalFunc(arrValue, othValue,
|
|
1899
|
-
return seen.
|
|
2035
|
+
if (!cacheHas(seen, othIndex) &&
|
|
2036
|
+
(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
|
2037
|
+
return seen.push(othIndex);
|
|
1900
2038
|
}
|
|
1901
2039
|
})) {
|
|
1902
2040
|
result = false;
|
|
@@ -1904,7 +2042,7 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
|
|
|
1904
2042
|
}
|
|
1905
2043
|
} else if (!(
|
|
1906
2044
|
arrValue === othValue ||
|
|
1907
|
-
equalFunc(arrValue, othValue,
|
|
2045
|
+
equalFunc(arrValue, othValue, bitmask, customizer, stack)
|
|
1908
2046
|
)) {
|
|
1909
2047
|
result = false;
|
|
1910
2048
|
break;
|
|
@@ -1926,14 +2064,13 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
|
|
|
1926
2064
|
* @param {Object} object The object to compare.
|
|
1927
2065
|
* @param {Object} other The other object to compare.
|
|
1928
2066
|
* @param {string} tag The `toStringTag` of the objects to compare.
|
|
1929
|
-
* @param {
|
|
2067
|
+
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
1930
2068
|
* @param {Function} customizer The function to customize comparisons.
|
|
1931
|
-
* @param {
|
|
1932
|
-
* for more details.
|
|
2069
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
1933
2070
|
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
|
1934
2071
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
1935
2072
|
*/
|
|
1936
|
-
function equalByTag(object, other, tag,
|
|
2073
|
+
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
1937
2074
|
switch (tag) {
|
|
1938
2075
|
case dataViewTag:
|
|
1939
2076
|
if ((object.byteLength != other.byteLength) ||
|
|
@@ -1971,7 +2108,7 @@ function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
|
|
|
1971
2108
|
var convert = mapToArray;
|
|
1972
2109
|
|
|
1973
2110
|
case setTag:
|
|
1974
|
-
var isPartial = bitmask &
|
|
2111
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
|
|
1975
2112
|
convert || (convert = setToArray);
|
|
1976
2113
|
|
|
1977
2114
|
if (object.size != other.size && !isPartial) {
|
|
@@ -1982,11 +2119,11 @@ function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
|
|
|
1982
2119
|
if (stacked) {
|
|
1983
2120
|
return stacked == other;
|
|
1984
2121
|
}
|
|
1985
|
-
bitmask |=
|
|
2122
|
+
bitmask |= COMPARE_UNORDERED_FLAG;
|
|
1986
2123
|
|
|
1987
2124
|
// Recursively compare objects (susceptible to call stack limits).
|
|
1988
2125
|
stack.set(object, other);
|
|
1989
|
-
var result = equalArrays(convert(object), convert(other),
|
|
2126
|
+
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
|
1990
2127
|
stack['delete'](object);
|
|
1991
2128
|
return result;
|
|
1992
2129
|
|
|
@@ -2005,18 +2142,17 @@ function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
|
|
|
2005
2142
|
* @private
|
|
2006
2143
|
* @param {Object} object The object to compare.
|
|
2007
2144
|
* @param {Object} other The other object to compare.
|
|
2008
|
-
* @param {
|
|
2145
|
+
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
2009
2146
|
* @param {Function} customizer The function to customize comparisons.
|
|
2010
|
-
* @param {
|
|
2011
|
-
* for more details.
|
|
2147
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
2012
2148
|
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
|
2013
2149
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
2014
2150
|
*/
|
|
2015
|
-
function equalObjects(object, other,
|
|
2016
|
-
var isPartial = bitmask &
|
|
2017
|
-
objProps =
|
|
2151
|
+
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
2152
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
|
2153
|
+
objProps = getAllKeys(object),
|
|
2018
2154
|
objLength = objProps.length,
|
|
2019
|
-
othProps =
|
|
2155
|
+
othProps = getAllKeys(other),
|
|
2020
2156
|
othLength = othProps.length;
|
|
2021
2157
|
|
|
2022
2158
|
if (objLength != othLength && !isPartial) {
|
|
@@ -2051,7 +2187,7 @@ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
|
|
|
2051
2187
|
}
|
|
2052
2188
|
// Recursively compare objects (susceptible to call stack limits).
|
|
2053
2189
|
if (!(compared === undefined
|
|
2054
|
-
? (objValue === othValue || equalFunc(objValue, othValue,
|
|
2190
|
+
? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
|
|
2055
2191
|
: compared
|
|
2056
2192
|
)) {
|
|
2057
2193
|
result = false;
|
|
@@ -2076,6 +2212,17 @@ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
|
|
|
2076
2212
|
return result;
|
|
2077
2213
|
}
|
|
2078
2214
|
|
|
2215
|
+
/**
|
|
2216
|
+
* Creates an array of own enumerable property names and symbols of `object`.
|
|
2217
|
+
*
|
|
2218
|
+
* @private
|
|
2219
|
+
* @param {Object} object The object to query.
|
|
2220
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
2221
|
+
*/
|
|
2222
|
+
function getAllKeys(object) {
|
|
2223
|
+
return baseGetAllKeys(object, keys, getSymbols);
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2079
2226
|
/**
|
|
2080
2227
|
* Gets the data for `map`.
|
|
2081
2228
|
*
|
|
@@ -2104,6 +2251,50 @@ function getNative(object, key) {
|
|
|
2104
2251
|
return baseIsNative(value) ? value : undefined;
|
|
2105
2252
|
}
|
|
2106
2253
|
|
|
2254
|
+
/**
|
|
2255
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
2256
|
+
*
|
|
2257
|
+
* @private
|
|
2258
|
+
* @param {*} value The value to query.
|
|
2259
|
+
* @returns {string} Returns the raw `toStringTag`.
|
|
2260
|
+
*/
|
|
2261
|
+
function getRawTag(value) {
|
|
2262
|
+
var isOwn = hasOwnProperty.call(value, symToStringTag),
|
|
2263
|
+
tag = value[symToStringTag];
|
|
2264
|
+
|
|
2265
|
+
try {
|
|
2266
|
+
value[symToStringTag] = undefined;
|
|
2267
|
+
var unmasked = true;
|
|
2268
|
+
} catch (e) {}
|
|
2269
|
+
|
|
2270
|
+
var result = nativeObjectToString.call(value);
|
|
2271
|
+
if (unmasked) {
|
|
2272
|
+
if (isOwn) {
|
|
2273
|
+
value[symToStringTag] = tag;
|
|
2274
|
+
} else {
|
|
2275
|
+
delete value[symToStringTag];
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
return result;
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2281
|
+
/**
|
|
2282
|
+
* Creates an array of the own enumerable symbols of `object`.
|
|
2283
|
+
*
|
|
2284
|
+
* @private
|
|
2285
|
+
* @param {Object} object The object to query.
|
|
2286
|
+
* @returns {Array} Returns the array of symbols.
|
|
2287
|
+
*/
|
|
2288
|
+
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
|
2289
|
+
if (object == null) {
|
|
2290
|
+
return [];
|
|
2291
|
+
}
|
|
2292
|
+
object = Object(object);
|
|
2293
|
+
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
|
2294
|
+
return propertyIsEnumerable.call(object, symbol);
|
|
2295
|
+
});
|
|
2296
|
+
};
|
|
2297
|
+
|
|
2107
2298
|
/**
|
|
2108
2299
|
* Gets the `toStringTag` of `value`.
|
|
2109
2300
|
*
|
|
@@ -2113,17 +2304,16 @@ function getNative(object, key) {
|
|
|
2113
2304
|
*/
|
|
2114
2305
|
var getTag = baseGetTag;
|
|
2115
2306
|
|
|
2116
|
-
// Fallback for data views, maps, sets, and weak maps in IE 11
|
|
2117
|
-
// for data views in Edge < 14, and promises in Node.js.
|
|
2307
|
+
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
|
2118
2308
|
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
|
2119
2309
|
(Map && getTag(new Map) != mapTag) ||
|
|
2120
2310
|
(Promise && getTag(Promise.resolve()) != promiseTag) ||
|
|
2121
2311
|
(Set && getTag(new Set) != setTag) ||
|
|
2122
2312
|
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
|
2123
2313
|
getTag = function(value) {
|
|
2124
|
-
var result =
|
|
2314
|
+
var result = baseGetTag(value),
|
|
2125
2315
|
Ctor = result == objectTag ? value.constructor : undefined,
|
|
2126
|
-
ctorString = Ctor ? toSource(Ctor) :
|
|
2316
|
+
ctorString = Ctor ? toSource(Ctor) : '';
|
|
2127
2317
|
|
|
2128
2318
|
if (ctorString) {
|
|
2129
2319
|
switch (ctorString) {
|
|
@@ -2192,11 +2382,22 @@ function isPrototype(value) {
|
|
|
2192
2382
|
return value === proto;
|
|
2193
2383
|
}
|
|
2194
2384
|
|
|
2385
|
+
/**
|
|
2386
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
|
2387
|
+
*
|
|
2388
|
+
* @private
|
|
2389
|
+
* @param {*} value The value to convert.
|
|
2390
|
+
* @returns {string} Returns the converted string.
|
|
2391
|
+
*/
|
|
2392
|
+
function objectToString(value) {
|
|
2393
|
+
return nativeObjectToString.call(value);
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2195
2396
|
/**
|
|
2196
2397
|
* Converts `func` to its source code.
|
|
2197
2398
|
*
|
|
2198
2399
|
* @private
|
|
2199
|
-
* @param {Function} func The function to
|
|
2400
|
+
* @param {Function} func The function to convert.
|
|
2200
2401
|
* @returns {string} Returns the source code.
|
|
2201
2402
|
*/
|
|
2202
2403
|
function toSource(func) {
|
|
@@ -2265,11 +2466,10 @@ function eq(value, other) {
|
|
|
2265
2466
|
* _.isArguments([1, 2, 3]);
|
|
2266
2467
|
* // => false
|
|
2267
2468
|
*/
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
}
|
|
2469
|
+
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
|
2470
|
+
return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
|
|
2471
|
+
!propertyIsEnumerable.call(value, 'callee');
|
|
2472
|
+
};
|
|
2273
2473
|
|
|
2274
2474
|
/**
|
|
2275
2475
|
* Checks if `value` is classified as an `Array` object.
|
|
@@ -2326,33 +2526,23 @@ function isArrayLike(value) {
|
|
|
2326
2526
|
}
|
|
2327
2527
|
|
|
2328
2528
|
/**
|
|
2329
|
-
*
|
|
2330
|
-
* is an object.
|
|
2529
|
+
* Checks if `value` is a buffer.
|
|
2331
2530
|
*
|
|
2332
2531
|
* @static
|
|
2333
2532
|
* @memberOf _
|
|
2334
|
-
* @since 4.
|
|
2533
|
+
* @since 4.3.0
|
|
2335
2534
|
* @category Lang
|
|
2336
2535
|
* @param {*} value The value to check.
|
|
2337
|
-
* @returns {boolean} Returns `true` if `value` is
|
|
2338
|
-
* else `false`.
|
|
2536
|
+
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
|
2339
2537
|
* @example
|
|
2340
2538
|
*
|
|
2341
|
-
* _.
|
|
2539
|
+
* _.isBuffer(new Buffer(2));
|
|
2342
2540
|
* // => true
|
|
2343
2541
|
*
|
|
2344
|
-
* _.
|
|
2345
|
-
* // => true
|
|
2346
|
-
*
|
|
2347
|
-
* _.isArrayLikeObject('abc');
|
|
2348
|
-
* // => false
|
|
2349
|
-
*
|
|
2350
|
-
* _.isArrayLikeObject(_.noop);
|
|
2542
|
+
* _.isBuffer(new Uint8Array(2));
|
|
2351
2543
|
* // => false
|
|
2352
2544
|
*/
|
|
2353
|
-
|
|
2354
|
-
return isObjectLike(value) && isArrayLike(value);
|
|
2355
|
-
}
|
|
2545
|
+
var isBuffer = nativeIsBuffer || stubFalse;
|
|
2356
2546
|
|
|
2357
2547
|
/**
|
|
2358
2548
|
* Performs a deep comparison between two values to determine if they are
|
|
@@ -2362,7 +2552,7 @@ function isArrayLikeObject(value) {
|
|
|
2362
2552
|
* date objects, error objects, maps, numbers, `Object` objects, regexes,
|
|
2363
2553
|
* sets, strings, symbols, and typed arrays. `Object` objects are compared
|
|
2364
2554
|
* by their own, not inherited, enumerable properties. Functions and DOM
|
|
2365
|
-
* nodes are
|
|
2555
|
+
* nodes are compared by strict equality, i.e. `===`.
|
|
2366
2556
|
*
|
|
2367
2557
|
* @static
|
|
2368
2558
|
* @memberOf _
|
|
@@ -2404,10 +2594,13 @@ function isEqual(value, other) {
|
|
|
2404
2594
|
* // => false
|
|
2405
2595
|
*/
|
|
2406
2596
|
function isFunction(value) {
|
|
2597
|
+
if (!isObject(value)) {
|
|
2598
|
+
return false;
|
|
2599
|
+
}
|
|
2407
2600
|
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
2408
|
-
// in Safari
|
|
2409
|
-
var tag =
|
|
2410
|
-
return tag == funcTag || tag == genTag;
|
|
2601
|
+
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
|
2602
|
+
var tag = baseGetTag(value);
|
|
2603
|
+
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
2411
2604
|
}
|
|
2412
2605
|
|
|
2413
2606
|
/**
|
|
@@ -2468,7 +2661,7 @@ function isLength(value) {
|
|
|
2468
2661
|
*/
|
|
2469
2662
|
function isObject(value) {
|
|
2470
2663
|
var type = typeof value;
|
|
2471
|
-
return
|
|
2664
|
+
return value != null && (type == 'object' || type == 'function');
|
|
2472
2665
|
}
|
|
2473
2666
|
|
|
2474
2667
|
/**
|
|
@@ -2496,7 +2689,7 @@ function isObject(value) {
|
|
|
2496
2689
|
* // => false
|
|
2497
2690
|
*/
|
|
2498
2691
|
function isObjectLike(value) {
|
|
2499
|
-
return
|
|
2692
|
+
return value != null && typeof value == 'object';
|
|
2500
2693
|
}
|
|
2501
2694
|
|
|
2502
2695
|
/**
|
|
@@ -2550,76 +2743,209 @@ function keys(object) {
|
|
|
2550
2743
|
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
2551
2744
|
}
|
|
2552
2745
|
|
|
2746
|
+
/**
|
|
2747
|
+
* This method returns a new empty array.
|
|
2748
|
+
*
|
|
2749
|
+
* @static
|
|
2750
|
+
* @memberOf _
|
|
2751
|
+
* @since 4.13.0
|
|
2752
|
+
* @category Util
|
|
2753
|
+
* @returns {Array} Returns the new empty array.
|
|
2754
|
+
* @example
|
|
2755
|
+
*
|
|
2756
|
+
* var arrays = _.times(2, _.stubArray);
|
|
2757
|
+
*
|
|
2758
|
+
* console.log(arrays);
|
|
2759
|
+
* // => [[], []]
|
|
2760
|
+
*
|
|
2761
|
+
* console.log(arrays[0] === arrays[1]);
|
|
2762
|
+
* // => false
|
|
2763
|
+
*/
|
|
2764
|
+
function stubArray() {
|
|
2765
|
+
return [];
|
|
2766
|
+
}
|
|
2767
|
+
|
|
2768
|
+
/**
|
|
2769
|
+
* This method returns `false`.
|
|
2770
|
+
*
|
|
2771
|
+
* @static
|
|
2772
|
+
* @memberOf _
|
|
2773
|
+
* @since 4.13.0
|
|
2774
|
+
* @category Util
|
|
2775
|
+
* @returns {boolean} Returns `false`.
|
|
2776
|
+
* @example
|
|
2777
|
+
*
|
|
2778
|
+
* _.times(2, _.stubFalse);
|
|
2779
|
+
* // => [false, false]
|
|
2780
|
+
*/
|
|
2781
|
+
function stubFalse() {
|
|
2782
|
+
return false;
|
|
2783
|
+
}
|
|
2784
|
+
|
|
2553
2785
|
module.exports = isEqual;
|
|
2554
2786
|
|
|
2555
2787
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
2556
|
-
},{}],
|
|
2788
|
+
},{}],3:[function(require,module,exports){
|
|
2557
2789
|
// shim for using process in browser
|
|
2558
|
-
|
|
2559
2790
|
var process = module.exports = {};
|
|
2560
2791
|
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2792
|
+
// cached from whatever global is present so that test runners that stub it
|
|
2793
|
+
// don't break things. But we need to wrap it in a try catch in case it is
|
|
2794
|
+
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
|
2795
|
+
// function because try/catches deoptimize in certain engines.
|
|
2796
|
+
|
|
2797
|
+
var cachedSetTimeout;
|
|
2798
|
+
var cachedClearTimeout;
|
|
2799
|
+
|
|
2800
|
+
function defaultSetTimout() {
|
|
2801
|
+
throw new Error('setTimeout has not been defined');
|
|
2802
|
+
}
|
|
2803
|
+
function defaultClearTimeout () {
|
|
2804
|
+
throw new Error('clearTimeout has not been defined');
|
|
2805
|
+
}
|
|
2806
|
+
(function () {
|
|
2807
|
+
try {
|
|
2808
|
+
if (typeof setTimeout === 'function') {
|
|
2809
|
+
cachedSetTimeout = setTimeout;
|
|
2810
|
+
} else {
|
|
2811
|
+
cachedSetTimeout = defaultSetTimout;
|
|
2812
|
+
}
|
|
2813
|
+
} catch (e) {
|
|
2814
|
+
cachedSetTimeout = defaultSetTimout;
|
|
2815
|
+
}
|
|
2816
|
+
try {
|
|
2817
|
+
if (typeof clearTimeout === 'function') {
|
|
2818
|
+
cachedClearTimeout = clearTimeout;
|
|
2819
|
+
} else {
|
|
2820
|
+
cachedClearTimeout = defaultClearTimeout;
|
|
2821
|
+
}
|
|
2822
|
+
} catch (e) {
|
|
2823
|
+
cachedClearTimeout = defaultClearTimeout;
|
|
2824
|
+
}
|
|
2825
|
+
} ())
|
|
2826
|
+
function runTimeout(fun) {
|
|
2827
|
+
if (cachedSetTimeout === setTimeout) {
|
|
2828
|
+
//normal enviroments in sane situations
|
|
2829
|
+
return setTimeout(fun, 0);
|
|
2830
|
+
}
|
|
2831
|
+
// if setTimeout wasn't available but was latter defined
|
|
2832
|
+
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
2833
|
+
cachedSetTimeout = setTimeout;
|
|
2834
|
+
return setTimeout(fun, 0);
|
|
2835
|
+
}
|
|
2836
|
+
try {
|
|
2837
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
2838
|
+
return cachedSetTimeout(fun, 0);
|
|
2839
|
+
} catch(e){
|
|
2840
|
+
try {
|
|
2841
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
2842
|
+
return cachedSetTimeout.call(null, fun, 0);
|
|
2843
|
+
} catch(e){
|
|
2844
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
|
2845
|
+
return cachedSetTimeout.call(this, fun, 0);
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
|
|
2569
2849
|
|
|
2570
|
-
|
|
2571
|
-
|
|
2850
|
+
}
|
|
2851
|
+
function runClearTimeout(marker) {
|
|
2852
|
+
if (cachedClearTimeout === clearTimeout) {
|
|
2853
|
+
//normal enviroments in sane situations
|
|
2854
|
+
return clearTimeout(marker);
|
|
2855
|
+
}
|
|
2856
|
+
// if clearTimeout wasn't available but was latter defined
|
|
2857
|
+
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
2858
|
+
cachedClearTimeout = clearTimeout;
|
|
2859
|
+
return clearTimeout(marker);
|
|
2860
|
+
}
|
|
2861
|
+
try {
|
|
2862
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
2863
|
+
return cachedClearTimeout(marker);
|
|
2864
|
+
} catch (e){
|
|
2865
|
+
try {
|
|
2866
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
2867
|
+
return cachedClearTimeout.call(null, marker);
|
|
2868
|
+
} catch (e){
|
|
2869
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
|
2870
|
+
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
|
2871
|
+
return cachedClearTimeout.call(this, marker);
|
|
2872
|
+
}
|
|
2572
2873
|
}
|
|
2573
2874
|
|
|
2574
|
-
var queue = [];
|
|
2575
2875
|
|
|
2576
|
-
if (canMutationObserver) {
|
|
2577
|
-
var hiddenDiv = document.createElement("div");
|
|
2578
|
-
var observer = new MutationObserver(function () {
|
|
2579
|
-
var queueList = queue.slice();
|
|
2580
|
-
queue.length = 0;
|
|
2581
|
-
queueList.forEach(function (fn) {
|
|
2582
|
-
fn();
|
|
2583
|
-
});
|
|
2584
|
-
});
|
|
2585
2876
|
|
|
2586
|
-
|
|
2877
|
+
}
|
|
2878
|
+
var queue = [];
|
|
2879
|
+
var draining = false;
|
|
2880
|
+
var currentQueue;
|
|
2881
|
+
var queueIndex = -1;
|
|
2587
2882
|
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2883
|
+
function cleanUpNextTick() {
|
|
2884
|
+
if (!draining || !currentQueue) {
|
|
2885
|
+
return;
|
|
2886
|
+
}
|
|
2887
|
+
draining = false;
|
|
2888
|
+
if (currentQueue.length) {
|
|
2889
|
+
queue = currentQueue.concat(queue);
|
|
2890
|
+
} else {
|
|
2891
|
+
queueIndex = -1;
|
|
2892
|
+
}
|
|
2893
|
+
if (queue.length) {
|
|
2894
|
+
drainQueue();
|
|
2594
2895
|
}
|
|
2896
|
+
}
|
|
2595
2897
|
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
var fn = queue.shift();
|
|
2603
|
-
fn();
|
|
2604
|
-
}
|
|
2605
|
-
}
|
|
2606
|
-
}, true);
|
|
2898
|
+
function drainQueue() {
|
|
2899
|
+
if (draining) {
|
|
2900
|
+
return;
|
|
2901
|
+
}
|
|
2902
|
+
var timeout = runTimeout(cleanUpNextTick);
|
|
2903
|
+
draining = true;
|
|
2607
2904
|
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2905
|
+
var len = queue.length;
|
|
2906
|
+
while(len) {
|
|
2907
|
+
currentQueue = queue;
|
|
2908
|
+
queue = [];
|
|
2909
|
+
while (++queueIndex < len) {
|
|
2910
|
+
if (currentQueue) {
|
|
2911
|
+
currentQueue[queueIndex].run();
|
|
2912
|
+
}
|
|
2913
|
+
}
|
|
2914
|
+
queueIndex = -1;
|
|
2915
|
+
len = queue.length;
|
|
2612
2916
|
}
|
|
2917
|
+
currentQueue = null;
|
|
2918
|
+
draining = false;
|
|
2919
|
+
runClearTimeout(timeout);
|
|
2920
|
+
}
|
|
2613
2921
|
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2922
|
+
process.nextTick = function (fun) {
|
|
2923
|
+
var args = new Array(arguments.length - 1);
|
|
2924
|
+
if (arguments.length > 1) {
|
|
2925
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
2926
|
+
args[i - 1] = arguments[i];
|
|
2927
|
+
}
|
|
2928
|
+
}
|
|
2929
|
+
queue.push(new Item(fun, args));
|
|
2930
|
+
if (queue.length === 1 && !draining) {
|
|
2931
|
+
runTimeout(drainQueue);
|
|
2932
|
+
}
|
|
2933
|
+
};
|
|
2618
2934
|
|
|
2935
|
+
// v8 likes predictible objects
|
|
2936
|
+
function Item(fun, array) {
|
|
2937
|
+
this.fun = fun;
|
|
2938
|
+
this.array = array;
|
|
2939
|
+
}
|
|
2940
|
+
Item.prototype.run = function () {
|
|
2941
|
+
this.fun.apply(null, this.array);
|
|
2942
|
+
};
|
|
2619
2943
|
process.title = 'browser';
|
|
2620
2944
|
process.browser = true;
|
|
2621
2945
|
process.env = {};
|
|
2622
2946
|
process.argv = [];
|
|
2947
|
+
process.version = ''; // empty string to avoid regexp issues
|
|
2948
|
+
process.versions = {};
|
|
2623
2949
|
|
|
2624
2950
|
function noop() {}
|
|
2625
2951
|
|
|
@@ -2630,18 +2956,22 @@ process.off = noop;
|
|
|
2630
2956
|
process.removeListener = noop;
|
|
2631
2957
|
process.removeAllListeners = noop;
|
|
2632
2958
|
process.emit = noop;
|
|
2959
|
+
process.prependListener = noop;
|
|
2960
|
+
process.prependOnceListener = noop;
|
|
2961
|
+
|
|
2962
|
+
process.listeners = function (name) { return [] }
|
|
2633
2963
|
|
|
2634
2964
|
process.binding = function (name) {
|
|
2635
2965
|
throw new Error('process.binding is not supported');
|
|
2636
2966
|
};
|
|
2637
2967
|
|
|
2638
|
-
// TODO(shtylman)
|
|
2639
2968
|
process.cwd = function () { return '/' };
|
|
2640
2969
|
process.chdir = function (dir) {
|
|
2641
2970
|
throw new Error('process.chdir is not supported');
|
|
2642
2971
|
};
|
|
2972
|
+
process.umask = function() { return 0; };
|
|
2643
2973
|
|
|
2644
|
-
},{}],
|
|
2974
|
+
},{}],4:[function(require,module,exports){
|
|
2645
2975
|
'use strict';
|
|
2646
2976
|
|
|
2647
2977
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -2712,6 +3042,10 @@ var _isNumeric = require('./lib/isNumeric');
|
|
|
2712
3042
|
|
|
2713
3043
|
var _isNumeric2 = _interopRequireDefault(_isNumeric);
|
|
2714
3044
|
|
|
3045
|
+
var _isPort = require('./lib/isPort');
|
|
3046
|
+
|
|
3047
|
+
var _isPort2 = _interopRequireDefault(_isPort);
|
|
3048
|
+
|
|
2715
3049
|
var _isLowercase = require('./lib/isLowercase');
|
|
2716
3050
|
|
|
2717
3051
|
var _isLowercase2 = _interopRequireDefault(_isLowercase);
|
|
@@ -2768,13 +3102,25 @@ var _isHexColor = require('./lib/isHexColor');
|
|
|
2768
3102
|
|
|
2769
3103
|
var _isHexColor2 = _interopRequireDefault(_isHexColor);
|
|
2770
3104
|
|
|
3105
|
+
var _isISRC = require('./lib/isISRC');
|
|
3106
|
+
|
|
3107
|
+
var _isISRC2 = _interopRequireDefault(_isISRC);
|
|
3108
|
+
|
|
3109
|
+
var _isMD = require('./lib/isMD5');
|
|
3110
|
+
|
|
3111
|
+
var _isMD2 = _interopRequireDefault(_isMD);
|
|
3112
|
+
|
|
3113
|
+
var _isHash = require('./lib/isHash');
|
|
3114
|
+
|
|
3115
|
+
var _isHash2 = _interopRequireDefault(_isHash);
|
|
3116
|
+
|
|
2771
3117
|
var _isJSON = require('./lib/isJSON');
|
|
2772
3118
|
|
|
2773
3119
|
var _isJSON2 = _interopRequireDefault(_isJSON);
|
|
2774
3120
|
|
|
2775
|
-
var
|
|
3121
|
+
var _isEmpty = require('./lib/isEmpty');
|
|
2776
3122
|
|
|
2777
|
-
var
|
|
3123
|
+
var _isEmpty2 = _interopRequireDefault(_isEmpty);
|
|
2778
3124
|
|
|
2779
3125
|
var _isLength = require('./lib/isLength');
|
|
2780
3126
|
|
|
@@ -2792,10 +3138,6 @@ var _isMongoId = require('./lib/isMongoId');
|
|
|
2792
3138
|
|
|
2793
3139
|
var _isMongoId2 = _interopRequireDefault(_isMongoId);
|
|
2794
3140
|
|
|
2795
|
-
var _isDate = require('./lib/isDate');
|
|
2796
|
-
|
|
2797
|
-
var _isDate2 = _interopRequireDefault(_isDate);
|
|
2798
|
-
|
|
2799
3141
|
var _isAfter = require('./lib/isAfter');
|
|
2800
3142
|
|
|
2801
3143
|
var _isAfter2 = _interopRequireDefault(_isAfter);
|
|
@@ -2820,6 +3162,10 @@ var _isISBN = require('./lib/isISBN');
|
|
|
2820
3162
|
|
|
2821
3163
|
var _isISBN2 = _interopRequireDefault(_isISBN);
|
|
2822
3164
|
|
|
3165
|
+
var _isISSN = require('./lib/isISSN');
|
|
3166
|
+
|
|
3167
|
+
var _isISSN2 = _interopRequireDefault(_isISSN);
|
|
3168
|
+
|
|
2823
3169
|
var _isMobilePhone = require('./lib/isMobilePhone');
|
|
2824
3170
|
|
|
2825
3171
|
var _isMobilePhone2 = _interopRequireDefault(_isMobilePhone);
|
|
@@ -2832,6 +3178,10 @@ var _isISO = require('./lib/isISO8601');
|
|
|
2832
3178
|
|
|
2833
3179
|
var _isISO2 = _interopRequireDefault(_isISO);
|
|
2834
3180
|
|
|
3181
|
+
var _isISO31661Alpha = require('./lib/isISO31661Alpha2');
|
|
3182
|
+
|
|
3183
|
+
var _isISO31661Alpha2 = _interopRequireDefault(_isISO31661Alpha);
|
|
3184
|
+
|
|
2835
3185
|
var _isBase = require('./lib/isBase64');
|
|
2836
3186
|
|
|
2837
3187
|
var _isBase2 = _interopRequireDefault(_isBase);
|
|
@@ -2840,6 +3190,14 @@ var _isDataURI = require('./lib/isDataURI');
|
|
|
2840
3190
|
|
|
2841
3191
|
var _isDataURI2 = _interopRequireDefault(_isDataURI);
|
|
2842
3192
|
|
|
3193
|
+
var _isLatLong = require('./lib/isLatLong');
|
|
3194
|
+
|
|
3195
|
+
var _isLatLong2 = _interopRequireDefault(_isLatLong);
|
|
3196
|
+
|
|
3197
|
+
var _isPostalCode = require('./lib/isPostalCode');
|
|
3198
|
+
|
|
3199
|
+
var _isPostalCode2 = _interopRequireDefault(_isPostalCode);
|
|
3200
|
+
|
|
2843
3201
|
var _ltrim = require('./lib/ltrim');
|
|
2844
3202
|
|
|
2845
3203
|
var _ltrim2 = _interopRequireDefault(_ltrim);
|
|
@@ -2886,36 +3244,73 @@ var _toString2 = _interopRequireDefault(_toString);
|
|
|
2886
3244
|
|
|
2887
3245
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2888
3246
|
|
|
2889
|
-
var version = '
|
|
3247
|
+
var version = '9.1.1';
|
|
2890
3248
|
|
|
2891
3249
|
var validator = {
|
|
2892
3250
|
version: version,
|
|
2893
3251
|
toDate: _toDate2.default,
|
|
2894
|
-
toFloat: _toFloat2.default,
|
|
3252
|
+
toFloat: _toFloat2.default,
|
|
3253
|
+
toInt: _toInt2.default,
|
|
2895
3254
|
toBoolean: _toBoolean2.default,
|
|
2896
|
-
equals: _equals2.default,
|
|
2897
|
-
|
|
3255
|
+
equals: _equals2.default,
|
|
3256
|
+
contains: _contains2.default,
|
|
3257
|
+
matches: _matches2.default,
|
|
3258
|
+
isEmail: _isEmail2.default,
|
|
3259
|
+
isURL: _isURL2.default,
|
|
3260
|
+
isMACAddress: _isMACAddress2.default,
|
|
3261
|
+
isIP: _isIP2.default,
|
|
3262
|
+
isFQDN: _isFQDN2.default,
|
|
2898
3263
|
isBoolean: _isBoolean2.default,
|
|
2899
|
-
isAlpha: _isAlpha2.default,
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
3264
|
+
isAlpha: _isAlpha2.default,
|
|
3265
|
+
isAlphanumeric: _isAlphanumeric2.default,
|
|
3266
|
+
isNumeric: _isNumeric2.default,
|
|
3267
|
+
isPort: _isPort2.default,
|
|
3268
|
+
isLowercase: _isLowercase2.default,
|
|
3269
|
+
isUppercase: _isUppercase2.default,
|
|
3270
|
+
isAscii: _isAscii2.default,
|
|
3271
|
+
isFullWidth: _isFullWidth2.default,
|
|
3272
|
+
isHalfWidth: _isHalfWidth2.default,
|
|
3273
|
+
isVariableWidth: _isVariableWidth2.default,
|
|
3274
|
+
isMultibyte: _isMultibyte2.default,
|
|
3275
|
+
isSurrogatePair: _isSurrogatePair2.default,
|
|
3276
|
+
isInt: _isInt2.default,
|
|
3277
|
+
isFloat: _isFloat2.default,
|
|
3278
|
+
isDecimal: _isDecimal2.default,
|
|
3279
|
+
isHexadecimal: _isHexadecimal2.default,
|
|
3280
|
+
isDivisibleBy: _isDivisibleBy2.default,
|
|
2903
3281
|
isHexColor: _isHexColor2.default,
|
|
3282
|
+
isISRC: _isISRC2.default,
|
|
3283
|
+
isMD5: _isMD2.default,
|
|
3284
|
+
isHash: _isHash2.default,
|
|
2904
3285
|
isJSON: _isJSON2.default,
|
|
2905
|
-
|
|
2906
|
-
isLength: _isLength2.default,
|
|
2907
|
-
|
|
2908
|
-
|
|
3286
|
+
isEmpty: _isEmpty2.default,
|
|
3287
|
+
isLength: _isLength2.default,
|
|
3288
|
+
isByteLength: _isByteLength2.default,
|
|
3289
|
+
isUUID: _isUUID2.default,
|
|
3290
|
+
isMongoId: _isMongoId2.default,
|
|
3291
|
+
isAfter: _isAfter2.default,
|
|
3292
|
+
isBefore: _isBefore2.default,
|
|
2909
3293
|
isIn: _isIn2.default,
|
|
2910
3294
|
isCreditCard: _isCreditCard2.default,
|
|
2911
|
-
isISIN: _isISIN2.default,
|
|
3295
|
+
isISIN: _isISIN2.default,
|
|
3296
|
+
isISBN: _isISBN2.default,
|
|
3297
|
+
isISSN: _isISSN2.default,
|
|
2912
3298
|
isMobilePhone: _isMobilePhone2.default,
|
|
3299
|
+
isPostalCode: _isPostalCode2.default,
|
|
2913
3300
|
isCurrency: _isCurrency2.default,
|
|
2914
3301
|
isISO8601: _isISO2.default,
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
3302
|
+
isISO31661Alpha2: _isISO31661Alpha2.default,
|
|
3303
|
+
isBase64: _isBase2.default,
|
|
3304
|
+
isDataURI: _isDataURI2.default,
|
|
3305
|
+
isLatLong: _isLatLong2.default,
|
|
3306
|
+
ltrim: _ltrim2.default,
|
|
3307
|
+
rtrim: _rtrim2.default,
|
|
3308
|
+
trim: _trim2.default,
|
|
3309
|
+
escape: _escape2.default,
|
|
3310
|
+
unescape: _unescape2.default,
|
|
3311
|
+
stripLow: _stripLow2.default,
|
|
3312
|
+
whitelist: _whitelist2.default,
|
|
3313
|
+
blacklist: _blacklist2.default,
|
|
2919
3314
|
isWhitelisted: _isWhitelisted2.default,
|
|
2920
3315
|
normalizeEmail: _normalizeEmail2.default,
|
|
2921
3316
|
toString: _toString2.default
|
|
@@ -2923,7 +3318,7 @@ var validator = {
|
|
|
2923
3318
|
|
|
2924
3319
|
exports.default = validator;
|
|
2925
3320
|
module.exports = exports['default'];
|
|
2926
|
-
},{"./lib/blacklist":
|
|
3321
|
+
},{"./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/isISO8601":36,"./lib/isISRC":37,"./lib/isISSN":38,"./lib/isIn":39,"./lib/isInt":40,"./lib/isJSON":41,"./lib/isLatLong":42,"./lib/isLength":43,"./lib/isLowercase":44,"./lib/isMACAddress":45,"./lib/isMD5":46,"./lib/isMobilePhone":47,"./lib/isMongoId":48,"./lib/isMultibyte":49,"./lib/isNumeric":50,"./lib/isPort":51,"./lib/isPostalCode":52,"./lib/isSurrogatePair":53,"./lib/isURL":54,"./lib/isUUID":55,"./lib/isUppercase":56,"./lib/isVariableWidth":57,"./lib/isWhitelisted":58,"./lib/ltrim":59,"./lib/matches":60,"./lib/normalizeEmail":61,"./lib/rtrim":62,"./lib/stripLow":63,"./lib/toBoolean":64,"./lib/toDate":65,"./lib/toFloat":66,"./lib/toInt":67,"./lib/trim":68,"./lib/unescape":69,"./lib/util/toString":72,"./lib/whitelist":73}],5:[function(require,module,exports){
|
|
2927
3322
|
'use strict';
|
|
2928
3323
|
|
|
2929
3324
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -2932,37 +3327,61 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2932
3327
|
var alpha = exports.alpha = {
|
|
2933
3328
|
'en-US': /^[A-Z]+$/i,
|
|
2934
3329
|
'cs-CZ': /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
|
|
3330
|
+
'da-DK': /^[A-ZÆØÅ]+$/i,
|
|
2935
3331
|
'de-DE': /^[A-ZÄÖÜß]+$/i,
|
|
2936
3332
|
'es-ES': /^[A-ZÁÉÍÑÓÚÜ]+$/i,
|
|
2937
3333
|
'fr-FR': /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,
|
|
2938
|
-
'
|
|
3334
|
+
'it-IT': /^[A-ZÀÉÈÌÎÓÒÙ]+$/i,
|
|
3335
|
+
'nb-NO': /^[A-ZÆØÅ]+$/i,
|
|
3336
|
+
'nl-NL': /^[A-ZÁÉËÏÓÖÜÚ]+$/i,
|
|
3337
|
+
'nn-NO': /^[A-ZÆØÅ]+$/i,
|
|
3338
|
+
'hu-HU': /^[A-ZÁÉÍÓÖŐÚÜŰ]+$/i,
|
|
2939
3339
|
'pl-PL': /^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
|
|
2940
3340
|
'pt-PT': /^[A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i,
|
|
2941
|
-
'ru-RU': /^[
|
|
3341
|
+
'ru-RU': /^[А-ЯЁ]+$/i,
|
|
3342
|
+
'sr-RS@latin': /^[A-ZČĆŽŠĐ]+$/i,
|
|
3343
|
+
'sr-RS': /^[А-ЯЂЈЉЊЋЏ]+$/i,
|
|
3344
|
+
'sv-SE': /^[A-ZÅÄÖ]+$/i,
|
|
2942
3345
|
'tr-TR': /^[A-ZÇĞİıÖŞÜ]+$/i,
|
|
3346
|
+
'uk-UA': /^[А-ЩЬЮЯЄIЇҐі]+$/i,
|
|
2943
3347
|
ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/
|
|
2944
3348
|
};
|
|
2945
3349
|
|
|
2946
3350
|
var alphanumeric = exports.alphanumeric = {
|
|
2947
3351
|
'en-US': /^[0-9A-Z]+$/i,
|
|
2948
3352
|
'cs-CZ': /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
|
|
3353
|
+
'da-DK': /^[0-9A-ZÆØÅ]+$/i,
|
|
2949
3354
|
'de-DE': /^[0-9A-ZÄÖÜß]+$/i,
|
|
2950
3355
|
'es-ES': /^[0-9A-ZÁÉÍÑÓÚÜ]+$/i,
|
|
2951
3356
|
'fr-FR': /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,
|
|
2952
|
-
'
|
|
3357
|
+
'it-IT': /^[0-9A-ZÀÉÈÌÎÓÒÙ]+$/i,
|
|
3358
|
+
'hu-HU': /^[0-9A-ZÁÉÍÓÖŐÚÜŰ]+$/i,
|
|
3359
|
+
'nb-NO': /^[0-9A-ZÆØÅ]+$/i,
|
|
3360
|
+
'nl-NL': /^[0-9A-ZÁÉËÏÓÖÜÚ]+$/i,
|
|
3361
|
+
'nn-NO': /^[0-9A-ZÆØÅ]+$/i,
|
|
2953
3362
|
'pl-PL': /^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
|
|
2954
3363
|
'pt-PT': /^[0-9A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i,
|
|
2955
|
-
'ru-RU': /^[0-9
|
|
3364
|
+
'ru-RU': /^[0-9А-ЯЁ]+$/i,
|
|
3365
|
+
'sr-RS@latin': /^[0-9A-ZČĆŽŠĐ]+$/i,
|
|
3366
|
+
'sr-RS': /^[0-9А-ЯЂЈЉЊЋЏ]+$/i,
|
|
3367
|
+
'sv-SE': /^[0-9A-ZÅÄÖ]+$/i,
|
|
2956
3368
|
'tr-TR': /^[0-9A-ZÇĞİıÖŞÜ]+$/i,
|
|
3369
|
+
'uk-UA': /^[0-9А-ЩЬЮЯЄIЇҐі]+$/i,
|
|
2957
3370
|
ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/
|
|
2958
3371
|
};
|
|
2959
3372
|
|
|
3373
|
+
var decimal = exports.decimal = {
|
|
3374
|
+
'en-US': '.',
|
|
3375
|
+
ar: '٫'
|
|
3376
|
+
};
|
|
3377
|
+
|
|
2960
3378
|
var englishLocales = exports.englishLocales = ['AU', 'GB', 'HK', 'IN', 'NZ', 'ZA', 'ZM'];
|
|
2961
3379
|
|
|
2962
3380
|
for (var locale, i = 0; i < englishLocales.length; i++) {
|
|
2963
3381
|
locale = 'en-' + englishLocales[i];
|
|
2964
3382
|
alpha[locale] = alpha['en-US'];
|
|
2965
3383
|
alphanumeric[locale] = alphanumeric['en-US'];
|
|
3384
|
+
decimal[locale] = decimal['en-US'];
|
|
2966
3385
|
}
|
|
2967
3386
|
|
|
2968
3387
|
// Source: http://www.localeplanet.com/java/
|
|
@@ -2972,8 +3391,25 @@ for (var _locale, _i = 0; _i < arabicLocales.length; _i++) {
|
|
|
2972
3391
|
_locale = 'ar-' + arabicLocales[_i];
|
|
2973
3392
|
alpha[_locale] = alpha.ar;
|
|
2974
3393
|
alphanumeric[_locale] = alphanumeric.ar;
|
|
3394
|
+
decimal[_locale] = decimal.ar;
|
|
3395
|
+
}
|
|
3396
|
+
|
|
3397
|
+
// Source: https://en.wikipedia.org/wiki/Decimal_mark
|
|
3398
|
+
var dotDecimal = exports.dotDecimal = [];
|
|
3399
|
+
var commaDecimal = exports.commaDecimal = ['cs-CZ', 'da-DK', 'de-DE', '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'];
|
|
3400
|
+
|
|
3401
|
+
for (var _i2 = 0; _i2 < dotDecimal.length; _i2++) {
|
|
3402
|
+
decimal[dotDecimal[_i2]] = decimal['en-US'];
|
|
3403
|
+
}
|
|
3404
|
+
|
|
3405
|
+
for (var _i3 = 0; _i3 < commaDecimal.length; _i3++) {
|
|
3406
|
+
decimal[commaDecimal[_i3]] = ',';
|
|
2975
3407
|
}
|
|
2976
|
-
|
|
3408
|
+
|
|
3409
|
+
alpha['pt-BR'] = alpha['pt-PT'];
|
|
3410
|
+
alphanumeric['pt-BR'] = alphanumeric['pt-PT'];
|
|
3411
|
+
decimal['pt-BR'] = decimal['pt-PT'];
|
|
3412
|
+
},{}],6:[function(require,module,exports){
|
|
2977
3413
|
'use strict';
|
|
2978
3414
|
|
|
2979
3415
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -2992,7 +3428,7 @@ function blacklist(str, chars) {
|
|
|
2992
3428
|
return str.replace(new RegExp('[' + chars + ']+', 'g'), '');
|
|
2993
3429
|
}
|
|
2994
3430
|
module.exports = exports['default'];
|
|
2995
|
-
},{"./util/assertString":
|
|
3431
|
+
},{"./util/assertString":70}],7:[function(require,module,exports){
|
|
2996
3432
|
'use strict';
|
|
2997
3433
|
|
|
2998
3434
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3015,7 +3451,7 @@ function contains(str, elem) {
|
|
|
3015
3451
|
return str.indexOf((0, _toString2.default)(elem)) >= 0;
|
|
3016
3452
|
}
|
|
3017
3453
|
module.exports = exports['default'];
|
|
3018
|
-
},{"./util/assertString":
|
|
3454
|
+
},{"./util/assertString":70,"./util/toString":72}],8:[function(require,module,exports){
|
|
3019
3455
|
'use strict';
|
|
3020
3456
|
|
|
3021
3457
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3034,11 +3470,11 @@ function equals(str, comparison) {
|
|
|
3034
3470
|
return str === comparison;
|
|
3035
3471
|
}
|
|
3036
3472
|
module.exports = exports['default'];
|
|
3037
|
-
},{"./util/assertString":
|
|
3473
|
+
},{"./util/assertString":70}],9:[function(require,module,exports){
|
|
3038
3474
|
'use strict';
|
|
3039
3475
|
|
|
3040
3476
|
Object.defineProperty(exports, "__esModule", {
|
|
3041
|
-
|
|
3477
|
+
value: true
|
|
3042
3478
|
});
|
|
3043
3479
|
exports.default = escape;
|
|
3044
3480
|
|
|
@@ -3049,11 +3485,11 @@ var _assertString2 = _interopRequireDefault(_assertString);
|
|
|
3049
3485
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
3050
3486
|
|
|
3051
3487
|
function escape(str) {
|
|
3052
|
-
|
|
3053
|
-
|
|
3488
|
+
(0, _assertString2.default)(str);
|
|
3489
|
+
return str.replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, ''').replace(/</g, '<').replace(/>/g, '>').replace(/\//g, '/').replace(/\\/g, '\').replace(/`/g, '`');
|
|
3054
3490
|
}
|
|
3055
3491
|
module.exports = exports['default'];
|
|
3056
|
-
},{"./util/assertString":
|
|
3492
|
+
},{"./util/assertString":70}],10:[function(require,module,exports){
|
|
3057
3493
|
'use strict';
|
|
3058
3494
|
|
|
3059
3495
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3072,7 +3508,7 @@ var _toDate2 = _interopRequireDefault(_toDate);
|
|
|
3072
3508
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
3073
3509
|
|
|
3074
3510
|
function isAfter(str) {
|
|
3075
|
-
var date = arguments.length
|
|
3511
|
+
var date = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : String(new Date());
|
|
3076
3512
|
|
|
3077
3513
|
(0, _assertString2.default)(str);
|
|
3078
3514
|
var comparison = (0, _toDate2.default)(date);
|
|
@@ -3080,7 +3516,7 @@ function isAfter(str) {
|
|
|
3080
3516
|
return !!(original && comparison && original > comparison);
|
|
3081
3517
|
}
|
|
3082
3518
|
module.exports = exports['default'];
|
|
3083
|
-
},{"./toDate":
|
|
3519
|
+
},{"./toDate":65,"./util/assertString":70}],11:[function(require,module,exports){
|
|
3084
3520
|
'use strict';
|
|
3085
3521
|
|
|
3086
3522
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3097,7 +3533,7 @@ var _alpha = require('./alpha');
|
|
|
3097
3533
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
3098
3534
|
|
|
3099
3535
|
function isAlpha(str) {
|
|
3100
|
-
var locale = arguments.length
|
|
3536
|
+
var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US';
|
|
3101
3537
|
|
|
3102
3538
|
(0, _assertString2.default)(str);
|
|
3103
3539
|
if (locale in _alpha.alpha) {
|
|
@@ -3106,7 +3542,7 @@ function isAlpha(str) {
|
|
|
3106
3542
|
throw new Error('Invalid locale \'' + locale + '\'');
|
|
3107
3543
|
}
|
|
3108
3544
|
module.exports = exports['default'];
|
|
3109
|
-
},{"./alpha":
|
|
3545
|
+
},{"./alpha":5,"./util/assertString":70}],12:[function(require,module,exports){
|
|
3110
3546
|
'use strict';
|
|
3111
3547
|
|
|
3112
3548
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3123,7 +3559,7 @@ var _alpha = require('./alpha');
|
|
|
3123
3559
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
3124
3560
|
|
|
3125
3561
|
function isAlphanumeric(str) {
|
|
3126
|
-
var locale = arguments.length
|
|
3562
|
+
var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US';
|
|
3127
3563
|
|
|
3128
3564
|
(0, _assertString2.default)(str);
|
|
3129
3565
|
if (locale in _alpha.alphanumeric) {
|
|
@@ -3132,7 +3568,7 @@ function isAlphanumeric(str) {
|
|
|
3132
3568
|
throw new Error('Invalid locale \'' + locale + '\'');
|
|
3133
3569
|
}
|
|
3134
3570
|
module.exports = exports['default'];
|
|
3135
|
-
},{"./alpha":
|
|
3571
|
+
},{"./alpha":5,"./util/assertString":70}],13:[function(require,module,exports){
|
|
3136
3572
|
'use strict';
|
|
3137
3573
|
|
|
3138
3574
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3146,14 +3582,16 @@ var _assertString2 = _interopRequireDefault(_assertString);
|
|
|
3146
3582
|
|
|
3147
3583
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
3148
3584
|
|
|
3585
|
+
/* eslint-disable no-control-regex */
|
|
3149
3586
|
var ascii = /^[\x00-\x7F]+$/;
|
|
3587
|
+
/* eslint-enable no-control-regex */
|
|
3150
3588
|
|
|
3151
3589
|
function isAscii(str) {
|
|
3152
3590
|
(0, _assertString2.default)(str);
|
|
3153
3591
|
return ascii.test(str);
|
|
3154
3592
|
}
|
|
3155
3593
|
module.exports = exports['default'];
|
|
3156
|
-
},{"./util/assertString":
|
|
3594
|
+
},{"./util/assertString":70}],14:[function(require,module,exports){
|
|
3157
3595
|
'use strict';
|
|
3158
3596
|
|
|
3159
3597
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3179,7 +3617,7 @@ function isBase64(str) {
|
|
|
3179
3617
|
return firstPaddingChar === -1 || firstPaddingChar === len - 1 || firstPaddingChar === len - 2 && str[len - 1] === '=';
|
|
3180
3618
|
}
|
|
3181
3619
|
module.exports = exports['default'];
|
|
3182
|
-
},{"./util/assertString":
|
|
3620
|
+
},{"./util/assertString":70}],15:[function(require,module,exports){
|
|
3183
3621
|
'use strict';
|
|
3184
3622
|
|
|
3185
3623
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3198,7 +3636,7 @@ var _toDate2 = _interopRequireDefault(_toDate);
|
|
|
3198
3636
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
3199
3637
|
|
|
3200
3638
|
function isBefore(str) {
|
|
3201
|
-
var date = arguments.length
|
|
3639
|
+
var date = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : String(new Date());
|
|
3202
3640
|
|
|
3203
3641
|
(0, _assertString2.default)(str);
|
|
3204
3642
|
var comparison = (0, _toDate2.default)(date);
|
|
@@ -3206,7 +3644,7 @@ function isBefore(str) {
|
|
|
3206
3644
|
return !!(original && comparison && original < comparison);
|
|
3207
3645
|
}
|
|
3208
3646
|
module.exports = exports['default'];
|
|
3209
|
-
},{"./toDate":
|
|
3647
|
+
},{"./toDate":65,"./util/assertString":70}],16:[function(require,module,exports){
|
|
3210
3648
|
'use strict';
|
|
3211
3649
|
|
|
3212
3650
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3225,14 +3663,14 @@ function isBoolean(str) {
|
|
|
3225
3663
|
return ['true', 'false', '1', '0'].indexOf(str) >= 0;
|
|
3226
3664
|
}
|
|
3227
3665
|
module.exports = exports['default'];
|
|
3228
|
-
},{"./util/assertString":
|
|
3666
|
+
},{"./util/assertString":70}],17:[function(require,module,exports){
|
|
3229
3667
|
'use strict';
|
|
3230
3668
|
|
|
3231
3669
|
Object.defineProperty(exports, "__esModule", {
|
|
3232
3670
|
value: true
|
|
3233
3671
|
});
|
|
3234
3672
|
|
|
3235
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
|
|
3673
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
3236
3674
|
|
|
3237
3675
|
exports.default = isByteLength;
|
|
3238
3676
|
|
|
@@ -3259,7 +3697,7 @@ function isByteLength(str, options) {
|
|
|
3259
3697
|
return len >= min && (typeof max === 'undefined' || len <= max);
|
|
3260
3698
|
}
|
|
3261
3699
|
module.exports = exports['default'];
|
|
3262
|
-
},{"./util/assertString":
|
|
3700
|
+
},{"./util/assertString":70}],18:[function(require,module,exports){
|
|
3263
3701
|
'use strict';
|
|
3264
3702
|
|
|
3265
3703
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3274,12 +3712,12 @@ var _assertString2 = _interopRequireDefault(_assertString);
|
|
|
3274
3712
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
3275
3713
|
|
|
3276
3714
|
/* eslint-disable max-len */
|
|
3277
|
-
var creditCard = /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|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})$/;
|
|
3715
|
+
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}|62[0-9]{14})$/;
|
|
3278
3716
|
/* eslint-enable max-len */
|
|
3279
3717
|
|
|
3280
3718
|
function isCreditCard(str) {
|
|
3281
3719
|
(0, _assertString2.default)(str);
|
|
3282
|
-
var sanitized = str.replace(/[
|
|
3720
|
+
var sanitized = str.replace(/[- ]+/g, '');
|
|
3283
3721
|
if (!creditCard.test(sanitized)) {
|
|
3284
3722
|
return false;
|
|
3285
3723
|
}
|
|
@@ -3305,7 +3743,7 @@ function isCreditCard(str) {
|
|
|
3305
3743
|
return !!(sum % 10 === 0 ? sanitized : false);
|
|
3306
3744
|
}
|
|
3307
3745
|
module.exports = exports['default'];
|
|
3308
|
-
},{"./util/assertString":
|
|
3746
|
+
},{"./util/assertString":70}],19:[function(require,module,exports){
|
|
3309
3747
|
'use strict';
|
|
3310
3748
|
|
|
3311
3749
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3324,14 +3762,18 @@ var _assertString2 = _interopRequireDefault(_assertString);
|
|
|
3324
3762
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
3325
3763
|
|
|
3326
3764
|
function currencyRegex(options) {
|
|
3765
|
+
var decimal_digits = '\\d{' + options.digits_after_decimal[0] + '}';
|
|
3766
|
+
options.digits_after_decimal.forEach(function (digit, index) {
|
|
3767
|
+
if (index !== 0) decimal_digits = decimal_digits + '|\\d{' + digit + '}';
|
|
3768
|
+
});
|
|
3327
3769
|
var symbol = '(\\' + options.symbol.replace(/\./g, '\\.') + ')' + (options.require_symbol ? '' : '?'),
|
|
3328
3770
|
negative = '-?',
|
|
3329
3771
|
whole_dollar_amount_without_sep = '[1-9]\\d*',
|
|
3330
3772
|
whole_dollar_amount_with_sep = '[1-9]\\d{0,2}(\\' + options.thousands_separator + '\\d{3})*',
|
|
3331
3773
|
valid_whole_dollar_amounts = ['0', whole_dollar_amount_without_sep, whole_dollar_amount_with_sep],
|
|
3332
3774
|
whole_dollar_amount = '(' + valid_whole_dollar_amounts.join('|') + ')?',
|
|
3333
|
-
decimal_amount = '(\\' + options.decimal_separator + '
|
|
3334
|
-
var pattern = whole_dollar_amount + decimal_amount;
|
|
3775
|
+
decimal_amount = '(\\' + options.decimal_separator + '(' + decimal_digits + '))' + (options.require_decimal ? '' : '?');
|
|
3776
|
+
var pattern = whole_dollar_amount + (options.allow_decimal || options.require_decimal ? decimal_amount : '');
|
|
3335
3777
|
|
|
3336
3778
|
// default is negative sign before symbol, but there are two other options (besides parens)
|
|
3337
3779
|
if (options.allow_negatives && !options.parens_for_negatives) {
|
|
@@ -3365,12 +3807,9 @@ function currencyRegex(options) {
|
|
|
3365
3807
|
}
|
|
3366
3808
|
}
|
|
3367
3809
|
|
|
3368
|
-
/* eslint-disable prefer-template */
|
|
3369
|
-
return new RegExp('^' +
|
|
3370
3810
|
// ensure there's a dollar and/or decimal amount, and that
|
|
3371
3811
|
// it doesn't start with a space or a negative sign followed by a space
|
|
3372
|
-
'(?!-? )(?=.*\\d)' + pattern + '$');
|
|
3373
|
-
/* eslint-enable prefer-template */
|
|
3812
|
+
return new RegExp('^(?!-? )(?=.*\\d)' + pattern + '$');
|
|
3374
3813
|
}
|
|
3375
3814
|
|
|
3376
3815
|
var default_currency_options = {
|
|
@@ -3385,6 +3824,9 @@ var default_currency_options = {
|
|
|
3385
3824
|
allow_negative_sign_placeholder: false,
|
|
3386
3825
|
thousands_separator: ',',
|
|
3387
3826
|
decimal_separator: '.',
|
|
3827
|
+
allow_decimal: true,
|
|
3828
|
+
require_decimal: false,
|
|
3829
|
+
digits_after_decimal: [2],
|
|
3388
3830
|
allow_space_after_digits: false
|
|
3389
3831
|
};
|
|
3390
3832
|
|
|
@@ -3394,7 +3836,7 @@ function isCurrency(str, options) {
|
|
|
3394
3836
|
return currencyRegex(options).test(str);
|
|
3395
3837
|
}
|
|
3396
3838
|
module.exports = exports['default'];
|
|
3397
|
-
},{"./util/assertString":
|
|
3839
|
+
},{"./util/assertString":70,"./util/merge":71}],20:[function(require,module,exports){
|
|
3398
3840
|
'use strict';
|
|
3399
3841
|
|
|
3400
3842
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3408,136 +3850,56 @@ var _assertString2 = _interopRequireDefault(_assertString);
|
|
|
3408
3850
|
|
|
3409
3851
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
3410
3852
|
|
|
3411
|
-
var dataURI = /^\s*data:([a-z]+\/[a-z0-9\-\+]+(;[a-z\-]
|
|
3853
|
+
var dataURI = /^\s*data:([a-z]+\/[a-z0-9\-\+]+(;[a-z\-]+=[a-z0-9\-]+)?)?(;base64)?,[a-z0-9!\$&',\(\)\*\+,;=\-\._~:@\/\?%\s]*\s*$/i; // eslint-disable-line max-len
|
|
3412
3854
|
|
|
3413
3855
|
function isDataURI(str) {
|
|
3414
3856
|
(0, _assertString2.default)(str);
|
|
3415
3857
|
return dataURI.test(str);
|
|
3416
3858
|
}
|
|
3417
3859
|
module.exports = exports['default'];
|
|
3418
|
-
},{"./util/assertString":
|
|
3860
|
+
},{"./util/assertString":70}],21:[function(require,module,exports){
|
|
3419
3861
|
'use strict';
|
|
3420
3862
|
|
|
3421
3863
|
Object.defineProperty(exports, "__esModule", {
|
|
3422
3864
|
value: true
|
|
3423
3865
|
});
|
|
3424
|
-
exports.default =
|
|
3866
|
+
exports.default = isDecimal;
|
|
3867
|
+
|
|
3868
|
+
var _merge = require('./util/merge');
|
|
3869
|
+
|
|
3870
|
+
var _merge2 = _interopRequireDefault(_merge);
|
|
3425
3871
|
|
|
3426
3872
|
var _assertString = require('./util/assertString');
|
|
3427
3873
|
|
|
3428
3874
|
var _assertString2 = _interopRequireDefault(_assertString);
|
|
3429
3875
|
|
|
3430
|
-
var
|
|
3876
|
+
var _alpha = require('./alpha');
|
|
3431
3877
|
|
|
3432
3878
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
3433
3879
|
|
|
3434
|
-
function
|
|
3435
|
-
var
|
|
3436
|
-
|
|
3437
|
-
sign = void 0,
|
|
3438
|
-
hours = void 0,
|
|
3439
|
-
minutes = void 0;
|
|
3440
|
-
if (!iso8601Parts) {
|
|
3441
|
-
str = str.toLowerCase();
|
|
3442
|
-
timezone = str.match(/(?:\s|gmt\s*)(-|\+)(\d{1,4})(\s|$)/);
|
|
3443
|
-
if (!timezone) {
|
|
3444
|
-
return str.indexOf('gmt') !== -1 ? 0 : null;
|
|
3445
|
-
}
|
|
3446
|
-
sign = timezone[1];
|
|
3447
|
-
var offset = timezone[2];
|
|
3448
|
-
if (offset.length === 3) {
|
|
3449
|
-
offset = '0' + offset;
|
|
3450
|
-
}
|
|
3451
|
-
if (offset.length <= 2) {
|
|
3452
|
-
hours = 0;
|
|
3453
|
-
minutes = parseInt(offset, 10);
|
|
3454
|
-
} else {
|
|
3455
|
-
hours = parseInt(offset.slice(0, 2), 10);
|
|
3456
|
-
minutes = parseInt(offset.slice(2, 4), 10);
|
|
3457
|
-
}
|
|
3458
|
-
} else {
|
|
3459
|
-
timezone = iso8601Parts[21];
|
|
3460
|
-
if (!timezone) {
|
|
3461
|
-
// if no hour/minute was provided, the date is GMT
|
|
3462
|
-
return !iso8601Parts[12] ? 0 : null;
|
|
3463
|
-
}
|
|
3464
|
-
if (timezone === 'z' || timezone === 'Z') {
|
|
3465
|
-
return 0;
|
|
3466
|
-
}
|
|
3467
|
-
sign = iso8601Parts[22];
|
|
3468
|
-
if (timezone.indexOf(':') !== -1) {
|
|
3469
|
-
hours = parseInt(iso8601Parts[23], 10);
|
|
3470
|
-
minutes = parseInt(iso8601Parts[24], 10);
|
|
3471
|
-
} else {
|
|
3472
|
-
hours = 0;
|
|
3473
|
-
minutes = parseInt(iso8601Parts[23], 10);
|
|
3474
|
-
}
|
|
3475
|
-
}
|
|
3476
|
-
return (hours * 60 + minutes) * (sign === '-' ? 1 : -1);
|
|
3477
|
-
}
|
|
3478
|
-
|
|
3479
|
-
function isDate(str) {
|
|
3480
|
-
(0, _assertString2.default)(str);
|
|
3481
|
-
var normalizedDate = new Date(Date.parse(str));
|
|
3482
|
-
if (isNaN(normalizedDate)) {
|
|
3483
|
-
return false;
|
|
3484
|
-
}
|
|
3485
|
-
|
|
3486
|
-
// normalizedDate is in the user's timezone. Apply the input
|
|
3487
|
-
// timezone offset to the date so that the year and day match
|
|
3488
|
-
// the input
|
|
3489
|
-
var timezoneOffset = getTimezoneOffset(str);
|
|
3490
|
-
if (timezoneOffset !== null) {
|
|
3491
|
-
var timezoneDifference = normalizedDate.getTimezoneOffset() - timezoneOffset;
|
|
3492
|
-
normalizedDate = new Date(normalizedDate.getTime() + 60000 * timezoneDifference);
|
|
3493
|
-
}
|
|
3494
|
-
|
|
3495
|
-
var day = String(normalizedDate.getDate());
|
|
3496
|
-
var dayOrYear = void 0,
|
|
3497
|
-
dayOrYearMatches = void 0,
|
|
3498
|
-
year = void 0;
|
|
3499
|
-
// check for valid double digits that could be late days
|
|
3500
|
-
// check for all matches since a string like '12/23' is a valid date
|
|
3501
|
-
// ignore everything with nearby colons
|
|
3502
|
-
dayOrYearMatches = str.match(/(^|[^:\d])[23]\d([^:\d]|$)/g);
|
|
3503
|
-
if (!dayOrYearMatches) {
|
|
3504
|
-
return true;
|
|
3505
|
-
}
|
|
3506
|
-
dayOrYear = dayOrYearMatches.map(function (digitString) {
|
|
3507
|
-
return digitString.match(/\d+/g)[0];
|
|
3508
|
-
}).join('/');
|
|
3509
|
-
|
|
3510
|
-
year = String(normalizedDate.getFullYear()).slice(-2);
|
|
3511
|
-
if (dayOrYear === day || dayOrYear === year) {
|
|
3512
|
-
return true;
|
|
3513
|
-
} else if (dayOrYear === '' + day / year || dayOrYear === '' + year / day) {
|
|
3514
|
-
return true;
|
|
3515
|
-
}
|
|
3516
|
-
return false;
|
|
3880
|
+
function decimalRegExp(options) {
|
|
3881
|
+
var regExp = new RegExp('^[-+]?([0-9]+)?(\\' + _alpha.decimal[options.locale] + '[0-9]{' + options.decimal_digits + '})' + (options.force_decimal ? '' : '?') + '$');
|
|
3882
|
+
return regExp;
|
|
3517
3883
|
}
|
|
3518
|
-
module.exports = exports['default'];
|
|
3519
|
-
},{"./isISO8601":35,"./util/assertString":64}],23:[function(require,module,exports){
|
|
3520
|
-
'use strict';
|
|
3521
|
-
|
|
3522
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3523
|
-
value: true
|
|
3524
|
-
});
|
|
3525
|
-
exports.default = isDecimal;
|
|
3526
|
-
|
|
3527
|
-
var _assertString = require('./util/assertString');
|
|
3528
|
-
|
|
3529
|
-
var _assertString2 = _interopRequireDefault(_assertString);
|
|
3530
3884
|
|
|
3531
|
-
|
|
3885
|
+
var default_decimal_options = {
|
|
3886
|
+
force_decimal: false,
|
|
3887
|
+
decimal_digits: '1,',
|
|
3888
|
+
locale: 'en-US'
|
|
3889
|
+
};
|
|
3532
3890
|
|
|
3533
|
-
var
|
|
3891
|
+
var blacklist = ['', '-', '+'];
|
|
3534
3892
|
|
|
3535
|
-
function isDecimal(str) {
|
|
3893
|
+
function isDecimal(str, options) {
|
|
3536
3894
|
(0, _assertString2.default)(str);
|
|
3537
|
-
|
|
3895
|
+
options = (0, _merge2.default)(options, default_decimal_options);
|
|
3896
|
+
if (options.locale in _alpha.decimal) {
|
|
3897
|
+
return !blacklist.includes(str.replace(/ /g, '')) && decimalRegExp(options).test(str);
|
|
3898
|
+
}
|
|
3899
|
+
throw new Error('Invalid locale \'' + options.locale + '\'');
|
|
3538
3900
|
}
|
|
3539
3901
|
module.exports = exports['default'];
|
|
3540
|
-
},{"./util/assertString":
|
|
3902
|
+
},{"./alpha":5,"./util/assertString":70,"./util/merge":71}],22:[function(require,module,exports){
|
|
3541
3903
|
'use strict';
|
|
3542
3904
|
|
|
3543
3905
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3560,7 +3922,7 @@ function isDivisibleBy(str, num) {
|
|
|
3560
3922
|
return (0, _toFloat2.default)(str) % parseInt(num, 10) === 0;
|
|
3561
3923
|
}
|
|
3562
3924
|
module.exports = exports['default'];
|
|
3563
|
-
},{"./toFloat":
|
|
3925
|
+
},{"./toFloat":66,"./util/assertString":70}],23:[function(require,module,exports){
|
|
3564
3926
|
'use strict';
|
|
3565
3927
|
|
|
3566
3928
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3588,26 +3950,31 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
3588
3950
|
|
|
3589
3951
|
var default_email_options = {
|
|
3590
3952
|
allow_display_name: false,
|
|
3953
|
+
require_display_name: false,
|
|
3591
3954
|
allow_utf8_local_part: true,
|
|
3592
3955
|
require_tld: true
|
|
3593
3956
|
};
|
|
3594
3957
|
|
|
3595
3958
|
/* eslint-disable max-len */
|
|
3596
|
-
|
|
3959
|
+
/* eslint-disable no-control-regex */
|
|
3960
|
+
var displayName = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\,\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF\s]*<(.+)>$/i;
|
|
3597
3961
|
var emailUserPart = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i;
|
|
3598
3962
|
var quotedEmailUser = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i;
|
|
3599
3963
|
var emailUserUtf8Part = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i;
|
|
3600
3964
|
var quotedEmailUserUtf8 = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i;
|
|
3601
3965
|
/* eslint-enable max-len */
|
|
3966
|
+
/* eslint-enable no-control-regex */
|
|
3602
3967
|
|
|
3603
3968
|
function isEmail(str, options) {
|
|
3604
3969
|
(0, _assertString2.default)(str);
|
|
3605
3970
|
options = (0, _merge2.default)(options, default_email_options);
|
|
3606
3971
|
|
|
3607
|
-
if (options.allow_display_name) {
|
|
3972
|
+
if (options.require_display_name || options.allow_display_name) {
|
|
3608
3973
|
var display_email = str.match(displayName);
|
|
3609
3974
|
if (display_email) {
|
|
3610
3975
|
str = display_email[1];
|
|
3976
|
+
} else if (options.require_display_name) {
|
|
3977
|
+
return false;
|
|
3611
3978
|
}
|
|
3612
3979
|
}
|
|
3613
3980
|
|
|
@@ -3620,7 +3987,7 @@ function isEmail(str, options) {
|
|
|
3620
3987
|
user = user.replace(/\./g, '').toLowerCase();
|
|
3621
3988
|
}
|
|
3622
3989
|
|
|
3623
|
-
if (!(0, _isByteLength2.default)(user, { max: 64 }) || !(0, _isByteLength2.default)(domain, { max:
|
|
3990
|
+
if (!(0, _isByteLength2.default)(user, { max: 64 }) || !(0, _isByteLength2.default)(domain, { max: 254 })) {
|
|
3624
3991
|
return false;
|
|
3625
3992
|
}
|
|
3626
3993
|
|
|
@@ -3645,7 +4012,26 @@ function isEmail(str, options) {
|
|
|
3645
4012
|
return true;
|
|
3646
4013
|
}
|
|
3647
4014
|
module.exports = exports['default'];
|
|
3648
|
-
},{"./isByteLength":
|
|
4015
|
+
},{"./isByteLength":17,"./isFQDN":25,"./util/assertString":70,"./util/merge":71}],24:[function(require,module,exports){
|
|
4016
|
+
'use strict';
|
|
4017
|
+
|
|
4018
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4019
|
+
value: true
|
|
4020
|
+
});
|
|
4021
|
+
exports.default = isEmpty;
|
|
4022
|
+
|
|
4023
|
+
var _assertString = require('./util/assertString');
|
|
4024
|
+
|
|
4025
|
+
var _assertString2 = _interopRequireDefault(_assertString);
|
|
4026
|
+
|
|
4027
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
4028
|
+
|
|
4029
|
+
function isEmpty(str) {
|
|
4030
|
+
(0, _assertString2.default)(str);
|
|
4031
|
+
return str.length === 0;
|
|
4032
|
+
}
|
|
4033
|
+
module.exports = exports['default'];
|
|
4034
|
+
},{"./util/assertString":70}],25:[function(require,module,exports){
|
|
3649
4035
|
'use strict';
|
|
3650
4036
|
|
|
3651
4037
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3683,6 +4069,10 @@ function isFDQN(str, options) {
|
|
|
3683
4069
|
if (!parts.length || !/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {
|
|
3684
4070
|
return false;
|
|
3685
4071
|
}
|
|
4072
|
+
// disallow spaces
|
|
4073
|
+
if (/[\s\u2002-\u200B\u202F\u205F\u3000\uFEFF\uDB40\uDC20]/.test(tld)) {
|
|
4074
|
+
return false;
|
|
4075
|
+
}
|
|
3686
4076
|
}
|
|
3687
4077
|
for (var part, i = 0; i < parts.length; i++) {
|
|
3688
4078
|
part = parts[i];
|
|
@@ -3692,8 +4082,8 @@ function isFDQN(str, options) {
|
|
|
3692
4082
|
if (!/^[a-z\u00a1-\uffff0-9-]+$/i.test(part)) {
|
|
3693
4083
|
return false;
|
|
3694
4084
|
}
|
|
4085
|
+
// disallow full-width chars
|
|
3695
4086
|
if (/[\uff01-\uff5e]/.test(part)) {
|
|
3696
|
-
// disallow full-width chars
|
|
3697
4087
|
return false;
|
|
3698
4088
|
}
|
|
3699
4089
|
if (part[0] === '-' || part[part.length - 1] === '-') {
|
|
@@ -3703,7 +4093,7 @@ function isFDQN(str, options) {
|
|
|
3703
4093
|
return true;
|
|
3704
4094
|
}
|
|
3705
4095
|
module.exports = exports['default'];
|
|
3706
|
-
},{"./util/assertString":
|
|
4096
|
+
},{"./util/assertString":70,"./util/merge":71}],26:[function(require,module,exports){
|
|
3707
4097
|
'use strict';
|
|
3708
4098
|
|
|
3709
4099
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3715,20 +4105,21 @@ var _assertString = require('./util/assertString');
|
|
|
3715
4105
|
|
|
3716
4106
|
var _assertString2 = _interopRequireDefault(_assertString);
|
|
3717
4107
|
|
|
3718
|
-
|
|
4108
|
+
var _alpha = require('./alpha');
|
|
3719
4109
|
|
|
3720
|
-
|
|
4110
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
3721
4111
|
|
|
3722
4112
|
function isFloat(str, options) {
|
|
3723
4113
|
(0, _assertString2.default)(str);
|
|
3724
4114
|
options = options || {};
|
|
4115
|
+
var float = new RegExp('^(?:[-+])?(?:[0-9]+)?(?:\\' + (options.locale ? _alpha.decimal[options.locale] : '.') + '[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$');
|
|
3725
4116
|
if (str === '' || str === '.') {
|
|
3726
4117
|
return false;
|
|
3727
4118
|
}
|
|
3728
|
-
return float.test(str) && (!options.hasOwnProperty('min') || str >= options.min) && (!options.hasOwnProperty('max') || str <= options.max);
|
|
4119
|
+
return float.test(str) && (!options.hasOwnProperty('min') || str >= options.min) && (!options.hasOwnProperty('max') || str <= options.max) && (!options.hasOwnProperty('lt') || str < options.lt) && (!options.hasOwnProperty('gt') || str > options.gt);
|
|
3729
4120
|
}
|
|
3730
4121
|
module.exports = exports['default'];
|
|
3731
|
-
},{"./util/assertString":
|
|
4122
|
+
},{"./alpha":5,"./util/assertString":70}],27:[function(require,module,exports){
|
|
3732
4123
|
'use strict';
|
|
3733
4124
|
|
|
3734
4125
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3747,16 +4138,36 @@ var fullWidth = exports.fullWidth = /[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\u
|
|
|
3747
4138
|
|
|
3748
4139
|
function isFullWidth(str) {
|
|
3749
4140
|
(0, _assertString2.default)(str);
|
|
3750
|
-
return fullWidth.test(str);
|
|
4141
|
+
return fullWidth.test(str);
|
|
4142
|
+
}
|
|
4143
|
+
},{"./util/assertString":70}],28:[function(require,module,exports){
|
|
4144
|
+
'use strict';
|
|
4145
|
+
|
|
4146
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4147
|
+
value: true
|
|
4148
|
+
});
|
|
4149
|
+
exports.halfWidth = undefined;
|
|
4150
|
+
exports.default = isHalfWidth;
|
|
4151
|
+
|
|
4152
|
+
var _assertString = require('./util/assertString');
|
|
4153
|
+
|
|
4154
|
+
var _assertString2 = _interopRequireDefault(_assertString);
|
|
4155
|
+
|
|
4156
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
4157
|
+
|
|
4158
|
+
var halfWidth = exports.halfWidth = /[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/;
|
|
4159
|
+
|
|
4160
|
+
function isHalfWidth(str) {
|
|
4161
|
+
(0, _assertString2.default)(str);
|
|
4162
|
+
return halfWidth.test(str);
|
|
3751
4163
|
}
|
|
3752
|
-
},{"./util/assertString":
|
|
4164
|
+
},{"./util/assertString":70}],29:[function(require,module,exports){
|
|
3753
4165
|
'use strict';
|
|
3754
4166
|
|
|
3755
4167
|
Object.defineProperty(exports, "__esModule", {
|
|
3756
4168
|
value: true
|
|
3757
4169
|
});
|
|
3758
|
-
exports.
|
|
3759
|
-
exports.default = isHalfWidth;
|
|
4170
|
+
exports.default = isHash;
|
|
3760
4171
|
|
|
3761
4172
|
var _assertString = require('./util/assertString');
|
|
3762
4173
|
|
|
@@ -3764,13 +4175,29 @@ var _assertString2 = _interopRequireDefault(_assertString);
|
|
|
3764
4175
|
|
|
3765
4176
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
3766
4177
|
|
|
3767
|
-
var
|
|
4178
|
+
var lengths = {
|
|
4179
|
+
md5: 32,
|
|
4180
|
+
md4: 32,
|
|
4181
|
+
sha1: 40,
|
|
4182
|
+
sha256: 64,
|
|
4183
|
+
sha384: 96,
|
|
4184
|
+
sha512: 128,
|
|
4185
|
+
ripemd128: 32,
|
|
4186
|
+
ripemd160: 40,
|
|
4187
|
+
tiger128: 32,
|
|
4188
|
+
tiger160: 40,
|
|
4189
|
+
tiger192: 48,
|
|
4190
|
+
crc32: 8,
|
|
4191
|
+
crc32b: 8
|
|
4192
|
+
};
|
|
3768
4193
|
|
|
3769
|
-
function
|
|
4194
|
+
function isHash(str, algorithm) {
|
|
3770
4195
|
(0, _assertString2.default)(str);
|
|
3771
|
-
|
|
4196
|
+
var hash = new RegExp('^[a-f0-9]{' + lengths[algorithm] + '}$');
|
|
4197
|
+
return hash.test(str);
|
|
3772
4198
|
}
|
|
3773
|
-
|
|
4199
|
+
module.exports = exports['default'];
|
|
4200
|
+
},{"./util/assertString":70}],30:[function(require,module,exports){
|
|
3774
4201
|
'use strict';
|
|
3775
4202
|
|
|
3776
4203
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3791,7 +4218,7 @@ function isHexColor(str) {
|
|
|
3791
4218
|
return hexcolor.test(str);
|
|
3792
4219
|
}
|
|
3793
4220
|
module.exports = exports['default'];
|
|
3794
|
-
},{"./util/assertString":
|
|
4221
|
+
},{"./util/assertString":70}],31:[function(require,module,exports){
|
|
3795
4222
|
'use strict';
|
|
3796
4223
|
|
|
3797
4224
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3812,7 +4239,7 @@ function isHexadecimal(str) {
|
|
|
3812
4239
|
return hexadecimal.test(str);
|
|
3813
4240
|
}
|
|
3814
4241
|
module.exports = exports['default'];
|
|
3815
|
-
},{"./util/assertString":
|
|
4242
|
+
},{"./util/assertString":70}],32:[function(require,module,exports){
|
|
3816
4243
|
'use strict';
|
|
3817
4244
|
|
|
3818
4245
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3830,7 +4257,7 @@ var ipv4Maybe = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
|
|
|
3830
4257
|
var ipv6Block = /^[0-9A-F]{1,4}$/i;
|
|
3831
4258
|
|
|
3832
4259
|
function isIP(str) {
|
|
3833
|
-
var version = arguments.length
|
|
4260
|
+
var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
3834
4261
|
|
|
3835
4262
|
(0, _assertString2.default)(str);
|
|
3836
4263
|
version = String(version);
|
|
@@ -3883,8 +4310,8 @@ function isIP(str) {
|
|
|
3883
4310
|
// it has been checked before that the last
|
|
3884
4311
|
// block is a valid IPv4 address
|
|
3885
4312
|
} else if (!ipv6Block.test(blocks[i])) {
|
|
3886
|
-
|
|
3887
|
-
|
|
4313
|
+
return false;
|
|
4314
|
+
}
|
|
3888
4315
|
}
|
|
3889
4316
|
if (foundOmissionBlock) {
|
|
3890
4317
|
return blocks.length >= 1;
|
|
@@ -3894,7 +4321,7 @@ function isIP(str) {
|
|
|
3894
4321
|
return false;
|
|
3895
4322
|
}
|
|
3896
4323
|
module.exports = exports['default'];
|
|
3897
|
-
},{"./util/assertString":
|
|
4324
|
+
},{"./util/assertString":70}],33:[function(require,module,exports){
|
|
3898
4325
|
'use strict';
|
|
3899
4326
|
|
|
3900
4327
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -3913,7 +4340,7 @@ var isbn13Maybe = /^(?:[0-9]{13})$/;
|
|
|
3913
4340
|
var factor = [1, 3];
|
|
3914
4341
|
|
|
3915
4342
|
function isISBN(str) {
|
|
3916
|
-
var version = arguments.length
|
|
4343
|
+
var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
3917
4344
|
|
|
3918
4345
|
(0, _assertString2.default)(str);
|
|
3919
4346
|
version = String(version);
|
|
@@ -3952,7 +4379,7 @@ function isISBN(str) {
|
|
|
3952
4379
|
return false;
|
|
3953
4380
|
}
|
|
3954
4381
|
module.exports = exports['default'];
|
|
3955
|
-
},{"./util/assertString":
|
|
4382
|
+
},{"./util/assertString":70}],34:[function(require,module,exports){
|
|
3956
4383
|
'use strict';
|
|
3957
4384
|
|
|
3958
4385
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4001,18 +4428,35 @@ function isISIN(str) {
|
|
|
4001
4428
|
return parseInt(str.substr(str.length - 1), 10) === (10000 - sum) % 10;
|
|
4002
4429
|
}
|
|
4003
4430
|
module.exports = exports['default'];
|
|
4004
|
-
},{"./util/assertString":
|
|
4431
|
+
},{"./util/assertString":70}],35:[function(require,module,exports){
|
|
4005
4432
|
'use strict';
|
|
4006
4433
|
|
|
4007
4434
|
Object.defineProperty(exports, "__esModule", {
|
|
4008
4435
|
value: true
|
|
4009
4436
|
});
|
|
4010
|
-
exports.
|
|
4437
|
+
exports.default = isISO31661Alpha2;
|
|
4011
4438
|
|
|
4012
|
-
|
|
4439
|
+
var _assertString = require('./util/assertString');
|
|
4440
|
+
|
|
4441
|
+
var _assertString2 = _interopRequireDefault(_assertString);
|
|
4442
|
+
|
|
4443
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
4444
|
+
|
|
4445
|
+
// from https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
|
4446
|
+
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'];
|
|
4447
|
+
|
|
4448
|
+
function isISO31661Alpha2(str) {
|
|
4013
4449
|
(0, _assertString2.default)(str);
|
|
4014
|
-
return
|
|
4015
|
-
}
|
|
4450
|
+
return validISO31661Alpha2CountriesCodes.includes(str.toUpperCase());
|
|
4451
|
+
}
|
|
4452
|
+
module.exports = exports['default'];
|
|
4453
|
+
},{"./util/assertString":70}],36:[function(require,module,exports){
|
|
4454
|
+
'use strict';
|
|
4455
|
+
|
|
4456
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4457
|
+
value: true
|
|
4458
|
+
});
|
|
4459
|
+
exports.default = isISO8601;
|
|
4016
4460
|
|
|
4017
4461
|
var _assertString = require('./util/assertString');
|
|
4018
4462
|
|
|
@@ -4022,16 +4466,103 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
4022
4466
|
|
|
4023
4467
|
/* eslint-disable max-len */
|
|
4024
4468
|
// from http://goo.gl/0ejHHW
|
|
4025
|
-
var iso8601 =
|
|
4469
|
+
var iso8601 = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;
|
|
4026
4470
|
/* eslint-enable max-len */
|
|
4027
|
-
|
|
4471
|
+
|
|
4472
|
+
function isISO8601(str) {
|
|
4473
|
+
(0, _assertString2.default)(str);
|
|
4474
|
+
return iso8601.test(str);
|
|
4475
|
+
}
|
|
4476
|
+
module.exports = exports['default'];
|
|
4477
|
+
},{"./util/assertString":70}],37:[function(require,module,exports){
|
|
4478
|
+
'use strict';
|
|
4479
|
+
|
|
4480
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4481
|
+
value: true
|
|
4482
|
+
});
|
|
4483
|
+
exports.default = isISRC;
|
|
4484
|
+
|
|
4485
|
+
var _assertString = require('./util/assertString');
|
|
4486
|
+
|
|
4487
|
+
var _assertString2 = _interopRequireDefault(_assertString);
|
|
4488
|
+
|
|
4489
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
4490
|
+
|
|
4491
|
+
// see http://isrc.ifpi.org/en/isrc-standard/code-syntax
|
|
4492
|
+
var isrc = /^[A-Z]{2}[0-9A-Z]{3}\d{2}\d{5}$/;
|
|
4493
|
+
|
|
4494
|
+
function isISRC(str) {
|
|
4495
|
+
(0, _assertString2.default)(str);
|
|
4496
|
+
return isrc.test(str);
|
|
4497
|
+
}
|
|
4498
|
+
module.exports = exports['default'];
|
|
4499
|
+
},{"./util/assertString":70}],38:[function(require,module,exports){
|
|
4500
|
+
'use strict';
|
|
4501
|
+
|
|
4502
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4503
|
+
value: true
|
|
4504
|
+
});
|
|
4505
|
+
exports.default = isISSN;
|
|
4506
|
+
|
|
4507
|
+
var _assertString = require('./util/assertString');
|
|
4508
|
+
|
|
4509
|
+
var _assertString2 = _interopRequireDefault(_assertString);
|
|
4510
|
+
|
|
4511
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
4512
|
+
|
|
4513
|
+
var issn = '^\\d{4}-?\\d{3}[\\dX]$';
|
|
4514
|
+
|
|
4515
|
+
function isISSN(str) {
|
|
4516
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
4517
|
+
|
|
4518
|
+
(0, _assertString2.default)(str);
|
|
4519
|
+
var testIssn = issn;
|
|
4520
|
+
testIssn = options.require_hyphen ? testIssn.replace('?', '') : testIssn;
|
|
4521
|
+
testIssn = options.case_sensitive ? new RegExp(testIssn) : new RegExp(testIssn, 'i');
|
|
4522
|
+
if (!testIssn.test(str)) {
|
|
4523
|
+
return false;
|
|
4524
|
+
}
|
|
4525
|
+
var issnDigits = str.replace('-', '');
|
|
4526
|
+
var position = 8;
|
|
4527
|
+
var checksum = 0;
|
|
4528
|
+
var _iteratorNormalCompletion = true;
|
|
4529
|
+
var _didIteratorError = false;
|
|
4530
|
+
var _iteratorError = undefined;
|
|
4531
|
+
|
|
4532
|
+
try {
|
|
4533
|
+
for (var _iterator = issnDigits[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
4534
|
+
var digit = _step.value;
|
|
4535
|
+
|
|
4536
|
+
var digitValue = digit.toUpperCase() === 'X' ? 10 : +digit;
|
|
4537
|
+
checksum += digitValue * position;
|
|
4538
|
+
--position;
|
|
4539
|
+
}
|
|
4540
|
+
} catch (err) {
|
|
4541
|
+
_didIteratorError = true;
|
|
4542
|
+
_iteratorError = err;
|
|
4543
|
+
} finally {
|
|
4544
|
+
try {
|
|
4545
|
+
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
4546
|
+
_iterator.return();
|
|
4547
|
+
}
|
|
4548
|
+
} finally {
|
|
4549
|
+
if (_didIteratorError) {
|
|
4550
|
+
throw _iteratorError;
|
|
4551
|
+
}
|
|
4552
|
+
}
|
|
4553
|
+
}
|
|
4554
|
+
|
|
4555
|
+
return checksum % 11 === 0;
|
|
4556
|
+
}
|
|
4557
|
+
module.exports = exports['default'];
|
|
4558
|
+
},{"./util/assertString":70}],39:[function(require,module,exports){
|
|
4028
4559
|
'use strict';
|
|
4029
4560
|
|
|
4030
4561
|
Object.defineProperty(exports, "__esModule", {
|
|
4031
4562
|
value: true
|
|
4032
4563
|
});
|
|
4033
4564
|
|
|
4034
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
|
|
4565
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
4035
4566
|
|
|
4036
4567
|
exports.default = isIn;
|
|
4037
4568
|
|
|
@@ -4064,7 +4595,7 @@ function isIn(str, options) {
|
|
|
4064
4595
|
return false;
|
|
4065
4596
|
}
|
|
4066
4597
|
module.exports = exports['default'];
|
|
4067
|
-
},{"./util/assertString":
|
|
4598
|
+
},{"./util/assertString":70,"./util/toString":72}],40:[function(require,module,exports){
|
|
4068
4599
|
'use strict';
|
|
4069
4600
|
|
|
4070
4601
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4079,21 +4610,33 @@ var _assertString2 = _interopRequireDefault(_assertString);
|
|
|
4079
4610
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
4080
4611
|
|
|
4081
4612
|
var int = /^(?:[-+]?(?:0|[1-9][0-9]*))$/;
|
|
4613
|
+
var intLeadingZeroes = /^[-+]?[0-9]+$/;
|
|
4082
4614
|
|
|
4083
4615
|
function isInt(str, options) {
|
|
4084
4616
|
(0, _assertString2.default)(str);
|
|
4085
4617
|
options = options || {};
|
|
4086
|
-
|
|
4618
|
+
|
|
4619
|
+
// Get the regex to use for testing, based on whether
|
|
4620
|
+
// leading zeroes are allowed or not.
|
|
4621
|
+
var regex = options.hasOwnProperty('allow_leading_zeroes') && !options.allow_leading_zeroes ? int : intLeadingZeroes;
|
|
4622
|
+
|
|
4623
|
+
// Check min/max/lt/gt
|
|
4624
|
+
var minCheckPassed = !options.hasOwnProperty('min') || str >= options.min;
|
|
4625
|
+
var maxCheckPassed = !options.hasOwnProperty('max') || str <= options.max;
|
|
4626
|
+
var ltCheckPassed = !options.hasOwnProperty('lt') || str < options.lt;
|
|
4627
|
+
var gtCheckPassed = !options.hasOwnProperty('gt') || str > options.gt;
|
|
4628
|
+
|
|
4629
|
+
return regex.test(str) && minCheckPassed && maxCheckPassed && ltCheckPassed && gtCheckPassed;
|
|
4087
4630
|
}
|
|
4088
4631
|
module.exports = exports['default'];
|
|
4089
|
-
},{"./util/assertString":
|
|
4632
|
+
},{"./util/assertString":70}],41:[function(require,module,exports){
|
|
4090
4633
|
'use strict';
|
|
4091
4634
|
|
|
4092
4635
|
Object.defineProperty(exports, "__esModule", {
|
|
4093
4636
|
value: true
|
|
4094
4637
|
});
|
|
4095
4638
|
|
|
4096
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
|
|
4639
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
4097
4640
|
|
|
4098
4641
|
exports.default = isJSON;
|
|
4099
4642
|
|
|
@@ -4112,14 +4655,38 @@ function isJSON(str) {
|
|
|
4112
4655
|
return false;
|
|
4113
4656
|
}
|
|
4114
4657
|
module.exports = exports['default'];
|
|
4115
|
-
},{"./util/assertString":
|
|
4658
|
+
},{"./util/assertString":70}],42:[function(require,module,exports){
|
|
4659
|
+
'use strict';
|
|
4660
|
+
|
|
4661
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4662
|
+
value: true
|
|
4663
|
+
});
|
|
4664
|
+
|
|
4665
|
+
exports.default = function (str) {
|
|
4666
|
+
(0, _assertString2.default)(str);
|
|
4667
|
+
if (!str.includes(',')) return false;
|
|
4668
|
+
var pair = str.split(',');
|
|
4669
|
+
return lat.test(pair[0]) && long.test(pair[1]);
|
|
4670
|
+
};
|
|
4671
|
+
|
|
4672
|
+
var _assertString = require('./util/assertString');
|
|
4673
|
+
|
|
4674
|
+
var _assertString2 = _interopRequireDefault(_assertString);
|
|
4675
|
+
|
|
4676
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
4677
|
+
|
|
4678
|
+
var lat = /^\(?[+-]?(90(\.0+)?|[1-8]?\d(\.\d+)?)$/;
|
|
4679
|
+
var long = /^\s?[+-]?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)\)?$/;
|
|
4680
|
+
|
|
4681
|
+
module.exports = exports['default'];
|
|
4682
|
+
},{"./util/assertString":70}],43:[function(require,module,exports){
|
|
4116
4683
|
'use strict';
|
|
4117
4684
|
|
|
4118
4685
|
Object.defineProperty(exports, "__esModule", {
|
|
4119
4686
|
value: true
|
|
4120
4687
|
});
|
|
4121
4688
|
|
|
4122
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
|
|
4689
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
4123
4690
|
|
|
4124
4691
|
exports.default = isLength;
|
|
4125
4692
|
|
|
@@ -4147,7 +4714,7 @@ function isLength(str, options) {
|
|
|
4147
4714
|
return len >= min && (typeof max === 'undefined' || len <= max);
|
|
4148
4715
|
}
|
|
4149
4716
|
module.exports = exports['default'];
|
|
4150
|
-
},{"./util/assertString":
|
|
4717
|
+
},{"./util/assertString":70}],44:[function(require,module,exports){
|
|
4151
4718
|
'use strict';
|
|
4152
4719
|
|
|
4153
4720
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4166,7 +4733,7 @@ function isLowercase(str) {
|
|
|
4166
4733
|
return str === str.toLowerCase();
|
|
4167
4734
|
}
|
|
4168
4735
|
module.exports = exports['default'];
|
|
4169
|
-
},{"./util/assertString":
|
|
4736
|
+
},{"./util/assertString":70}],45:[function(require,module,exports){
|
|
4170
4737
|
'use strict';
|
|
4171
4738
|
|
|
4172
4739
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4187,7 +4754,28 @@ function isMACAddress(str) {
|
|
|
4187
4754
|
return macAddress.test(str);
|
|
4188
4755
|
}
|
|
4189
4756
|
module.exports = exports['default'];
|
|
4190
|
-
},{"./util/assertString":
|
|
4757
|
+
},{"./util/assertString":70}],46:[function(require,module,exports){
|
|
4758
|
+
'use strict';
|
|
4759
|
+
|
|
4760
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4761
|
+
value: true
|
|
4762
|
+
});
|
|
4763
|
+
exports.default = isMD5;
|
|
4764
|
+
|
|
4765
|
+
var _assertString = require('./util/assertString');
|
|
4766
|
+
|
|
4767
|
+
var _assertString2 = _interopRequireDefault(_assertString);
|
|
4768
|
+
|
|
4769
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
4770
|
+
|
|
4771
|
+
var md5 = /^[a-f0-9]{32}$/;
|
|
4772
|
+
|
|
4773
|
+
function isMD5(str) {
|
|
4774
|
+
(0, _assertString2.default)(str);
|
|
4775
|
+
return md5.test(str);
|
|
4776
|
+
}
|
|
4777
|
+
module.exports = exports['default'];
|
|
4778
|
+
},{"./util/assertString":70}],47:[function(require,module,exports){
|
|
4191
4779
|
'use strict';
|
|
4192
4780
|
|
|
4193
4781
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4203,43 +4791,87 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
4203
4791
|
|
|
4204
4792
|
/* eslint-disable max-len */
|
|
4205
4793
|
var phones = {
|
|
4794
|
+
'ar-AE': /^((\+?971)|0)?5[024568]\d{7}$/,
|
|
4795
|
+
'ar-DZ': /^(\+?213|0)(5|6|7)\d{8}$/,
|
|
4796
|
+
'ar-EG': /^((\+?20)|0)?1[012]\d{8}$/,
|
|
4797
|
+
'ar-JO': /^(\+?962|0)?7[789]\d{7}$/,
|
|
4798
|
+
'ar-SA': /^(!?(\+?966)|0)?5\d{8}$/,
|
|
4206
4799
|
'ar-SY': /^(!?(\+?963)|0)?9\d{8}$/,
|
|
4207
|
-
'en-US': /^(\+?1)?[2-9]\d{2}[2-9](?!11)\d{6}$/,
|
|
4208
4800
|
'cs-CZ': /^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,
|
|
4801
|
+
'da-DK': /^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/,
|
|
4209
4802
|
'de-DE': /^(\+?49[ \.\-])?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,
|
|
4210
4803
|
'el-GR': /^(\+?30)?(69\d{8})$/,
|
|
4211
4804
|
'en-AU': /^(\+?61|0)4\d{8}$/,
|
|
4212
4805
|
'en-GB': /^(\+?44|0)7\d{9}$/,
|
|
4213
|
-
'en-HK': /^(\+?852\-?)?[
|
|
4806
|
+
'en-HK': /^(\+?852\-?)?[456789]\d{3}\-?\d{4}$/,
|
|
4214
4807
|
'en-IN': /^(\+?91|0)?[789]\d{9}$/,
|
|
4808
|
+
'en-KE': /^(\+?254|0)?[7]\d{8}$/,
|
|
4809
|
+
'en-NG': /^(\+?234|0)?[789]\d{9}$/,
|
|
4215
4810
|
'en-NZ': /^(\+?64|0)2\d{7,9}$/,
|
|
4811
|
+
'en-PK': /^((\+92)|(0092))-{0,1}\d{3}-{0,1}\d{7}$|^\d{11}$|^\d{4}-\d{7}$/,
|
|
4812
|
+
'en-RW': /^(\+?250|0)?[7]\d{8}$/,
|
|
4813
|
+
'en-TZ': /^(\+?255|0)?[67]\d{8}$/,
|
|
4814
|
+
'en-UG': /^(\+?256|0)?[7]\d{8}$/,
|
|
4815
|
+
'en-US': /^(\+?1)?[2-9]\d{2}[2-9](?!11)\d{6}$/,
|
|
4216
4816
|
'en-ZA': /^(\+?27|0)\d{9}$/,
|
|
4217
4817
|
'en-ZM': /^(\+?26)?09[567]\d{7}$/,
|
|
4218
4818
|
'es-ES': /^(\+?34)?(6\d{1}|7[1234])\d{7}$/,
|
|
4219
|
-
'
|
|
4819
|
+
'et-EE': /^(\+?372)?\s?(5|8[1-4])\s?([0-9]\s?){6,7}$/,
|
|
4820
|
+
'fa-IR': /^(\+?98[\-\s]?|0)9[0-39]\d[\-\s]?\d{3}[\-\s]?\d{4}$/,
|
|
4821
|
+
'fi-FI': /^(\+?358|0)\s?(4(0|1|2|4|5|6)?|50)\s?(\d\s?){4,8}\d$/,
|
|
4822
|
+
'fo-FO': /^(\+?298)?\s?\d{2}\s?\d{2}\s?\d{2}$/,
|
|
4220
4823
|
'fr-FR': /^(\+?33|0)[67]\d{8}$/,
|
|
4824
|
+
'he-IL': /^(\+972|0)([23489]|5[0248]|77)[1-9]\d{6}/,
|
|
4825
|
+
'hu-HU': /^(\+?36)(20|30|70)\d{7}$/,
|
|
4826
|
+
'id-ID': /^(\+?62|0[1-9])[\s|\d]+$/,
|
|
4827
|
+
'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/,
|
|
4828
|
+
'ja-JP': /^(\+?81|0)[789]0[ \-]?[1-9]\d{2}[ \-]?\d{5}$/,
|
|
4829
|
+
'kl-GL': /^(\+?299)?\s?\d{2}\s?\d{2}\s?\d{2}$/,
|
|
4830
|
+
'ko-KR': /^((\+?82)[ \-]?)?0?1([0|1|6|7|8|9]{1})[ \-]?\d{3,4}[ \-]?\d{4}$/,
|
|
4831
|
+
'lt-LT': /^(\+370|8)\d{8}$/,
|
|
4221
4832
|
'ms-MY': /^(\+?6?01){1}(([145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,
|
|
4222
4833
|
'nb-NO': /^(\+?47)?[49]\d{7}$/,
|
|
4834
|
+
'nl-BE': /^(\+?32|0)4?\d{8}$/,
|
|
4223
4835
|
'nn-NO': /^(\+?47)?[49]\d{7}$/,
|
|
4836
|
+
'pl-PL': /^(\+?48)? ?[5-8]\d ?\d{3} ?\d{2} ?\d{2}$/,
|
|
4224
4837
|
'pt-BR': /^(\+?55|0)\-?[1-9]{2}\-?[2-9]{1}\d{3,4}\-?\d{4}$/,
|
|
4225
4838
|
'pt-PT': /^(\+?351)?9[1236]\d{7}$/,
|
|
4839
|
+
'ro-RO': /^(\+?4?0)\s?7\d{2}(\/|\s|\.|\-)?\d{3}(\s|\.|\-)?\d{3}$/,
|
|
4226
4840
|
'ru-RU': /^(\+?7|8)?9\d{9}$/,
|
|
4841
|
+
'sk-SK': /^(\+?421)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,
|
|
4842
|
+
'sr-RS': /^(\+3816|06)[- \d]{5,9}$/,
|
|
4227
4843
|
'tr-TR': /^(\+?90|0)?5\d{9}$/,
|
|
4844
|
+
'uk-UA': /^(\+?38|8)?0\d{9}$/,
|
|
4228
4845
|
'vi-VN': /^(\+?84|0)?((1(2([0-9])|6([2-9])|88|99))|(9((?!5)[0-9])))([0-9]{7})$/,
|
|
4229
|
-
'zh-CN': /^(\+?0?86\-?)?
|
|
4846
|
+
'zh-CN': /^(\+?0?86\-?)?1[345789]\d{9}$/,
|
|
4230
4847
|
'zh-TW': /^(\+?886\-?|0)?9\d{8}$/
|
|
4231
4848
|
};
|
|
4232
4849
|
/* eslint-enable max-len */
|
|
4233
4850
|
|
|
4851
|
+
// aliases
|
|
4852
|
+
phones['en-CA'] = phones['en-US'];
|
|
4853
|
+
phones['fr-BE'] = phones['nl-BE'];
|
|
4854
|
+
phones['zh-HK'] = phones['en-HK'];
|
|
4855
|
+
|
|
4234
4856
|
function isMobilePhone(str, locale) {
|
|
4235
4857
|
(0, _assertString2.default)(str);
|
|
4236
4858
|
if (locale in phones) {
|
|
4237
4859
|
return phones[locale].test(str);
|
|
4860
|
+
} else if (locale === 'any') {
|
|
4861
|
+
for (var key in phones) {
|
|
4862
|
+
if (phones.hasOwnProperty(key)) {
|
|
4863
|
+
var phone = phones[key];
|
|
4864
|
+
if (phone.test(str)) {
|
|
4865
|
+
return true;
|
|
4866
|
+
}
|
|
4867
|
+
}
|
|
4868
|
+
}
|
|
4869
|
+
return false;
|
|
4238
4870
|
}
|
|
4239
|
-
|
|
4871
|
+
throw new Error('Invalid locale \'' + locale + '\'');
|
|
4240
4872
|
}
|
|
4241
4873
|
module.exports = exports['default'];
|
|
4242
|
-
},{"./util/assertString":
|
|
4874
|
+
},{"./util/assertString":70}],48:[function(require,module,exports){
|
|
4243
4875
|
'use strict';
|
|
4244
4876
|
|
|
4245
4877
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4262,7 +4894,7 @@ function isMongoId(str) {
|
|
|
4262
4894
|
return (0, _isHexadecimal2.default)(str) && str.length === 24;
|
|
4263
4895
|
}
|
|
4264
4896
|
module.exports = exports['default'];
|
|
4265
|
-
},{"./isHexadecimal":31,"./util/assertString":
|
|
4897
|
+
},{"./isHexadecimal":31,"./util/assertString":70}],49:[function(require,module,exports){
|
|
4266
4898
|
'use strict';
|
|
4267
4899
|
|
|
4268
4900
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4276,20 +4908,22 @@ var _assertString2 = _interopRequireDefault(_assertString);
|
|
|
4276
4908
|
|
|
4277
4909
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
4278
4910
|
|
|
4911
|
+
/* eslint-disable no-control-regex */
|
|
4279
4912
|
var multibyte = /[^\x00-\x7F]/;
|
|
4913
|
+
/* eslint-enable no-control-regex */
|
|
4280
4914
|
|
|
4281
4915
|
function isMultibyte(str) {
|
|
4282
4916
|
(0, _assertString2.default)(str);
|
|
4283
4917
|
return multibyte.test(str);
|
|
4284
4918
|
}
|
|
4285
4919
|
module.exports = exports['default'];
|
|
4286
|
-
},{"./util/assertString":
|
|
4920
|
+
},{"./util/assertString":70}],50:[function(require,module,exports){
|
|
4287
4921
|
'use strict';
|
|
4288
4922
|
|
|
4289
4923
|
Object.defineProperty(exports, "__esModule", {
|
|
4290
4924
|
value: true
|
|
4291
4925
|
});
|
|
4292
|
-
exports.default =
|
|
4926
|
+
exports.default = isNumeric;
|
|
4293
4927
|
|
|
4294
4928
|
var _assertString = require('./util/assertString');
|
|
4295
4929
|
|
|
@@ -4297,18 +4931,56 @@ var _assertString2 = _interopRequireDefault(_assertString);
|
|
|
4297
4931
|
|
|
4298
4932
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
4299
4933
|
|
|
4300
|
-
|
|
4934
|
+
var numeric = /^[-+]?[0-9]+$/;
|
|
4935
|
+
|
|
4936
|
+
function isNumeric(str) {
|
|
4301
4937
|
(0, _assertString2.default)(str);
|
|
4302
|
-
return str
|
|
4938
|
+
return numeric.test(str);
|
|
4303
4939
|
}
|
|
4304
4940
|
module.exports = exports['default'];
|
|
4305
|
-
},{"./util/assertString":
|
|
4941
|
+
},{"./util/assertString":70}],51:[function(require,module,exports){
|
|
4306
4942
|
'use strict';
|
|
4307
4943
|
|
|
4308
4944
|
Object.defineProperty(exports, "__esModule", {
|
|
4309
4945
|
value: true
|
|
4310
4946
|
});
|
|
4311
|
-
exports.default =
|
|
4947
|
+
exports.default = isPort;
|
|
4948
|
+
|
|
4949
|
+
var _isInt = require('./isInt');
|
|
4950
|
+
|
|
4951
|
+
var _isInt2 = _interopRequireDefault(_isInt);
|
|
4952
|
+
|
|
4953
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
4954
|
+
|
|
4955
|
+
function isPort(str) {
|
|
4956
|
+
return (0, _isInt2.default)(str, { min: 0, max: 65535 });
|
|
4957
|
+
}
|
|
4958
|
+
module.exports = exports['default'];
|
|
4959
|
+
},{"./isInt":40}],52:[function(require,module,exports){
|
|
4960
|
+
'use strict';
|
|
4961
|
+
|
|
4962
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4963
|
+
value: true
|
|
4964
|
+
});
|
|
4965
|
+
exports.locales = undefined;
|
|
4966
|
+
|
|
4967
|
+
exports.default = function (str, locale) {
|
|
4968
|
+
(0, _assertString2.default)(str);
|
|
4969
|
+
if (locale in patterns) {
|
|
4970
|
+
return patterns[locale].test(str);
|
|
4971
|
+
} else if (locale === 'any') {
|
|
4972
|
+
for (var key in patterns) {
|
|
4973
|
+
if (patterns.hasOwnProperty(key)) {
|
|
4974
|
+
var pattern = patterns[key];
|
|
4975
|
+
if (pattern.test(str)) {
|
|
4976
|
+
return true;
|
|
4977
|
+
}
|
|
4978
|
+
}
|
|
4979
|
+
}
|
|
4980
|
+
return false;
|
|
4981
|
+
}
|
|
4982
|
+
throw new Error('Invalid locale \'' + locale + '\'');
|
|
4983
|
+
};
|
|
4312
4984
|
|
|
4313
4985
|
var _assertString = require('./util/assertString');
|
|
4314
4986
|
|
|
@@ -4316,14 +4988,51 @@ var _assertString2 = _interopRequireDefault(_assertString);
|
|
|
4316
4988
|
|
|
4317
4989
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
4318
4990
|
|
|
4319
|
-
|
|
4991
|
+
// common patterns
|
|
4992
|
+
var threeDigit = /^\d{3}$/;
|
|
4993
|
+
var fourDigit = /^\d{4}$/;
|
|
4994
|
+
var fiveDigit = /^\d{5}$/;
|
|
4995
|
+
var sixDigit = /^\d{6}$/;
|
|
4996
|
+
|
|
4997
|
+
var patterns = {
|
|
4998
|
+
AT: fourDigit,
|
|
4999
|
+
AU: fourDigit,
|
|
5000
|
+
BE: fourDigit,
|
|
5001
|
+
CA: /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,
|
|
5002
|
+
CH: fourDigit,
|
|
5003
|
+
CZ: /^\d{3}\s?\d{2}$/,
|
|
5004
|
+
DE: fiveDigit,
|
|
5005
|
+
DK: fourDigit,
|
|
5006
|
+
DZ: fiveDigit,
|
|
5007
|
+
ES: fiveDigit,
|
|
5008
|
+
FI: fiveDigit,
|
|
5009
|
+
FR: /^\d{2}\s?\d{3}$/,
|
|
5010
|
+
GB: /^(gir\s?0aa|[a-z]{1,2}\d[\da-z]?\s?(\d[a-z]{2})?)$/i,
|
|
5011
|
+
GR: /^\d{3}\s?\d{2}$/,
|
|
5012
|
+
IL: fiveDigit,
|
|
5013
|
+
IN: sixDigit,
|
|
5014
|
+
IS: threeDigit,
|
|
5015
|
+
IT: fiveDigit,
|
|
5016
|
+
JP: /^\d{3}\-\d{4}$/,
|
|
5017
|
+
KE: fiveDigit,
|
|
5018
|
+
LI: /^(948[5-9]|949[0-7])$/,
|
|
5019
|
+
MX: fiveDigit,
|
|
5020
|
+
NL: /^\d{4}\s?[a-z]{2}$/i,
|
|
5021
|
+
NO: fourDigit,
|
|
5022
|
+
PL: /^\d{2}\-\d{3}$/,
|
|
5023
|
+
PT: /^\d{4}(\-\d{3})?$/,
|
|
5024
|
+
RO: sixDigit,
|
|
5025
|
+
RU: sixDigit,
|
|
5026
|
+
SA: fiveDigit,
|
|
5027
|
+
SE: /^\d{3}\s?\d{2}$/,
|
|
5028
|
+
TW: /^\d{3}(\d{2})?$/,
|
|
5029
|
+
US: /^\d{5}(-\d{4})?$/,
|
|
5030
|
+
ZA: fourDigit,
|
|
5031
|
+
ZM: fiveDigit
|
|
5032
|
+
};
|
|
4320
5033
|
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
return numeric.test(str);
|
|
4324
|
-
}
|
|
4325
|
-
module.exports = exports['default'];
|
|
4326
|
-
},{"./util/assertString":64}],47:[function(require,module,exports){
|
|
5034
|
+
var locales = exports.locales = Object.keys(patterns);
|
|
5035
|
+
},{"./util/assertString":70}],53:[function(require,module,exports){
|
|
4327
5036
|
'use strict';
|
|
4328
5037
|
|
|
4329
5038
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4344,7 +5053,7 @@ function isSurrogatePair(str) {
|
|
|
4344
5053
|
return surrogatePair.test(str);
|
|
4345
5054
|
}
|
|
4346
5055
|
module.exports = exports['default'];
|
|
4347
|
-
},{"./util/assertString":
|
|
5056
|
+
},{"./util/assertString":70}],54:[function(require,module,exports){
|
|
4348
5057
|
'use strict';
|
|
4349
5058
|
|
|
4350
5059
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4374,15 +5083,32 @@ var default_url_options = {
|
|
|
4374
5083
|
protocols: ['http', 'https', 'ftp'],
|
|
4375
5084
|
require_tld: true,
|
|
4376
5085
|
require_protocol: false,
|
|
5086
|
+
require_host: true,
|
|
4377
5087
|
require_valid_protocol: true,
|
|
4378
5088
|
allow_underscores: false,
|
|
4379
5089
|
allow_trailing_dot: false,
|
|
4380
5090
|
allow_protocol_relative_urls: false
|
|
4381
5091
|
};
|
|
4382
5092
|
|
|
5093
|
+
var wrapped_ipv6 = /^\[([^\]]+)\](?::([0-9]+))?$/;
|
|
5094
|
+
|
|
5095
|
+
function isRegExp(obj) {
|
|
5096
|
+
return Object.prototype.toString.call(obj) === '[object RegExp]';
|
|
5097
|
+
}
|
|
5098
|
+
|
|
5099
|
+
function checkHost(host, matches) {
|
|
5100
|
+
for (var i = 0; i < matches.length; i++) {
|
|
5101
|
+
var match = matches[i];
|
|
5102
|
+
if (host === match || isRegExp(match) && match.test(host)) {
|
|
5103
|
+
return true;
|
|
5104
|
+
}
|
|
5105
|
+
}
|
|
5106
|
+
return false;
|
|
5107
|
+
}
|
|
5108
|
+
|
|
4383
5109
|
function isURL(url, options) {
|
|
4384
5110
|
(0, _assertString2.default)(url);
|
|
4385
|
-
if (!url || url.length >= 2083 ||
|
|
5111
|
+
if (!url || url.length >= 2083 || /[\s<>]/.test(url)) {
|
|
4386
5112
|
return false;
|
|
4387
5113
|
}
|
|
4388
5114
|
if (url.indexOf('mailto:') === 0) {
|
|
@@ -4395,7 +5121,8 @@ function isURL(url, options) {
|
|
|
4395
5121
|
hostname = void 0,
|
|
4396
5122
|
port = void 0,
|
|
4397
5123
|
port_str = void 0,
|
|
4398
|
-
split = void 0
|
|
5124
|
+
split = void 0,
|
|
5125
|
+
ipv6 = void 0;
|
|
4399
5126
|
|
|
4400
5127
|
split = url.split('#');
|
|
4401
5128
|
url = split.shift();
|
|
@@ -4416,8 +5143,17 @@ function isURL(url, options) {
|
|
|
4416
5143
|
}
|
|
4417
5144
|
url = split.join('://');
|
|
4418
5145
|
|
|
5146
|
+
if (url === '') {
|
|
5147
|
+
return false;
|
|
5148
|
+
}
|
|
5149
|
+
|
|
4419
5150
|
split = url.split('/');
|
|
4420
5151
|
url = split.shift();
|
|
5152
|
+
|
|
5153
|
+
if (url === '' && !options.require_host) {
|
|
5154
|
+
return true;
|
|
5155
|
+
}
|
|
5156
|
+
|
|
4421
5157
|
split = url.split('@');
|
|
4422
5158
|
if (split.length > 1) {
|
|
4423
5159
|
auth = split.shift();
|
|
@@ -4426,28 +5162,46 @@ function isURL(url, options) {
|
|
|
4426
5162
|
}
|
|
4427
5163
|
}
|
|
4428
5164
|
hostname = split.join('@');
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
5165
|
+
|
|
5166
|
+
port_str = null;
|
|
5167
|
+
ipv6 = null;
|
|
5168
|
+
var ipv6_match = hostname.match(wrapped_ipv6);
|
|
5169
|
+
if (ipv6_match) {
|
|
5170
|
+
host = '';
|
|
5171
|
+
ipv6 = ipv6_match[1];
|
|
5172
|
+
port_str = ipv6_match[2] || null;
|
|
5173
|
+
} else {
|
|
5174
|
+
split = hostname.split(':');
|
|
5175
|
+
host = split.shift();
|
|
5176
|
+
if (split.length) {
|
|
5177
|
+
port_str = split.join(':');
|
|
5178
|
+
}
|
|
5179
|
+
}
|
|
5180
|
+
|
|
5181
|
+
if (port_str !== null) {
|
|
4433
5182
|
port = parseInt(port_str, 10);
|
|
4434
5183
|
if (!/^[0-9]+$/.test(port_str) || port <= 0 || port > 65535) {
|
|
4435
5184
|
return false;
|
|
4436
5185
|
}
|
|
4437
5186
|
}
|
|
4438
|
-
|
|
5187
|
+
|
|
5188
|
+
if (!(0, _isIP2.default)(host) && !(0, _isFQDN2.default)(host, options) && (!ipv6 || !(0, _isIP2.default)(ipv6, 6))) {
|
|
4439
5189
|
return false;
|
|
4440
5190
|
}
|
|
4441
|
-
|
|
5191
|
+
|
|
5192
|
+
host = host || ipv6;
|
|
5193
|
+
|
|
5194
|
+
if (options.host_whitelist && !checkHost(host, options.host_whitelist)) {
|
|
4442
5195
|
return false;
|
|
4443
5196
|
}
|
|
4444
|
-
if (options.host_blacklist && options.host_blacklist
|
|
5197
|
+
if (options.host_blacklist && checkHost(host, options.host_blacklist)) {
|
|
4445
5198
|
return false;
|
|
4446
5199
|
}
|
|
5200
|
+
|
|
4447
5201
|
return true;
|
|
4448
5202
|
}
|
|
4449
5203
|
module.exports = exports['default'];
|
|
4450
|
-
},{"./isFQDN":
|
|
5204
|
+
},{"./isFQDN":25,"./isIP":32,"./util/assertString":70,"./util/merge":71}],55:[function(require,module,exports){
|
|
4451
5205
|
'use strict';
|
|
4452
5206
|
|
|
4453
5207
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4469,14 +5223,14 @@ var uuid = {
|
|
|
4469
5223
|
};
|
|
4470
5224
|
|
|
4471
5225
|
function isUUID(str) {
|
|
4472
|
-
var version = arguments.length
|
|
5226
|
+
var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'all';
|
|
4473
5227
|
|
|
4474
5228
|
(0, _assertString2.default)(str);
|
|
4475
5229
|
var pattern = uuid[version];
|
|
4476
5230
|
return pattern && pattern.test(str);
|
|
4477
5231
|
}
|
|
4478
5232
|
module.exports = exports['default'];
|
|
4479
|
-
},{"./util/assertString":
|
|
5233
|
+
},{"./util/assertString":70}],56:[function(require,module,exports){
|
|
4480
5234
|
'use strict';
|
|
4481
5235
|
|
|
4482
5236
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4495,7 +5249,7 @@ function isUppercase(str) {
|
|
|
4495
5249
|
return str === str.toUpperCase();
|
|
4496
5250
|
}
|
|
4497
5251
|
module.exports = exports['default'];
|
|
4498
|
-
},{"./util/assertString":
|
|
5252
|
+
},{"./util/assertString":70}],57:[function(require,module,exports){
|
|
4499
5253
|
'use strict';
|
|
4500
5254
|
|
|
4501
5255
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4518,7 +5272,7 @@ function isVariableWidth(str) {
|
|
|
4518
5272
|
return _isFullWidth.fullWidth.test(str) && _isHalfWidth.halfWidth.test(str);
|
|
4519
5273
|
}
|
|
4520
5274
|
module.exports = exports['default'];
|
|
4521
|
-
},{"./isFullWidth":
|
|
5275
|
+
},{"./isFullWidth":27,"./isHalfWidth":28,"./util/assertString":70}],58:[function(require,module,exports){
|
|
4522
5276
|
'use strict';
|
|
4523
5277
|
|
|
4524
5278
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4542,7 +5296,7 @@ function isWhitelisted(str, chars) {
|
|
|
4542
5296
|
return true;
|
|
4543
5297
|
}
|
|
4544
5298
|
module.exports = exports['default'];
|
|
4545
|
-
},{"./util/assertString":
|
|
5299
|
+
},{"./util/assertString":70}],59:[function(require,module,exports){
|
|
4546
5300
|
'use strict';
|
|
4547
5301
|
|
|
4548
5302
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4562,7 +5316,7 @@ function ltrim(str, chars) {
|
|
|
4562
5316
|
return str.replace(pattern, '');
|
|
4563
5317
|
}
|
|
4564
5318
|
module.exports = exports['default'];
|
|
4565
|
-
},{"./util/assertString":
|
|
5319
|
+
},{"./util/assertString":70}],60:[function(require,module,exports){
|
|
4566
5320
|
'use strict';
|
|
4567
5321
|
|
|
4568
5322
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4584,7 +5338,7 @@ function matches(str, pattern, modifiers) {
|
|
|
4584
5338
|
return pattern.test(str);
|
|
4585
5339
|
}
|
|
4586
5340
|
module.exports = exports['default'];
|
|
4587
|
-
},{"./util/assertString":
|
|
5341
|
+
},{"./util/assertString":70}],61:[function(require,module,exports){
|
|
4588
5342
|
'use strict';
|
|
4589
5343
|
|
|
4590
5344
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4592,10 +5346,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4592
5346
|
});
|
|
4593
5347
|
exports.default = normalizeEmail;
|
|
4594
5348
|
|
|
4595
|
-
var _isEmail = require('./isEmail');
|
|
4596
|
-
|
|
4597
|
-
var _isEmail2 = _interopRequireDefault(_isEmail);
|
|
4598
|
-
|
|
4599
5349
|
var _merge = require('./util/merge');
|
|
4600
5350
|
|
|
4601
5351
|
var _merge2 = _interopRequireDefault(_merge);
|
|
@@ -4603,37 +5353,122 @@ var _merge2 = _interopRequireDefault(_merge);
|
|
|
4603
5353
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
4604
5354
|
|
|
4605
5355
|
var default_normalize_email_options = {
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
5356
|
+
// The following options apply to all email addresses
|
|
5357
|
+
// Lowercases the local part of the email address.
|
|
5358
|
+
// Please note this may violate RFC 5321 as per http://stackoverflow.com/a/9808332/192024).
|
|
5359
|
+
// The domain is always lowercased, as per RFC 1035
|
|
5360
|
+
all_lowercase: true,
|
|
5361
|
+
|
|
5362
|
+
// The following conversions are specific to GMail
|
|
5363
|
+
// Lowercases the local part of the GMail address (known to be case-insensitive)
|
|
5364
|
+
gmail_lowercase: true,
|
|
5365
|
+
// Removes dots from the local part of the email address, as that's ignored by GMail
|
|
5366
|
+
gmail_remove_dots: true,
|
|
5367
|
+
// Removes the subaddress (e.g. "+foo") from the email address
|
|
5368
|
+
gmail_remove_subaddress: true,
|
|
5369
|
+
// Conversts the googlemail.com domain to gmail.com
|
|
5370
|
+
gmail_convert_googlemaildotcom: true,
|
|
5371
|
+
|
|
5372
|
+
// The following conversions are specific to Outlook.com / Windows Live / Hotmail
|
|
5373
|
+
// Lowercases the local part of the Outlook.com address (known to be case-insensitive)
|
|
5374
|
+
outlookdotcom_lowercase: true,
|
|
5375
|
+
// Removes the subaddress (e.g. "+foo") from the email address
|
|
5376
|
+
outlookdotcom_remove_subaddress: true,
|
|
5377
|
+
|
|
5378
|
+
// The following conversions are specific to Yahoo
|
|
5379
|
+
// Lowercases the local part of the Yahoo address (known to be case-insensitive)
|
|
5380
|
+
yahoo_lowercase: true,
|
|
5381
|
+
// Removes the subaddress (e.g. "-foo") from the email address
|
|
5382
|
+
yahoo_remove_subaddress: true,
|
|
5383
|
+
|
|
5384
|
+
// The following conversions are specific to iCloud
|
|
5385
|
+
// Lowercases the local part of the iCloud address (known to be case-insensitive)
|
|
5386
|
+
icloud_lowercase: true,
|
|
5387
|
+
// Removes the subaddress (e.g. "+foo") from the email address
|
|
5388
|
+
icloud_remove_subaddress: true
|
|
4609
5389
|
};
|
|
4610
5390
|
|
|
5391
|
+
// List of domains used by iCloud
|
|
5392
|
+
var icloud_domains = ['icloud.com', 'me.com'];
|
|
5393
|
+
|
|
5394
|
+
// List of domains used by Outlook.com and its predecessors
|
|
5395
|
+
// This list is likely incomplete.
|
|
5396
|
+
// Partial reference:
|
|
5397
|
+
// https://blogs.office.com/2013/04/17/outlook-com-gets-two-step-verification-sign-in-by-alias-and-new-international-domains/
|
|
5398
|
+
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'];
|
|
5399
|
+
|
|
5400
|
+
// List of domains used by Yahoo Mail
|
|
5401
|
+
// This list is likely incomplete
|
|
5402
|
+
var yahoo_domains = ['rocketmail.com', 'yahoo.ca', 'yahoo.co.uk', 'yahoo.com', 'yahoo.de', 'yahoo.fr', 'yahoo.in', 'yahoo.it', 'ymail.com'];
|
|
5403
|
+
|
|
4611
5404
|
function normalizeEmail(email, options) {
|
|
4612
5405
|
options = (0, _merge2.default)(options, default_normalize_email_options);
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
var
|
|
5406
|
+
|
|
5407
|
+
var raw_parts = email.split('@');
|
|
5408
|
+
var domain = raw_parts.pop();
|
|
5409
|
+
var user = raw_parts.join('@');
|
|
5410
|
+
var parts = [user, domain];
|
|
5411
|
+
|
|
5412
|
+
// The domain is always lowercased, as it's case-insensitive per RFC 1035
|
|
4617
5413
|
parts[1] = parts[1].toLowerCase();
|
|
5414
|
+
|
|
4618
5415
|
if (parts[1] === 'gmail.com' || parts[1] === 'googlemail.com') {
|
|
4619
|
-
|
|
5416
|
+
// Address is GMail
|
|
5417
|
+
if (options.gmail_remove_subaddress) {
|
|
4620
5418
|
parts[0] = parts[0].split('+')[0];
|
|
4621
5419
|
}
|
|
4622
|
-
if (options.
|
|
5420
|
+
if (options.gmail_remove_dots) {
|
|
4623
5421
|
parts[0] = parts[0].replace(/\./g, '');
|
|
4624
5422
|
}
|
|
4625
5423
|
if (!parts[0].length) {
|
|
4626
5424
|
return false;
|
|
4627
5425
|
}
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
5426
|
+
if (options.all_lowercase || options.gmail_lowercase) {
|
|
5427
|
+
parts[0] = parts[0].toLowerCase();
|
|
5428
|
+
}
|
|
5429
|
+
parts[1] = options.gmail_convert_googlemaildotcom ? 'gmail.com' : parts[1];
|
|
5430
|
+
} else if (~icloud_domains.indexOf(parts[1])) {
|
|
5431
|
+
// Address is iCloud
|
|
5432
|
+
if (options.icloud_remove_subaddress) {
|
|
5433
|
+
parts[0] = parts[0].split('+')[0];
|
|
5434
|
+
}
|
|
5435
|
+
if (!parts[0].length) {
|
|
5436
|
+
return false;
|
|
5437
|
+
}
|
|
5438
|
+
if (options.all_lowercase || options.icloud_lowercase) {
|
|
5439
|
+
parts[0] = parts[0].toLowerCase();
|
|
5440
|
+
}
|
|
5441
|
+
} else if (~outlookdotcom_domains.indexOf(parts[1])) {
|
|
5442
|
+
// Address is Outlook.com
|
|
5443
|
+
if (options.outlookdotcom_remove_subaddress) {
|
|
5444
|
+
parts[0] = parts[0].split('+')[0];
|
|
5445
|
+
}
|
|
5446
|
+
if (!parts[0].length) {
|
|
5447
|
+
return false;
|
|
5448
|
+
}
|
|
5449
|
+
if (options.all_lowercase || options.outlookdotcom_lowercase) {
|
|
5450
|
+
parts[0] = parts[0].toLowerCase();
|
|
5451
|
+
}
|
|
5452
|
+
} else if (~yahoo_domains.indexOf(parts[1])) {
|
|
5453
|
+
// Address is Yahoo
|
|
5454
|
+
if (options.yahoo_remove_subaddress) {
|
|
5455
|
+
var components = parts[0].split('-');
|
|
5456
|
+
parts[0] = components.length > 1 ? components.slice(0, -1).join('-') : components[0];
|
|
5457
|
+
}
|
|
5458
|
+
if (!parts[0].length) {
|
|
5459
|
+
return false;
|
|
5460
|
+
}
|
|
5461
|
+
if (options.all_lowercase || options.yahoo_lowercase) {
|
|
5462
|
+
parts[0] = parts[0].toLowerCase();
|
|
5463
|
+
}
|
|
5464
|
+
} else if (options.all_lowercase) {
|
|
5465
|
+
// Any other address
|
|
4631
5466
|
parts[0] = parts[0].toLowerCase();
|
|
4632
5467
|
}
|
|
4633
5468
|
return parts.join('@');
|
|
4634
5469
|
}
|
|
4635
5470
|
module.exports = exports['default'];
|
|
4636
|
-
},{"./
|
|
5471
|
+
},{"./util/merge":71}],62:[function(require,module,exports){
|
|
4637
5472
|
'use strict';
|
|
4638
5473
|
|
|
4639
5474
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4649,11 +5484,17 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
4649
5484
|
|
|
4650
5485
|
function rtrim(str, chars) {
|
|
4651
5486
|
(0, _assertString2.default)(str);
|
|
4652
|
-
var pattern = chars ? new RegExp('[' + chars + ']
|
|
4653
|
-
|
|
5487
|
+
var pattern = chars ? new RegExp('[' + chars + ']') : /\s/;
|
|
5488
|
+
|
|
5489
|
+
var idx = str.length - 1;
|
|
5490
|
+
while (idx >= 0 && pattern.test(str[idx])) {
|
|
5491
|
+
idx--;
|
|
5492
|
+
}
|
|
5493
|
+
|
|
5494
|
+
return idx < str.length ? str.substr(0, idx + 1) : str;
|
|
4654
5495
|
}
|
|
4655
5496
|
module.exports = exports['default'];
|
|
4656
|
-
},{"./util/assertString":
|
|
5497
|
+
},{"./util/assertString":70}],63:[function(require,module,exports){
|
|
4657
5498
|
'use strict';
|
|
4658
5499
|
|
|
4659
5500
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4677,7 +5518,7 @@ function stripLow(str, keep_new_lines) {
|
|
|
4677
5518
|
return (0, _blacklist2.default)(str, chars);
|
|
4678
5519
|
}
|
|
4679
5520
|
module.exports = exports['default'];
|
|
4680
|
-
},{"./blacklist":
|
|
5521
|
+
},{"./blacklist":6,"./util/assertString":70}],64:[function(require,module,exports){
|
|
4681
5522
|
'use strict';
|
|
4682
5523
|
|
|
4683
5524
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4699,7 +5540,7 @@ function toBoolean(str, strict) {
|
|
|
4699
5540
|
return str !== '0' && str !== 'false' && str !== '';
|
|
4700
5541
|
}
|
|
4701
5542
|
module.exports = exports['default'];
|
|
4702
|
-
},{"./util/assertString":
|
|
5543
|
+
},{"./util/assertString":70}],65:[function(require,module,exports){
|
|
4703
5544
|
'use strict';
|
|
4704
5545
|
|
|
4705
5546
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4719,7 +5560,7 @@ function toDate(date) {
|
|
|
4719
5560
|
return !isNaN(date) ? new Date(date) : null;
|
|
4720
5561
|
}
|
|
4721
5562
|
module.exports = exports['default'];
|
|
4722
|
-
},{"./util/assertString":
|
|
5563
|
+
},{"./util/assertString":70}],66:[function(require,module,exports){
|
|
4723
5564
|
'use strict';
|
|
4724
5565
|
|
|
4725
5566
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4738,7 +5579,7 @@ function toFloat(str) {
|
|
|
4738
5579
|
return parseFloat(str);
|
|
4739
5580
|
}
|
|
4740
5581
|
module.exports = exports['default'];
|
|
4741
|
-
},{"./util/assertString":
|
|
5582
|
+
},{"./util/assertString":70}],67:[function(require,module,exports){
|
|
4742
5583
|
'use strict';
|
|
4743
5584
|
|
|
4744
5585
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4757,7 +5598,7 @@ function toInt(str, radix) {
|
|
|
4757
5598
|
return parseInt(str, radix || 10);
|
|
4758
5599
|
}
|
|
4759
5600
|
module.exports = exports['default'];
|
|
4760
|
-
},{"./util/assertString":
|
|
5601
|
+
},{"./util/assertString":70}],68:[function(require,module,exports){
|
|
4761
5602
|
'use strict';
|
|
4762
5603
|
|
|
4763
5604
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4765,23 +5606,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4765
5606
|
});
|
|
4766
5607
|
exports.default = trim;
|
|
4767
5608
|
|
|
4768
|
-
var
|
|
5609
|
+
var _rtrim = require('./rtrim');
|
|
4769
5610
|
|
|
4770
|
-
var
|
|
5611
|
+
var _rtrim2 = _interopRequireDefault(_rtrim);
|
|
5612
|
+
|
|
5613
|
+
var _ltrim = require('./ltrim');
|
|
5614
|
+
|
|
5615
|
+
var _ltrim2 = _interopRequireDefault(_ltrim);
|
|
4771
5616
|
|
|
4772
5617
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
4773
5618
|
|
|
4774
5619
|
function trim(str, chars) {
|
|
4775
|
-
(0,
|
|
4776
|
-
var pattern = chars ? new RegExp('^[' + chars + ']+|[' + chars + ']+$', 'g') : /^\s+|\s+$/g;
|
|
4777
|
-
return str.replace(pattern, '');
|
|
5620
|
+
return (0, _rtrim2.default)((0, _ltrim2.default)(str, chars), chars);
|
|
4778
5621
|
}
|
|
4779
5622
|
module.exports = exports['default'];
|
|
4780
|
-
},{"./
|
|
5623
|
+
},{"./ltrim":59,"./rtrim":62}],69:[function(require,module,exports){
|
|
4781
5624
|
'use strict';
|
|
4782
5625
|
|
|
4783
5626
|
Object.defineProperty(exports, "__esModule", {
|
|
4784
|
-
|
|
5627
|
+
value: true
|
|
4785
5628
|
});
|
|
4786
5629
|
exports.default = unescape;
|
|
4787
5630
|
|
|
@@ -4792,11 +5635,11 @@ var _assertString2 = _interopRequireDefault(_assertString);
|
|
|
4792
5635
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
4793
5636
|
|
|
4794
5637
|
function unescape(str) {
|
|
4795
|
-
|
|
4796
|
-
|
|
5638
|
+
(0, _assertString2.default)(str);
|
|
5639
|
+
return str.replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, "'").replace(/</g, '<').replace(/>/g, '>').replace(///g, '/').replace(/\/g, '\\').replace(/`/g, '`');
|
|
4797
5640
|
}
|
|
4798
5641
|
module.exports = exports['default'];
|
|
4799
|
-
},{"./util/assertString":
|
|
5642
|
+
},{"./util/assertString":70}],70:[function(require,module,exports){
|
|
4800
5643
|
'use strict';
|
|
4801
5644
|
|
|
4802
5645
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4804,12 +5647,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4804
5647
|
});
|
|
4805
5648
|
exports.default = assertString;
|
|
4806
5649
|
function assertString(input) {
|
|
4807
|
-
|
|
5650
|
+
var isString = typeof input === 'string' || input instanceof String;
|
|
5651
|
+
|
|
5652
|
+
if (!isString) {
|
|
4808
5653
|
throw new TypeError('This library (validator.js) validates strings only');
|
|
4809
5654
|
}
|
|
4810
5655
|
}
|
|
4811
5656
|
module.exports = exports['default'];
|
|
4812
|
-
},{}],
|
|
5657
|
+
},{}],71:[function(require,module,exports){
|
|
4813
5658
|
'use strict';
|
|
4814
5659
|
|
|
4815
5660
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4817,7 +5662,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4817
5662
|
});
|
|
4818
5663
|
exports.default = merge;
|
|
4819
5664
|
function merge() {
|
|
4820
|
-
var obj = arguments.length
|
|
5665
|
+
var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
4821
5666
|
var defaults = arguments[1];
|
|
4822
5667
|
|
|
4823
5668
|
for (var key in defaults) {
|
|
@@ -4828,14 +5673,14 @@ function merge() {
|
|
|
4828
5673
|
return obj;
|
|
4829
5674
|
}
|
|
4830
5675
|
module.exports = exports['default'];
|
|
4831
|
-
},{}],
|
|
5676
|
+
},{}],72:[function(require,module,exports){
|
|
4832
5677
|
'use strict';
|
|
4833
5678
|
|
|
4834
5679
|
Object.defineProperty(exports, "__esModule", {
|
|
4835
5680
|
value: true
|
|
4836
5681
|
});
|
|
4837
5682
|
|
|
4838
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
|
|
5683
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
4839
5684
|
|
|
4840
5685
|
exports.default = toString;
|
|
4841
5686
|
function toString(input) {
|
|
@@ -4851,7 +5696,7 @@ function toString(input) {
|
|
|
4851
5696
|
return String(input);
|
|
4852
5697
|
}
|
|
4853
5698
|
module.exports = exports['default'];
|
|
4854
|
-
},{}],
|
|
5699
|
+
},{}],73:[function(require,module,exports){
|
|
4855
5700
|
'use strict';
|
|
4856
5701
|
|
|
4857
5702
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -4870,7 +5715,7 @@ function whitelist(str, chars) {
|
|
|
4870
5715
|
return str.replace(new RegExp('[^' + chars + ']+', 'g'), '');
|
|
4871
5716
|
}
|
|
4872
5717
|
module.exports = exports['default'];
|
|
4873
|
-
},{"./util/assertString":
|
|
5718
|
+
},{"./util/assertString":70}],74:[function(require,module,exports){
|
|
4874
5719
|
"use strict";
|
|
4875
5720
|
|
|
4876
5721
|
module.exports = {
|
|
@@ -4931,7 +5776,7 @@ module.exports = {
|
|
|
4931
5776
|
|
|
4932
5777
|
};
|
|
4933
5778
|
|
|
4934
|
-
},{}],
|
|
5779
|
+
},{}],75:[function(require,module,exports){
|
|
4935
5780
|
/*jshint maxlen: false*/
|
|
4936
5781
|
|
|
4937
5782
|
var validator = require("validator");
|
|
@@ -5062,7 +5907,7 @@ var FormatValidators = {
|
|
|
5062
5907
|
|
|
5063
5908
|
module.exports = FormatValidators;
|
|
5064
5909
|
|
|
5065
|
-
},{"validator":
|
|
5910
|
+
},{"validator":4}],76:[function(require,module,exports){
|
|
5066
5911
|
"use strict";
|
|
5067
5912
|
|
|
5068
5913
|
var FormatValidators = require("./FormatValidators"),
|
|
@@ -5605,7 +6450,7 @@ exports.validate = function (report, schema, json) {
|
|
|
5605
6450
|
|
|
5606
6451
|
};
|
|
5607
6452
|
|
|
5608
|
-
},{"./FormatValidators":
|
|
6453
|
+
},{"./FormatValidators":75,"./Report":78,"./Utils":82}],77:[function(require,module,exports){
|
|
5609
6454
|
// Number.isFinite polyfill
|
|
5610
6455
|
// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite
|
|
5611
6456
|
if (typeof Number.isFinite !== "function") {
|
|
@@ -5623,7 +6468,7 @@ if (typeof Number.isFinite !== "function") {
|
|
|
5623
6468
|
};
|
|
5624
6469
|
}
|
|
5625
6470
|
|
|
5626
|
-
},{}],
|
|
6471
|
+
},{}],78:[function(require,module,exports){
|
|
5627
6472
|
(function (process){
|
|
5628
6473
|
"use strict";
|
|
5629
6474
|
|
|
@@ -5829,7 +6674,7 @@ Report.prototype.addCustomError = function (errorCode, errorMessage, params, sub
|
|
|
5829
6674
|
module.exports = Report;
|
|
5830
6675
|
|
|
5831
6676
|
}).call(this,require('_process'))
|
|
5832
|
-
},{"./Errors":
|
|
6677
|
+
},{"./Errors":74,"./Utils":82,"_process":3,"lodash.get":1}],79:[function(require,module,exports){
|
|
5833
6678
|
"use strict";
|
|
5834
6679
|
|
|
5835
6680
|
var isequal = require("lodash.isequal");
|
|
@@ -5953,7 +6798,15 @@ exports.getSchemaByUri = function (report, uri, root) {
|
|
|
5953
6798
|
|
|
5954
6799
|
var remoteReport = new Report(report);
|
|
5955
6800
|
if (SchemaCompilation.compileSchema.call(this, remoteReport, result)) {
|
|
5956
|
-
|
|
6801
|
+
var savedOptions = this.options;
|
|
6802
|
+
try {
|
|
6803
|
+
// If custom validationOptions were provided to setRemoteReference(),
|
|
6804
|
+
// use them instead of the default options
|
|
6805
|
+
this.options = result.__$validationOptions || this.options;
|
|
6806
|
+
SchemaValidation.validateSchema.call(this, remoteReport, result);
|
|
6807
|
+
} finally {
|
|
6808
|
+
this.options = savedOptions;
|
|
6809
|
+
}
|
|
5957
6810
|
}
|
|
5958
6811
|
var remoteReportIsValid = remoteReport.isValid();
|
|
5959
6812
|
if (!remoteReportIsValid) {
|
|
@@ -5985,7 +6838,7 @@ exports.getSchemaByUri = function (report, uri, root) {
|
|
|
5985
6838
|
|
|
5986
6839
|
exports.getRemotePath = getRemotePath;
|
|
5987
6840
|
|
|
5988
|
-
},{"./Report":
|
|
6841
|
+
},{"./Report":78,"./SchemaCompilation":80,"./SchemaValidation":81,"./Utils":82,"lodash.isequal":2}],80:[function(require,module,exports){
|
|
5989
6842
|
"use strict";
|
|
5990
6843
|
|
|
5991
6844
|
var Report = require("./Report");
|
|
@@ -6286,7 +7139,7 @@ exports.compileSchema = function (report, schema) {
|
|
|
6286
7139
|
|
|
6287
7140
|
};
|
|
6288
7141
|
|
|
6289
|
-
},{"./Report":
|
|
7142
|
+
},{"./Report":78,"./SchemaCache":79,"./Utils":82}],81:[function(require,module,exports){
|
|
6290
7143
|
"use strict";
|
|
6291
7144
|
|
|
6292
7145
|
var FormatValidators = require("./FormatValidators"),
|
|
@@ -6895,7 +7748,7 @@ exports.validateSchema = function (report, schema) {
|
|
|
6895
7748
|
return isValid;
|
|
6896
7749
|
};
|
|
6897
7750
|
|
|
6898
|
-
},{"./FormatValidators":
|
|
7751
|
+
},{"./FormatValidators":75,"./JsonValidation":76,"./Report":78,"./Utils":82}],82:[function(require,module,exports){
|
|
6899
7752
|
"use strict";
|
|
6900
7753
|
|
|
6901
7754
|
exports.isAbsoluteUri = function (uri) {
|
|
@@ -7114,7 +7967,7 @@ exports.ucs2decode = function (string) {
|
|
|
7114
7967
|
};
|
|
7115
7968
|
/*jshint +W016*/
|
|
7116
7969
|
|
|
7117
|
-
},{}],
|
|
7970
|
+
},{}],83:[function(require,module,exports){
|
|
7118
7971
|
(function (process){
|
|
7119
7972
|
"use strict";
|
|
7120
7973
|
|
|
@@ -7178,15 +8031,8 @@ var defaultOptions = {
|
|
|
7178
8031
|
customValidator: null
|
|
7179
8032
|
};
|
|
7180
8033
|
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
*/
|
|
7184
|
-
function ZSchema(options) {
|
|
7185
|
-
this.cache = {};
|
|
7186
|
-
this.referenceCache = [];
|
|
7187
|
-
|
|
7188
|
-
this.setRemoteReference("http://json-schema.org/draft-04/schema", Draft4Schema);
|
|
7189
|
-
this.setRemoteReference("http://json-schema.org/draft-04/hyper-schema", Draft4HyperSchema);
|
|
8034
|
+
function normalizeOptions(options) {
|
|
8035
|
+
var normalized;
|
|
7190
8036
|
|
|
7191
8037
|
// options
|
|
7192
8038
|
if (typeof options === "object") {
|
|
@@ -7212,22 +8058,39 @@ function ZSchema(options) {
|
|
|
7212
8058
|
}
|
|
7213
8059
|
}
|
|
7214
8060
|
|
|
7215
|
-
|
|
8061
|
+
normalized = options;
|
|
7216
8062
|
} else {
|
|
7217
|
-
|
|
8063
|
+
normalized = Utils.clone(defaultOptions);
|
|
7218
8064
|
}
|
|
7219
8065
|
|
|
7220
|
-
if (
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
8066
|
+
if (normalized.strictMode === true) {
|
|
8067
|
+
normalized.forceAdditional = true;
|
|
8068
|
+
normalized.forceItems = true;
|
|
8069
|
+
normalized.forceMaxLength = true;
|
|
8070
|
+
normalized.forceProperties = true;
|
|
8071
|
+
normalized.noExtraKeywords = true;
|
|
8072
|
+
normalized.noTypeless = true;
|
|
8073
|
+
normalized.noEmptyStrings = true;
|
|
8074
|
+
normalized.noEmptyArrays = true;
|
|
7229
8075
|
}
|
|
7230
8076
|
|
|
8077
|
+
return normalized;
|
|
8078
|
+
}
|
|
8079
|
+
|
|
8080
|
+
/*
|
|
8081
|
+
constructor
|
|
8082
|
+
*/
|
|
8083
|
+
function ZSchema(options) {
|
|
8084
|
+
this.cache = {};
|
|
8085
|
+
this.referenceCache = [];
|
|
8086
|
+
|
|
8087
|
+
this.options = normalizeOptions(options);
|
|
8088
|
+
|
|
8089
|
+
// Disable strict validation for the built-in schemas
|
|
8090
|
+
var metaschemaOptions = normalizeOptions({ });
|
|
8091
|
+
|
|
8092
|
+
this.setRemoteReference("http://json-schema.org/draft-04/schema", Draft4Schema, metaschemaOptions);
|
|
8093
|
+
this.setRemoteReference("http://json-schema.org/draft-04/hyper-schema", Draft4HyperSchema, metaschemaOptions);
|
|
7231
8094
|
}
|
|
7232
8095
|
|
|
7233
8096
|
/*
|
|
@@ -7375,12 +8238,17 @@ ZSchema.prototype.getMissingRemoteReferences = function () {
|
|
|
7375
8238
|
}
|
|
7376
8239
|
return missingRemoteReferences;
|
|
7377
8240
|
};
|
|
7378
|
-
ZSchema.prototype.setRemoteReference = function (uri, schema) {
|
|
8241
|
+
ZSchema.prototype.setRemoteReference = function (uri, schema, validationOptions) {
|
|
7379
8242
|
if (typeof schema === "string") {
|
|
7380
8243
|
schema = JSON.parse(schema);
|
|
7381
8244
|
} else {
|
|
7382
8245
|
schema = Utils.cloneDeep(schema);
|
|
7383
8246
|
}
|
|
8247
|
+
|
|
8248
|
+
if (validationOptions) {
|
|
8249
|
+
schema.__$validationOptions = normalizeOptions(validationOptions);
|
|
8250
|
+
}
|
|
8251
|
+
|
|
7384
8252
|
SchemaCache.cacheSchemaByUri.call(this, uri, schema);
|
|
7385
8253
|
};
|
|
7386
8254
|
ZSchema.prototype.getResolvedSchema = function (schema) {
|
|
@@ -7470,7 +8338,7 @@ ZSchema.getDefaultOptions = function () {
|
|
|
7470
8338
|
module.exports = ZSchema;
|
|
7471
8339
|
|
|
7472
8340
|
}).call(this,require('_process'))
|
|
7473
|
-
},{"./FormatValidators":
|
|
8341
|
+
},{"./FormatValidators":75,"./JsonValidation":76,"./Polyfills":77,"./Report":78,"./SchemaCache":79,"./SchemaCompilation":80,"./SchemaValidation":81,"./Utils":82,"./schemas/hyper-schema.json":84,"./schemas/schema.json":85,"_process":3,"lodash.get":1}],84:[function(require,module,exports){
|
|
7474
8342
|
module.exports={
|
|
7475
8343
|
"$schema": "http://json-schema.org/draft-04/hyper-schema#",
|
|
7476
8344
|
"id": "http://json-schema.org/draft-04/hyper-schema#",
|
|
@@ -7630,7 +8498,7 @@ module.exports={
|
|
|
7630
8498
|
}
|
|
7631
8499
|
|
|
7632
8500
|
|
|
7633
|
-
},{}],
|
|
8501
|
+
},{}],85:[function(require,module,exports){
|
|
7634
8502
|
module.exports={
|
|
7635
8503
|
"id": "http://json-schema.org/draft-04/schema#",
|
|
7636
8504
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
@@ -7783,5 +8651,5 @@ module.exports={
|
|
|
7783
8651
|
"default": {}
|
|
7784
8652
|
}
|
|
7785
8653
|
|
|
7786
|
-
},{}]},{},[
|
|
8654
|
+
},{}]},{},[74,75,76,77,78,79,80,81,82,83])(83)
|
|
7787
8655
|
});
|