@aws-amplify/graphql-model-transformer 2.12.0-gen2-migration-0809.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/CHANGELOG.md +7 -7
  2. package/lib/graphql-model-transformer.d.ts.map +1 -1
  3. package/lib/graphql-model-transformer.js +2 -47
  4. package/lib/graphql-model-transformer.js.map +1 -1
  5. package/lib/rds-lambda.zip +0 -0
  6. package/lib/rds-notification-lambda.zip +0 -0
  7. package/lib/rds-patching-lambda.zip +0 -0
  8. package/lib/resolvers/rds/resolver.d.ts +2 -2
  9. package/lib/resolvers/rds/resolver.d.ts.map +1 -1
  10. package/lib/resolvers/rds/resolver.js +22 -4
  11. package/lib/resolvers/rds/resolver.js.map +1 -1
  12. package/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.d.ts.map +1 -1
  13. package/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.js +3 -12
  14. package/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.js.map +1 -1
  15. package/lib/resources/amplify-dynamodb-table/amplify-dynamodb-table-construct/index.d.ts +0 -2
  16. package/lib/resources/amplify-dynamodb-table/amplify-dynamodb-table-construct/index.d.ts.map +1 -1
  17. package/lib/resources/amplify-dynamodb-table/amplify-dynamodb-table-construct/index.js +2 -4
  18. package/lib/resources/amplify-dynamodb-table/amplify-dynamodb-table-construct/index.js.map +1 -1
  19. package/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/amplify-table-manager-handler.d.ts +0 -3
  20. package/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/amplify-table-manager-handler.d.ts.map +1 -1
  21. package/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/amplify-table-manager-handler.js +1 -111
  22. package/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/amplify-table-manager-handler.js.map +1 -1
  23. package/lib/resources/dynamo-model-resource-generator.d.ts.map +1 -1
  24. package/lib/resources/dynamo-model-resource-generator.js +1 -3
  25. package/lib/resources/dynamo-model-resource-generator.js.map +1 -1
  26. package/lib/resources/model-resource-generator.d.ts +0 -1
  27. package/lib/resources/model-resource-generator.d.ts.map +1 -1
  28. package/lib/resources/model-resource-generator.js +0 -3
  29. package/lib/resources/model-resource-generator.js.map +1 -1
  30. package/lib/resources/rds-model-resource-generator.js +2 -2
  31. package/lib/resources/rds-model-resource-generator.js.map +1 -1
  32. package/package.json +11 -12
  33. package/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/node_modules/.package-lock.json +0 -13
  34. package/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/node_modules/lodash.isequal/LICENSE +0 -47
  35. package/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/node_modules/lodash.isequal/README.md +0 -18
  36. package/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/node_modules/lodash.isequal/index.js +0 -1848
  37. package/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/node_modules/lodash.isequal/package.json +0 -16
  38. package/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/package-lock.json +0 -21
  39. package/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/package.json +0 -11
@@ -1,1848 +0,0 @@
1
- /**
2
- * Lodash (Custom Build) <https://lodash.com/>
3
- * Build: `lodash modularize exports="npm" -o ./`
4
- * Copyright JS Foundation and other contributors <https://js.foundation/>
5
- * Released under MIT license <https://lodash.com/license>
6
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
7
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
8
- */
9
-
10
- /** Used as the size to enable large array optimizations. */
11
- var LARGE_ARRAY_SIZE = 200;
12
-
13
- /** Used to stand-in for `undefined` hash values. */
14
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
15
-
16
- /** Used to compose bitmasks for value comparisons. */
17
- var COMPARE_PARTIAL_FLAG = 1,
18
- COMPARE_UNORDERED_FLAG = 2;
19
-
20
- /** Used as references for various `Number` constants. */
21
- var MAX_SAFE_INTEGER = 9007199254740991;
22
-
23
- /** `Object#toString` result references. */
24
- var argsTag = '[object Arguments]',
25
- arrayTag = '[object Array]',
26
- asyncTag = '[object AsyncFunction]',
27
- boolTag = '[object Boolean]',
28
- dateTag = '[object Date]',
29
- errorTag = '[object Error]',
30
- funcTag = '[object Function]',
31
- genTag = '[object GeneratorFunction]',
32
- mapTag = '[object Map]',
33
- numberTag = '[object Number]',
34
- nullTag = '[object Null]',
35
- objectTag = '[object Object]',
36
- promiseTag = '[object Promise]',
37
- proxyTag = '[object Proxy]',
38
- regexpTag = '[object RegExp]',
39
- setTag = '[object Set]',
40
- stringTag = '[object String]',
41
- symbolTag = '[object Symbol]',
42
- undefinedTag = '[object Undefined]',
43
- weakMapTag = '[object WeakMap]';
44
-
45
- var arrayBufferTag = '[object ArrayBuffer]',
46
- dataViewTag = '[object DataView]',
47
- float32Tag = '[object Float32Array]',
48
- float64Tag = '[object Float64Array]',
49
- int8Tag = '[object Int8Array]',
50
- int16Tag = '[object Int16Array]',
51
- int32Tag = '[object Int32Array]',
52
- uint8Tag = '[object Uint8Array]',
53
- uint8ClampedTag = '[object Uint8ClampedArray]',
54
- uint16Tag = '[object Uint16Array]',
55
- uint32Tag = '[object Uint32Array]';
56
-
57
- /**
58
- * Used to match `RegExp`
59
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
60
- */
61
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
62
-
63
- /** Used to detect host constructors (Safari). */
64
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
65
-
66
- /** Used to detect unsigned integer values. */
67
- var reIsUint = /^(?:0|[1-9]\d*)$/;
68
-
69
- /** Used to identify `toStringTag` values of typed arrays. */
70
- var typedArrayTags = {};
71
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
72
- typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
73
- typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
74
- typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
75
- typedArrayTags[uint32Tag] = true;
76
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
77
- typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
78
- typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
79
- typedArrayTags[errorTag] = typedArrayTags[funcTag] =
80
- typedArrayTags[mapTag] = typedArrayTags[numberTag] =
81
- typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
82
- typedArrayTags[setTag] = typedArrayTags[stringTag] =
83
- typedArrayTags[weakMapTag] = false;
84
-
85
- /** Detect free variable `global` from Node.js. */
86
- var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
87
-
88
- /** Detect free variable `self`. */
89
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
90
-
91
- /** Used as a reference to the global object. */
92
- var root = freeGlobal || freeSelf || Function('return this')();
93
-
94
- /** Detect free variable `exports`. */
95
- var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
96
-
97
- /** Detect free variable `module`. */
98
- var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
99
-
100
- /** Detect the popular CommonJS extension `module.exports`. */
101
- var moduleExports = freeModule && freeModule.exports === freeExports;
102
-
103
- /** Detect free variable `process` from Node.js. */
104
- var freeProcess = moduleExports && freeGlobal.process;
105
-
106
- /** Used to access faster Node.js helpers. */
107
- var nodeUtil = (function() {
108
- try {
109
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
110
- } catch (e) {}
111
- }());
112
-
113
- /* Node.js helper references. */
114
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
115
-
116
- /**
117
- * A specialized version of `_.filter` for arrays without support for
118
- * iteratee shorthands.
119
- *
120
- * @private
121
- * @param {Array} [array] The array to iterate over.
122
- * @param {Function} predicate The function invoked per iteration.
123
- * @returns {Array} Returns the new filtered array.
124
- */
125
- function arrayFilter(array, predicate) {
126
- var index = -1,
127
- length = array == null ? 0 : array.length,
128
- resIndex = 0,
129
- result = [];
130
-
131
- while (++index < length) {
132
- var value = array[index];
133
- if (predicate(value, index, array)) {
134
- result[resIndex++] = value;
135
- }
136
- }
137
- return result;
138
- }
139
-
140
- /**
141
- * Appends the elements of `values` to `array`.
142
- *
143
- * @private
144
- * @param {Array} array The array to modify.
145
- * @param {Array} values The values to append.
146
- * @returns {Array} Returns `array`.
147
- */
148
- function arrayPush(array, values) {
149
- var index = -1,
150
- length = values.length,
151
- offset = array.length;
152
-
153
- while (++index < length) {
154
- array[offset + index] = values[index];
155
- }
156
- return array;
157
- }
158
-
159
- /**
160
- * A specialized version of `_.some` for arrays without support for iteratee
161
- * shorthands.
162
- *
163
- * @private
164
- * @param {Array} [array] The array to iterate over.
165
- * @param {Function} predicate The function invoked per iteration.
166
- * @returns {boolean} Returns `true` if any element passes the predicate check,
167
- * else `false`.
168
- */
169
- function arraySome(array, predicate) {
170
- var index = -1,
171
- length = array == null ? 0 : array.length;
172
-
173
- while (++index < length) {
174
- if (predicate(array[index], index, array)) {
175
- return true;
176
- }
177
- }
178
- return false;
179
- }
180
-
181
- /**
182
- * The base implementation of `_.times` without support for iteratee shorthands
183
- * or max array length checks.
184
- *
185
- * @private
186
- * @param {number} n The number of times to invoke `iteratee`.
187
- * @param {Function} iteratee The function invoked per iteration.
188
- * @returns {Array} Returns the array of results.
189
- */
190
- function baseTimes(n, iteratee) {
191
- var index = -1,
192
- result = Array(n);
193
-
194
- while (++index < n) {
195
- result[index] = iteratee(index);
196
- }
197
- return result;
198
- }
199
-
200
- /**
201
- * The base implementation of `_.unary` without support for storing metadata.
202
- *
203
- * @private
204
- * @param {Function} func The function to cap arguments for.
205
- * @returns {Function} Returns the new capped function.
206
- */
207
- function baseUnary(func) {
208
- return function(value) {
209
- return func(value);
210
- };
211
- }
212
-
213
- /**
214
- * Checks if a `cache` value for `key` exists.
215
- *
216
- * @private
217
- * @param {Object} cache The cache to query.
218
- * @param {string} key The key of the entry to check.
219
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
220
- */
221
- function cacheHas(cache, key) {
222
- return cache.has(key);
223
- }
224
-
225
- /**
226
- * Gets the value at `key` of `object`.
227
- *
228
- * @private
229
- * @param {Object} [object] The object to query.
230
- * @param {string} key The key of the property to get.
231
- * @returns {*} Returns the property value.
232
- */
233
- function getValue(object, key) {
234
- return object == null ? undefined : object[key];
235
- }
236
-
237
- /**
238
- * Converts `map` to its key-value pairs.
239
- *
240
- * @private
241
- * @param {Object} map The map to convert.
242
- * @returns {Array} Returns the key-value pairs.
243
- */
244
- function mapToArray(map) {
245
- var index = -1,
246
- result = Array(map.size);
247
-
248
- map.forEach(function(value, key) {
249
- result[++index] = [key, value];
250
- });
251
- return result;
252
- }
253
-
254
- /**
255
- * Creates a unary function that invokes `func` with its argument transformed.
256
- *
257
- * @private
258
- * @param {Function} func The function to wrap.
259
- * @param {Function} transform The argument transform.
260
- * @returns {Function} Returns the new function.
261
- */
262
- function overArg(func, transform) {
263
- return function(arg) {
264
- return func(transform(arg));
265
- };
266
- }
267
-
268
- /**
269
- * Converts `set` to an array of its values.
270
- *
271
- * @private
272
- * @param {Object} set The set to convert.
273
- * @returns {Array} Returns the values.
274
- */
275
- function setToArray(set) {
276
- var index = -1,
277
- result = Array(set.size);
278
-
279
- set.forEach(function(value) {
280
- result[++index] = value;
281
- });
282
- return result;
283
- }
284
-
285
- /** Used for built-in method references. */
286
- var arrayProto = Array.prototype,
287
- funcProto = Function.prototype,
288
- objectProto = Object.prototype;
289
-
290
- /** Used to detect overreaching core-js shims. */
291
- var coreJsData = root['__core-js_shared__'];
292
-
293
- /** Used to resolve the decompiled source of functions. */
294
- var funcToString = funcProto.toString;
295
-
296
- /** Used to check objects for own properties. */
297
- var hasOwnProperty = objectProto.hasOwnProperty;
298
-
299
- /** Used to detect methods masquerading as native. */
300
- var maskSrcKey = (function() {
301
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
302
- return uid ? ('Symbol(src)_1.' + uid) : '';
303
- }());
304
-
305
- /**
306
- * Used to resolve the
307
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
308
- * of values.
309
- */
310
- var nativeObjectToString = objectProto.toString;
311
-
312
- /** Used to detect if a method is native. */
313
- var reIsNative = RegExp('^' +
314
- funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
315
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
316
- );
317
-
318
- /** Built-in value references. */
319
- var Buffer = moduleExports ? root.Buffer : undefined,
320
- Symbol = root.Symbol,
321
- Uint8Array = root.Uint8Array,
322
- propertyIsEnumerable = objectProto.propertyIsEnumerable,
323
- splice = arrayProto.splice,
324
- symToStringTag = Symbol ? Symbol.toStringTag : undefined;
325
-
326
- /* Built-in method references for those with the same name as other `lodash` methods. */
327
- var nativeGetSymbols = Object.getOwnPropertySymbols,
328
- nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
329
- nativeKeys = overArg(Object.keys, Object);
330
-
331
- /* Built-in method references that are verified to be native. */
332
- var DataView = getNative(root, 'DataView'),
333
- Map = getNative(root, 'Map'),
334
- Promise = getNative(root, 'Promise'),
335
- Set = getNative(root, 'Set'),
336
- WeakMap = getNative(root, 'WeakMap'),
337
- nativeCreate = getNative(Object, 'create');
338
-
339
- /** Used to detect maps, sets, and weakmaps. */
340
- var dataViewCtorString = toSource(DataView),
341
- mapCtorString = toSource(Map),
342
- promiseCtorString = toSource(Promise),
343
- setCtorString = toSource(Set),
344
- weakMapCtorString = toSource(WeakMap);
345
-
346
- /** Used to convert symbols to primitives and strings. */
347
- var symbolProto = Symbol ? Symbol.prototype : undefined,
348
- symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
349
-
350
- /**
351
- * Creates a hash object.
352
- *
353
- * @private
354
- * @constructor
355
- * @param {Array} [entries] The key-value pairs to cache.
356
- */
357
- function Hash(entries) {
358
- var index = -1,
359
- length = entries == null ? 0 : entries.length;
360
-
361
- this.clear();
362
- while (++index < length) {
363
- var entry = entries[index];
364
- this.set(entry[0], entry[1]);
365
- }
366
- }
367
-
368
- /**
369
- * Removes all key-value entries from the hash.
370
- *
371
- * @private
372
- * @name clear
373
- * @memberOf Hash
374
- */
375
- function hashClear() {
376
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
377
- this.size = 0;
378
- }
379
-
380
- /**
381
- * Removes `key` and its value from the hash.
382
- *
383
- * @private
384
- * @name delete
385
- * @memberOf Hash
386
- * @param {Object} hash The hash to modify.
387
- * @param {string} key The key of the value to remove.
388
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
389
- */
390
- function hashDelete(key) {
391
- var result = this.has(key) && delete this.__data__[key];
392
- this.size -= result ? 1 : 0;
393
- return result;
394
- }
395
-
396
- /**
397
- * Gets the hash value for `key`.
398
- *
399
- * @private
400
- * @name get
401
- * @memberOf Hash
402
- * @param {string} key The key of the value to get.
403
- * @returns {*} Returns the entry value.
404
- */
405
- function hashGet(key) {
406
- var data = this.__data__;
407
- if (nativeCreate) {
408
- var result = data[key];
409
- return result === HASH_UNDEFINED ? undefined : result;
410
- }
411
- return hasOwnProperty.call(data, key) ? data[key] : undefined;
412
- }
413
-
414
- /**
415
- * Checks if a hash value for `key` exists.
416
- *
417
- * @private
418
- * @name has
419
- * @memberOf Hash
420
- * @param {string} key The key of the entry to check.
421
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
422
- */
423
- function hashHas(key) {
424
- var data = this.__data__;
425
- return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
426
- }
427
-
428
- /**
429
- * Sets the hash `key` to `value`.
430
- *
431
- * @private
432
- * @name set
433
- * @memberOf Hash
434
- * @param {string} key The key of the value to set.
435
- * @param {*} value The value to set.
436
- * @returns {Object} Returns the hash instance.
437
- */
438
- function hashSet(key, value) {
439
- var data = this.__data__;
440
- this.size += this.has(key) ? 0 : 1;
441
- data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
442
- return this;
443
- }
444
-
445
- // Add methods to `Hash`.
446
- Hash.prototype.clear = hashClear;
447
- Hash.prototype['delete'] = hashDelete;
448
- Hash.prototype.get = hashGet;
449
- Hash.prototype.has = hashHas;
450
- Hash.prototype.set = hashSet;
451
-
452
- /**
453
- * Creates an list cache object.
454
- *
455
- * @private
456
- * @constructor
457
- * @param {Array} [entries] The key-value pairs to cache.
458
- */
459
- function ListCache(entries) {
460
- var index = -1,
461
- length = entries == null ? 0 : entries.length;
462
-
463
- this.clear();
464
- while (++index < length) {
465
- var entry = entries[index];
466
- this.set(entry[0], entry[1]);
467
- }
468
- }
469
-
470
- /**
471
- * Removes all key-value entries from the list cache.
472
- *
473
- * @private
474
- * @name clear
475
- * @memberOf ListCache
476
- */
477
- function listCacheClear() {
478
- this.__data__ = [];
479
- this.size = 0;
480
- }
481
-
482
- /**
483
- * Removes `key` and its value from the list cache.
484
- *
485
- * @private
486
- * @name delete
487
- * @memberOf ListCache
488
- * @param {string} key The key of the value to remove.
489
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
490
- */
491
- function listCacheDelete(key) {
492
- var data = this.__data__,
493
- index = assocIndexOf(data, key);
494
-
495
- if (index < 0) {
496
- return false;
497
- }
498
- var lastIndex = data.length - 1;
499
- if (index == lastIndex) {
500
- data.pop();
501
- } else {
502
- splice.call(data, index, 1);
503
- }
504
- --this.size;
505
- return true;
506
- }
507
-
508
- /**
509
- * Gets the list cache value for `key`.
510
- *
511
- * @private
512
- * @name get
513
- * @memberOf ListCache
514
- * @param {string} key The key of the value to get.
515
- * @returns {*} Returns the entry value.
516
- */
517
- function listCacheGet(key) {
518
- var data = this.__data__,
519
- index = assocIndexOf(data, key);
520
-
521
- return index < 0 ? undefined : data[index][1];
522
- }
523
-
524
- /**
525
- * Checks if a list cache value for `key` exists.
526
- *
527
- * @private
528
- * @name has
529
- * @memberOf ListCache
530
- * @param {string} key The key of the entry to check.
531
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
532
- */
533
- function listCacheHas(key) {
534
- return assocIndexOf(this.__data__, key) > -1;
535
- }
536
-
537
- /**
538
- * Sets the list cache `key` to `value`.
539
- *
540
- * @private
541
- * @name set
542
- * @memberOf ListCache
543
- * @param {string} key The key of the value to set.
544
- * @param {*} value The value to set.
545
- * @returns {Object} Returns the list cache instance.
546
- */
547
- function listCacheSet(key, value) {
548
- var data = this.__data__,
549
- index = assocIndexOf(data, key);
550
-
551
- if (index < 0) {
552
- ++this.size;
553
- data.push([key, value]);
554
- } else {
555
- data[index][1] = value;
556
- }
557
- return this;
558
- }
559
-
560
- // Add methods to `ListCache`.
561
- ListCache.prototype.clear = listCacheClear;
562
- ListCache.prototype['delete'] = listCacheDelete;
563
- ListCache.prototype.get = listCacheGet;
564
- ListCache.prototype.has = listCacheHas;
565
- ListCache.prototype.set = listCacheSet;
566
-
567
- /**
568
- * Creates a map cache object to store key-value pairs.
569
- *
570
- * @private
571
- * @constructor
572
- * @param {Array} [entries] The key-value pairs to cache.
573
- */
574
- function MapCache(entries) {
575
- var index = -1,
576
- length = entries == null ? 0 : entries.length;
577
-
578
- this.clear();
579
- while (++index < length) {
580
- var entry = entries[index];
581
- this.set(entry[0], entry[1]);
582
- }
583
- }
584
-
585
- /**
586
- * Removes all key-value entries from the map.
587
- *
588
- * @private
589
- * @name clear
590
- * @memberOf MapCache
591
- */
592
- function mapCacheClear() {
593
- this.size = 0;
594
- this.__data__ = {
595
- 'hash': new Hash,
596
- 'map': new (Map || ListCache),
597
- 'string': new Hash
598
- };
599
- }
600
-
601
- /**
602
- * Removes `key` and its value from the map.
603
- *
604
- * @private
605
- * @name delete
606
- * @memberOf MapCache
607
- * @param {string} key The key of the value to remove.
608
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
609
- */
610
- function mapCacheDelete(key) {
611
- var result = getMapData(this, key)['delete'](key);
612
- this.size -= result ? 1 : 0;
613
- return result;
614
- }
615
-
616
- /**
617
- * Gets the map value for `key`.
618
- *
619
- * @private
620
- * @name get
621
- * @memberOf MapCache
622
- * @param {string} key The key of the value to get.
623
- * @returns {*} Returns the entry value.
624
- */
625
- function mapCacheGet(key) {
626
- return getMapData(this, key).get(key);
627
- }
628
-
629
- /**
630
- * Checks if a map value for `key` exists.
631
- *
632
- * @private
633
- * @name has
634
- * @memberOf MapCache
635
- * @param {string} key The key of the entry to check.
636
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
637
- */
638
- function mapCacheHas(key) {
639
- return getMapData(this, key).has(key);
640
- }
641
-
642
- /**
643
- * Sets the map `key` to `value`.
644
- *
645
- * @private
646
- * @name set
647
- * @memberOf MapCache
648
- * @param {string} key The key of the value to set.
649
- * @param {*} value The value to set.
650
- * @returns {Object} Returns the map cache instance.
651
- */
652
- function mapCacheSet(key, value) {
653
- var data = getMapData(this, key),
654
- size = data.size;
655
-
656
- data.set(key, value);
657
- this.size += data.size == size ? 0 : 1;
658
- return this;
659
- }
660
-
661
- // Add methods to `MapCache`.
662
- MapCache.prototype.clear = mapCacheClear;
663
- MapCache.prototype['delete'] = mapCacheDelete;
664
- MapCache.prototype.get = mapCacheGet;
665
- MapCache.prototype.has = mapCacheHas;
666
- MapCache.prototype.set = mapCacheSet;
667
-
668
- /**
669
- *
670
- * Creates an array cache object to store unique values.
671
- *
672
- * @private
673
- * @constructor
674
- * @param {Array} [values] The values to cache.
675
- */
676
- function SetCache(values) {
677
- var index = -1,
678
- length = values == null ? 0 : values.length;
679
-
680
- this.__data__ = new MapCache;
681
- while (++index < length) {
682
- this.add(values[index]);
683
- }
684
- }
685
-
686
- /**
687
- * Adds `value` to the array cache.
688
- *
689
- * @private
690
- * @name add
691
- * @memberOf SetCache
692
- * @alias push
693
- * @param {*} value The value to cache.
694
- * @returns {Object} Returns the cache instance.
695
- */
696
- function setCacheAdd(value) {
697
- this.__data__.set(value, HASH_UNDEFINED);
698
- return this;
699
- }
700
-
701
- /**
702
- * Checks if `value` is in the array cache.
703
- *
704
- * @private
705
- * @name has
706
- * @memberOf SetCache
707
- * @param {*} value The value to search for.
708
- * @returns {number} Returns `true` if `value` is found, else `false`.
709
- */
710
- function setCacheHas(value) {
711
- return this.__data__.has(value);
712
- }
713
-
714
- // Add methods to `SetCache`.
715
- SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
716
- SetCache.prototype.has = setCacheHas;
717
-
718
- /**
719
- * Creates a stack cache object to store key-value pairs.
720
- *
721
- * @private
722
- * @constructor
723
- * @param {Array} [entries] The key-value pairs to cache.
724
- */
725
- function Stack(entries) {
726
- var data = this.__data__ = new ListCache(entries);
727
- this.size = data.size;
728
- }
729
-
730
- /**
731
- * Removes all key-value entries from the stack.
732
- *
733
- * @private
734
- * @name clear
735
- * @memberOf Stack
736
- */
737
- function stackClear() {
738
- this.__data__ = new ListCache;
739
- this.size = 0;
740
- }
741
-
742
- /**
743
- * Removes `key` and its value from the stack.
744
- *
745
- * @private
746
- * @name delete
747
- * @memberOf Stack
748
- * @param {string} key The key of the value to remove.
749
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
750
- */
751
- function stackDelete(key) {
752
- var data = this.__data__,
753
- result = data['delete'](key);
754
-
755
- this.size = data.size;
756
- return result;
757
- }
758
-
759
- /**
760
- * Gets the stack value for `key`.
761
- *
762
- * @private
763
- * @name get
764
- * @memberOf Stack
765
- * @param {string} key The key of the value to get.
766
- * @returns {*} Returns the entry value.
767
- */
768
- function stackGet(key) {
769
- return this.__data__.get(key);
770
- }
771
-
772
- /**
773
- * Checks if a stack value for `key` exists.
774
- *
775
- * @private
776
- * @name has
777
- * @memberOf Stack
778
- * @param {string} key The key of the entry to check.
779
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
780
- */
781
- function stackHas(key) {
782
- return this.__data__.has(key);
783
- }
784
-
785
- /**
786
- * Sets the stack `key` to `value`.
787
- *
788
- * @private
789
- * @name set
790
- * @memberOf Stack
791
- * @param {string} key The key of the value to set.
792
- * @param {*} value The value to set.
793
- * @returns {Object} Returns the stack cache instance.
794
- */
795
- function stackSet(key, value) {
796
- var data = this.__data__;
797
- if (data instanceof ListCache) {
798
- var pairs = data.__data__;
799
- if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
800
- pairs.push([key, value]);
801
- this.size = ++data.size;
802
- return this;
803
- }
804
- data = this.__data__ = new MapCache(pairs);
805
- }
806
- data.set(key, value);
807
- this.size = data.size;
808
- return this;
809
- }
810
-
811
- // Add methods to `Stack`.
812
- Stack.prototype.clear = stackClear;
813
- Stack.prototype['delete'] = stackDelete;
814
- Stack.prototype.get = stackGet;
815
- Stack.prototype.has = stackHas;
816
- Stack.prototype.set = stackSet;
817
-
818
- /**
819
- * Creates an array of the enumerable property names of the array-like `value`.
820
- *
821
- * @private
822
- * @param {*} value The value to query.
823
- * @param {boolean} inherited Specify returning inherited property names.
824
- * @returns {Array} Returns the array of property names.
825
- */
826
- function arrayLikeKeys(value, inherited) {
827
- var isArr = isArray(value),
828
- isArg = !isArr && isArguments(value),
829
- isBuff = !isArr && !isArg && isBuffer(value),
830
- isType = !isArr && !isArg && !isBuff && isTypedArray(value),
831
- skipIndexes = isArr || isArg || isBuff || isType,
832
- result = skipIndexes ? baseTimes(value.length, String) : [],
833
- length = result.length;
834
-
835
- for (var key in value) {
836
- if ((inherited || hasOwnProperty.call(value, key)) &&
837
- !(skipIndexes && (
838
- // Safari 9 has enumerable `arguments.length` in strict mode.
839
- key == 'length' ||
840
- // Node.js 0.10 has enumerable non-index properties on buffers.
841
- (isBuff && (key == 'offset' || key == 'parent')) ||
842
- // PhantomJS 2 has enumerable non-index properties on typed arrays.
843
- (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
844
- // Skip index properties.
845
- isIndex(key, length)
846
- ))) {
847
- result.push(key);
848
- }
849
- }
850
- return result;
851
- }
852
-
853
- /**
854
- * Gets the index at which the `key` is found in `array` of key-value pairs.
855
- *
856
- * @private
857
- * @param {Array} array The array to inspect.
858
- * @param {*} key The key to search for.
859
- * @returns {number} Returns the index of the matched value, else `-1`.
860
- */
861
- function assocIndexOf(array, key) {
862
- var length = array.length;
863
- while (length--) {
864
- if (eq(array[length][0], key)) {
865
- return length;
866
- }
867
- }
868
- return -1;
869
- }
870
-
871
- /**
872
- * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
873
- * `keysFunc` and `symbolsFunc` to get the enumerable property names and
874
- * symbols of `object`.
875
- *
876
- * @private
877
- * @param {Object} object The object to query.
878
- * @param {Function} keysFunc The function to get the keys of `object`.
879
- * @param {Function} symbolsFunc The function to get the symbols of `object`.
880
- * @returns {Array} Returns the array of property names and symbols.
881
- */
882
- function baseGetAllKeys(object, keysFunc, symbolsFunc) {
883
- var result = keysFunc(object);
884
- return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
885
- }
886
-
887
- /**
888
- * The base implementation of `getTag` without fallbacks for buggy environments.
889
- *
890
- * @private
891
- * @param {*} value The value to query.
892
- * @returns {string} Returns the `toStringTag`.
893
- */
894
- function baseGetTag(value) {
895
- if (value == null) {
896
- return value === undefined ? undefinedTag : nullTag;
897
- }
898
- return (symToStringTag && symToStringTag in Object(value))
899
- ? getRawTag(value)
900
- : objectToString(value);
901
- }
902
-
903
- /**
904
- * The base implementation of `_.isArguments`.
905
- *
906
- * @private
907
- * @param {*} value The value to check.
908
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
909
- */
910
- function baseIsArguments(value) {
911
- return isObjectLike(value) && baseGetTag(value) == argsTag;
912
- }
913
-
914
- /**
915
- * The base implementation of `_.isEqual` which supports partial comparisons
916
- * and tracks traversed objects.
917
- *
918
- * @private
919
- * @param {*} value The value to compare.
920
- * @param {*} other The other value to compare.
921
- * @param {boolean} bitmask The bitmask flags.
922
- * 1 - Unordered comparison
923
- * 2 - Partial comparison
924
- * @param {Function} [customizer] The function to customize comparisons.
925
- * @param {Object} [stack] Tracks traversed `value` and `other` objects.
926
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
927
- */
928
- function baseIsEqual(value, other, bitmask, customizer, stack) {
929
- if (value === other) {
930
- return true;
931
- }
932
- if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
933
- return value !== value && other !== other;
934
- }
935
- return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
936
- }
937
-
938
- /**
939
- * A specialized version of `baseIsEqual` for arrays and objects which performs
940
- * deep comparisons and tracks traversed objects enabling objects with circular
941
- * references to be compared.
942
- *
943
- * @private
944
- * @param {Object} object The object to compare.
945
- * @param {Object} other The other object to compare.
946
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
947
- * @param {Function} customizer The function to customize comparisons.
948
- * @param {Function} equalFunc The function to determine equivalents of values.
949
- * @param {Object} [stack] Tracks traversed `object` and `other` objects.
950
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
951
- */
952
- function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
953
- var objIsArr = isArray(object),
954
- othIsArr = isArray(other),
955
- objTag = objIsArr ? arrayTag : getTag(object),
956
- othTag = othIsArr ? arrayTag : getTag(other);
957
-
958
- objTag = objTag == argsTag ? objectTag : objTag;
959
- othTag = othTag == argsTag ? objectTag : othTag;
960
-
961
- var objIsObj = objTag == objectTag,
962
- othIsObj = othTag == objectTag,
963
- isSameTag = objTag == othTag;
964
-
965
- if (isSameTag && isBuffer(object)) {
966
- if (!isBuffer(other)) {
967
- return false;
968
- }
969
- objIsArr = true;
970
- objIsObj = false;
971
- }
972
- if (isSameTag && !objIsObj) {
973
- stack || (stack = new Stack);
974
- return (objIsArr || isTypedArray(object))
975
- ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
976
- : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
977
- }
978
- if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
979
- var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
980
- othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
981
-
982
- if (objIsWrapped || othIsWrapped) {
983
- var objUnwrapped = objIsWrapped ? object.value() : object,
984
- othUnwrapped = othIsWrapped ? other.value() : other;
985
-
986
- stack || (stack = new Stack);
987
- return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
988
- }
989
- }
990
- if (!isSameTag) {
991
- return false;
992
- }
993
- stack || (stack = new Stack);
994
- return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
995
- }
996
-
997
- /**
998
- * The base implementation of `_.isNative` without bad shim checks.
999
- *
1000
- * @private
1001
- * @param {*} value The value to check.
1002
- * @returns {boolean} Returns `true` if `value` is a native function,
1003
- * else `false`.
1004
- */
1005
- function baseIsNative(value) {
1006
- if (!isObject(value) || isMasked(value)) {
1007
- return false;
1008
- }
1009
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
1010
- return pattern.test(toSource(value));
1011
- }
1012
-
1013
- /**
1014
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
1015
- *
1016
- * @private
1017
- * @param {*} value The value to check.
1018
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1019
- */
1020
- function baseIsTypedArray(value) {
1021
- return isObjectLike(value) &&
1022
- isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
1023
- }
1024
-
1025
- /**
1026
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
1027
- *
1028
- * @private
1029
- * @param {Object} object The object to query.
1030
- * @returns {Array} Returns the array of property names.
1031
- */
1032
- function baseKeys(object) {
1033
- if (!isPrototype(object)) {
1034
- return nativeKeys(object);
1035
- }
1036
- var result = [];
1037
- for (var key in Object(object)) {
1038
- if (hasOwnProperty.call(object, key) && key != 'constructor') {
1039
- result.push(key);
1040
- }
1041
- }
1042
- return result;
1043
- }
1044
-
1045
- /**
1046
- * A specialized version of `baseIsEqualDeep` for arrays with support for
1047
- * partial deep comparisons.
1048
- *
1049
- * @private
1050
- * @param {Array} array The array to compare.
1051
- * @param {Array} other The other array to compare.
1052
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1053
- * @param {Function} customizer The function to customize comparisons.
1054
- * @param {Function} equalFunc The function to determine equivalents of values.
1055
- * @param {Object} stack Tracks traversed `array` and `other` objects.
1056
- * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
1057
- */
1058
- function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
1059
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
1060
- arrLength = array.length,
1061
- othLength = other.length;
1062
-
1063
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
1064
- return false;
1065
- }
1066
- // Assume cyclic values are equal.
1067
- var stacked = stack.get(array);
1068
- if (stacked && stack.get(other)) {
1069
- return stacked == other;
1070
- }
1071
- var index = -1,
1072
- result = true,
1073
- seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
1074
-
1075
- stack.set(array, other);
1076
- stack.set(other, array);
1077
-
1078
- // Ignore non-index properties.
1079
- while (++index < arrLength) {
1080
- var arrValue = array[index],
1081
- othValue = other[index];
1082
-
1083
- if (customizer) {
1084
- var compared = isPartial
1085
- ? customizer(othValue, arrValue, index, other, array, stack)
1086
- : customizer(arrValue, othValue, index, array, other, stack);
1087
- }
1088
- if (compared !== undefined) {
1089
- if (compared) {
1090
- continue;
1091
- }
1092
- result = false;
1093
- break;
1094
- }
1095
- // Recursively compare arrays (susceptible to call stack limits).
1096
- if (seen) {
1097
- if (!arraySome(other, function(othValue, othIndex) {
1098
- if (!cacheHas(seen, othIndex) &&
1099
- (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
1100
- return seen.push(othIndex);
1101
- }
1102
- })) {
1103
- result = false;
1104
- break;
1105
- }
1106
- } else if (!(
1107
- arrValue === othValue ||
1108
- equalFunc(arrValue, othValue, bitmask, customizer, stack)
1109
- )) {
1110
- result = false;
1111
- break;
1112
- }
1113
- }
1114
- stack['delete'](array);
1115
- stack['delete'](other);
1116
- return result;
1117
- }
1118
-
1119
- /**
1120
- * A specialized version of `baseIsEqualDeep` for comparing objects of
1121
- * the same `toStringTag`.
1122
- *
1123
- * **Note:** This function only supports comparing values with tags of
1124
- * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
1125
- *
1126
- * @private
1127
- * @param {Object} object The object to compare.
1128
- * @param {Object} other The other object to compare.
1129
- * @param {string} tag The `toStringTag` of the objects to compare.
1130
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1131
- * @param {Function} customizer The function to customize comparisons.
1132
- * @param {Function} equalFunc The function to determine equivalents of values.
1133
- * @param {Object} stack Tracks traversed `object` and `other` objects.
1134
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1135
- */
1136
- function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
1137
- switch (tag) {
1138
- case dataViewTag:
1139
- if ((object.byteLength != other.byteLength) ||
1140
- (object.byteOffset != other.byteOffset)) {
1141
- return false;
1142
- }
1143
- object = object.buffer;
1144
- other = other.buffer;
1145
-
1146
- case arrayBufferTag:
1147
- if ((object.byteLength != other.byteLength) ||
1148
- !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
1149
- return false;
1150
- }
1151
- return true;
1152
-
1153
- case boolTag:
1154
- case dateTag:
1155
- case numberTag:
1156
- // Coerce booleans to `1` or `0` and dates to milliseconds.
1157
- // Invalid dates are coerced to `NaN`.
1158
- return eq(+object, +other);
1159
-
1160
- case errorTag:
1161
- return object.name == other.name && object.message == other.message;
1162
-
1163
- case regexpTag:
1164
- case stringTag:
1165
- // Coerce regexes to strings and treat strings, primitives and objects,
1166
- // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
1167
- // for more details.
1168
- return object == (other + '');
1169
-
1170
- case mapTag:
1171
- var convert = mapToArray;
1172
-
1173
- case setTag:
1174
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
1175
- convert || (convert = setToArray);
1176
-
1177
- if (object.size != other.size && !isPartial) {
1178
- return false;
1179
- }
1180
- // Assume cyclic values are equal.
1181
- var stacked = stack.get(object);
1182
- if (stacked) {
1183
- return stacked == other;
1184
- }
1185
- bitmask |= COMPARE_UNORDERED_FLAG;
1186
-
1187
- // Recursively compare objects (susceptible to call stack limits).
1188
- stack.set(object, other);
1189
- var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
1190
- stack['delete'](object);
1191
- return result;
1192
-
1193
- case symbolTag:
1194
- if (symbolValueOf) {
1195
- return symbolValueOf.call(object) == symbolValueOf.call(other);
1196
- }
1197
- }
1198
- return false;
1199
- }
1200
-
1201
- /**
1202
- * A specialized version of `baseIsEqualDeep` for objects with support for
1203
- * partial deep comparisons.
1204
- *
1205
- * @private
1206
- * @param {Object} object The object to compare.
1207
- * @param {Object} other The other object to compare.
1208
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1209
- * @param {Function} customizer The function to customize comparisons.
1210
- * @param {Function} equalFunc The function to determine equivalents of values.
1211
- * @param {Object} stack Tracks traversed `object` and `other` objects.
1212
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1213
- */
1214
- function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
1215
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
1216
- objProps = getAllKeys(object),
1217
- objLength = objProps.length,
1218
- othProps = getAllKeys(other),
1219
- othLength = othProps.length;
1220
-
1221
- if (objLength != othLength && !isPartial) {
1222
- return false;
1223
- }
1224
- var index = objLength;
1225
- while (index--) {
1226
- var key = objProps[index];
1227
- if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
1228
- return false;
1229
- }
1230
- }
1231
- // Assume cyclic values are equal.
1232
- var stacked = stack.get(object);
1233
- if (stacked && stack.get(other)) {
1234
- return stacked == other;
1235
- }
1236
- var result = true;
1237
- stack.set(object, other);
1238
- stack.set(other, object);
1239
-
1240
- var skipCtor = isPartial;
1241
- while (++index < objLength) {
1242
- key = objProps[index];
1243
- var objValue = object[key],
1244
- othValue = other[key];
1245
-
1246
- if (customizer) {
1247
- var compared = isPartial
1248
- ? customizer(othValue, objValue, key, other, object, stack)
1249
- : customizer(objValue, othValue, key, object, other, stack);
1250
- }
1251
- // Recursively compare objects (susceptible to call stack limits).
1252
- if (!(compared === undefined
1253
- ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
1254
- : compared
1255
- )) {
1256
- result = false;
1257
- break;
1258
- }
1259
- skipCtor || (skipCtor = key == 'constructor');
1260
- }
1261
- if (result && !skipCtor) {
1262
- var objCtor = object.constructor,
1263
- othCtor = other.constructor;
1264
-
1265
- // Non `Object` object instances with different constructors are not equal.
1266
- if (objCtor != othCtor &&
1267
- ('constructor' in object && 'constructor' in other) &&
1268
- !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
1269
- typeof othCtor == 'function' && othCtor instanceof othCtor)) {
1270
- result = false;
1271
- }
1272
- }
1273
- stack['delete'](object);
1274
- stack['delete'](other);
1275
- return result;
1276
- }
1277
-
1278
- /**
1279
- * Creates an array of own enumerable property names and symbols of `object`.
1280
- *
1281
- * @private
1282
- * @param {Object} object The object to query.
1283
- * @returns {Array} Returns the array of property names and symbols.
1284
- */
1285
- function getAllKeys(object) {
1286
- return baseGetAllKeys(object, keys, getSymbols);
1287
- }
1288
-
1289
- /**
1290
- * Gets the data for `map`.
1291
- *
1292
- * @private
1293
- * @param {Object} map The map to query.
1294
- * @param {string} key The reference key.
1295
- * @returns {*} Returns the map data.
1296
- */
1297
- function getMapData(map, key) {
1298
- var data = map.__data__;
1299
- return isKeyable(key)
1300
- ? data[typeof key == 'string' ? 'string' : 'hash']
1301
- : data.map;
1302
- }
1303
-
1304
- /**
1305
- * Gets the native function at `key` of `object`.
1306
- *
1307
- * @private
1308
- * @param {Object} object The object to query.
1309
- * @param {string} key The key of the method to get.
1310
- * @returns {*} Returns the function if it's native, else `undefined`.
1311
- */
1312
- function getNative(object, key) {
1313
- var value = getValue(object, key);
1314
- return baseIsNative(value) ? value : undefined;
1315
- }
1316
-
1317
- /**
1318
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
1319
- *
1320
- * @private
1321
- * @param {*} value The value to query.
1322
- * @returns {string} Returns the raw `toStringTag`.
1323
- */
1324
- function getRawTag(value) {
1325
- var isOwn = hasOwnProperty.call(value, symToStringTag),
1326
- tag = value[symToStringTag];
1327
-
1328
- try {
1329
- value[symToStringTag] = undefined;
1330
- var unmasked = true;
1331
- } catch (e) {}
1332
-
1333
- var result = nativeObjectToString.call(value);
1334
- if (unmasked) {
1335
- if (isOwn) {
1336
- value[symToStringTag] = tag;
1337
- } else {
1338
- delete value[symToStringTag];
1339
- }
1340
- }
1341
- return result;
1342
- }
1343
-
1344
- /**
1345
- * Creates an array of the own enumerable symbols of `object`.
1346
- *
1347
- * @private
1348
- * @param {Object} object The object to query.
1349
- * @returns {Array} Returns the array of symbols.
1350
- */
1351
- var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
1352
- if (object == null) {
1353
- return [];
1354
- }
1355
- object = Object(object);
1356
- return arrayFilter(nativeGetSymbols(object), function(symbol) {
1357
- return propertyIsEnumerable.call(object, symbol);
1358
- });
1359
- };
1360
-
1361
- /**
1362
- * Gets the `toStringTag` of `value`.
1363
- *
1364
- * @private
1365
- * @param {*} value The value to query.
1366
- * @returns {string} Returns the `toStringTag`.
1367
- */
1368
- var getTag = baseGetTag;
1369
-
1370
- // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
1371
- if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
1372
- (Map && getTag(new Map) != mapTag) ||
1373
- (Promise && getTag(Promise.resolve()) != promiseTag) ||
1374
- (Set && getTag(new Set) != setTag) ||
1375
- (WeakMap && getTag(new WeakMap) != weakMapTag)) {
1376
- getTag = function(value) {
1377
- var result = baseGetTag(value),
1378
- Ctor = result == objectTag ? value.constructor : undefined,
1379
- ctorString = Ctor ? toSource(Ctor) : '';
1380
-
1381
- if (ctorString) {
1382
- switch (ctorString) {
1383
- case dataViewCtorString: return dataViewTag;
1384
- case mapCtorString: return mapTag;
1385
- case promiseCtorString: return promiseTag;
1386
- case setCtorString: return setTag;
1387
- case weakMapCtorString: return weakMapTag;
1388
- }
1389
- }
1390
- return result;
1391
- };
1392
- }
1393
-
1394
- /**
1395
- * Checks if `value` is a valid array-like index.
1396
- *
1397
- * @private
1398
- * @param {*} value The value to check.
1399
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
1400
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
1401
- */
1402
- function isIndex(value, length) {
1403
- length = length == null ? MAX_SAFE_INTEGER : length;
1404
- return !!length &&
1405
- (typeof value == 'number' || reIsUint.test(value)) &&
1406
- (value > -1 && value % 1 == 0 && value < length);
1407
- }
1408
-
1409
- /**
1410
- * Checks if `value` is suitable for use as unique object key.
1411
- *
1412
- * @private
1413
- * @param {*} value The value to check.
1414
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
1415
- */
1416
- function isKeyable(value) {
1417
- var type = typeof value;
1418
- return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
1419
- ? (value !== '__proto__')
1420
- : (value === null);
1421
- }
1422
-
1423
- /**
1424
- * Checks if `func` has its source masked.
1425
- *
1426
- * @private
1427
- * @param {Function} func The function to check.
1428
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
1429
- */
1430
- function isMasked(func) {
1431
- return !!maskSrcKey && (maskSrcKey in func);
1432
- }
1433
-
1434
- /**
1435
- * Checks if `value` is likely a prototype object.
1436
- *
1437
- * @private
1438
- * @param {*} value The value to check.
1439
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
1440
- */
1441
- function isPrototype(value) {
1442
- var Ctor = value && value.constructor,
1443
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
1444
-
1445
- return value === proto;
1446
- }
1447
-
1448
- /**
1449
- * Converts `value` to a string using `Object.prototype.toString`.
1450
- *
1451
- * @private
1452
- * @param {*} value The value to convert.
1453
- * @returns {string} Returns the converted string.
1454
- */
1455
- function objectToString(value) {
1456
- return nativeObjectToString.call(value);
1457
- }
1458
-
1459
- /**
1460
- * Converts `func` to its source code.
1461
- *
1462
- * @private
1463
- * @param {Function} func The function to convert.
1464
- * @returns {string} Returns the source code.
1465
- */
1466
- function toSource(func) {
1467
- if (func != null) {
1468
- try {
1469
- return funcToString.call(func);
1470
- } catch (e) {}
1471
- try {
1472
- return (func + '');
1473
- } catch (e) {}
1474
- }
1475
- return '';
1476
- }
1477
-
1478
- /**
1479
- * Performs a
1480
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1481
- * comparison between two values to determine if they are equivalent.
1482
- *
1483
- * @static
1484
- * @memberOf _
1485
- * @since 4.0.0
1486
- * @category Lang
1487
- * @param {*} value The value to compare.
1488
- * @param {*} other The other value to compare.
1489
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1490
- * @example
1491
- *
1492
- * var object = { 'a': 1 };
1493
- * var other = { 'a': 1 };
1494
- *
1495
- * _.eq(object, object);
1496
- * // => true
1497
- *
1498
- * _.eq(object, other);
1499
- * // => false
1500
- *
1501
- * _.eq('a', 'a');
1502
- * // => true
1503
- *
1504
- * _.eq('a', Object('a'));
1505
- * // => false
1506
- *
1507
- * _.eq(NaN, NaN);
1508
- * // => true
1509
- */
1510
- function eq(value, other) {
1511
- return value === other || (value !== value && other !== other);
1512
- }
1513
-
1514
- /**
1515
- * Checks if `value` is likely an `arguments` object.
1516
- *
1517
- * @static
1518
- * @memberOf _
1519
- * @since 0.1.0
1520
- * @category Lang
1521
- * @param {*} value The value to check.
1522
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1523
- * else `false`.
1524
- * @example
1525
- *
1526
- * _.isArguments(function() { return arguments; }());
1527
- * // => true
1528
- *
1529
- * _.isArguments([1, 2, 3]);
1530
- * // => false
1531
- */
1532
- var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
1533
- return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
1534
- !propertyIsEnumerable.call(value, 'callee');
1535
- };
1536
-
1537
- /**
1538
- * Checks if `value` is classified as an `Array` object.
1539
- *
1540
- * @static
1541
- * @memberOf _
1542
- * @since 0.1.0
1543
- * @category Lang
1544
- * @param {*} value The value to check.
1545
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1546
- * @example
1547
- *
1548
- * _.isArray([1, 2, 3]);
1549
- * // => true
1550
- *
1551
- * _.isArray(document.body.children);
1552
- * // => false
1553
- *
1554
- * _.isArray('abc');
1555
- * // => false
1556
- *
1557
- * _.isArray(_.noop);
1558
- * // => false
1559
- */
1560
- var isArray = Array.isArray;
1561
-
1562
- /**
1563
- * Checks if `value` is array-like. A value is considered array-like if it's
1564
- * not a function and has a `value.length` that's an integer greater than or
1565
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
1566
- *
1567
- * @static
1568
- * @memberOf _
1569
- * @since 4.0.0
1570
- * @category Lang
1571
- * @param {*} value The value to check.
1572
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
1573
- * @example
1574
- *
1575
- * _.isArrayLike([1, 2, 3]);
1576
- * // => true
1577
- *
1578
- * _.isArrayLike(document.body.children);
1579
- * // => true
1580
- *
1581
- * _.isArrayLike('abc');
1582
- * // => true
1583
- *
1584
- * _.isArrayLike(_.noop);
1585
- * // => false
1586
- */
1587
- function isArrayLike(value) {
1588
- return value != null && isLength(value.length) && !isFunction(value);
1589
- }
1590
-
1591
- /**
1592
- * Checks if `value` is a buffer.
1593
- *
1594
- * @static
1595
- * @memberOf _
1596
- * @since 4.3.0
1597
- * @category Lang
1598
- * @param {*} value The value to check.
1599
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1600
- * @example
1601
- *
1602
- * _.isBuffer(new Buffer(2));
1603
- * // => true
1604
- *
1605
- * _.isBuffer(new Uint8Array(2));
1606
- * // => false
1607
- */
1608
- var isBuffer = nativeIsBuffer || stubFalse;
1609
-
1610
- /**
1611
- * Performs a deep comparison between two values to determine if they are
1612
- * equivalent.
1613
- *
1614
- * **Note:** This method supports comparing arrays, array buffers, booleans,
1615
- * date objects, error objects, maps, numbers, `Object` objects, regexes,
1616
- * sets, strings, symbols, and typed arrays. `Object` objects are compared
1617
- * by their own, not inherited, enumerable properties. Functions and DOM
1618
- * nodes are compared by strict equality, i.e. `===`.
1619
- *
1620
- * @static
1621
- * @memberOf _
1622
- * @since 0.1.0
1623
- * @category Lang
1624
- * @param {*} value The value to compare.
1625
- * @param {*} other The other value to compare.
1626
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1627
- * @example
1628
- *
1629
- * var object = { 'a': 1 };
1630
- * var other = { 'a': 1 };
1631
- *
1632
- * _.isEqual(object, other);
1633
- * // => true
1634
- *
1635
- * object === other;
1636
- * // => false
1637
- */
1638
- function isEqual(value, other) {
1639
- return baseIsEqual(value, other);
1640
- }
1641
-
1642
- /**
1643
- * Checks if `value` is classified as a `Function` object.
1644
- *
1645
- * @static
1646
- * @memberOf _
1647
- * @since 0.1.0
1648
- * @category Lang
1649
- * @param {*} value The value to check.
1650
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1651
- * @example
1652
- *
1653
- * _.isFunction(_);
1654
- * // => true
1655
- *
1656
- * _.isFunction(/abc/);
1657
- * // => false
1658
- */
1659
- function isFunction(value) {
1660
- if (!isObject(value)) {
1661
- return false;
1662
- }
1663
- // The use of `Object#toString` avoids issues with the `typeof` operator
1664
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
1665
- var tag = baseGetTag(value);
1666
- return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
1667
- }
1668
-
1669
- /**
1670
- * Checks if `value` is a valid array-like length.
1671
- *
1672
- * **Note:** This method is loosely based on
1673
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
1674
- *
1675
- * @static
1676
- * @memberOf _
1677
- * @since 4.0.0
1678
- * @category Lang
1679
- * @param {*} value The value to check.
1680
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
1681
- * @example
1682
- *
1683
- * _.isLength(3);
1684
- * // => true
1685
- *
1686
- * _.isLength(Number.MIN_VALUE);
1687
- * // => false
1688
- *
1689
- * _.isLength(Infinity);
1690
- * // => false
1691
- *
1692
- * _.isLength('3');
1693
- * // => false
1694
- */
1695
- function isLength(value) {
1696
- return typeof value == 'number' &&
1697
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
1698
- }
1699
-
1700
- /**
1701
- * Checks if `value` is the
1702
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1703
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1704
- *
1705
- * @static
1706
- * @memberOf _
1707
- * @since 0.1.0
1708
- * @category Lang
1709
- * @param {*} value The value to check.
1710
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1711
- * @example
1712
- *
1713
- * _.isObject({});
1714
- * // => true
1715
- *
1716
- * _.isObject([1, 2, 3]);
1717
- * // => true
1718
- *
1719
- * _.isObject(_.noop);
1720
- * // => true
1721
- *
1722
- * _.isObject(null);
1723
- * // => false
1724
- */
1725
- function isObject(value) {
1726
- var type = typeof value;
1727
- return value != null && (type == 'object' || type == 'function');
1728
- }
1729
-
1730
- /**
1731
- * Checks if `value` is object-like. A value is object-like if it's not `null`
1732
- * and has a `typeof` result of "object".
1733
- *
1734
- * @static
1735
- * @memberOf _
1736
- * @since 4.0.0
1737
- * @category Lang
1738
- * @param {*} value The value to check.
1739
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1740
- * @example
1741
- *
1742
- * _.isObjectLike({});
1743
- * // => true
1744
- *
1745
- * _.isObjectLike([1, 2, 3]);
1746
- * // => true
1747
- *
1748
- * _.isObjectLike(_.noop);
1749
- * // => false
1750
- *
1751
- * _.isObjectLike(null);
1752
- * // => false
1753
- */
1754
- function isObjectLike(value) {
1755
- return value != null && typeof value == 'object';
1756
- }
1757
-
1758
- /**
1759
- * Checks if `value` is classified as a typed array.
1760
- *
1761
- * @static
1762
- * @memberOf _
1763
- * @since 3.0.0
1764
- * @category Lang
1765
- * @param {*} value The value to check.
1766
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1767
- * @example
1768
- *
1769
- * _.isTypedArray(new Uint8Array);
1770
- * // => true
1771
- *
1772
- * _.isTypedArray([]);
1773
- * // => false
1774
- */
1775
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
1776
-
1777
- /**
1778
- * Creates an array of the own enumerable property names of `object`.
1779
- *
1780
- * **Note:** Non-object values are coerced to objects. See the
1781
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
1782
- * for more details.
1783
- *
1784
- * @static
1785
- * @since 0.1.0
1786
- * @memberOf _
1787
- * @category Object
1788
- * @param {Object} object The object to query.
1789
- * @returns {Array} Returns the array of property names.
1790
- * @example
1791
- *
1792
- * function Foo() {
1793
- * this.a = 1;
1794
- * this.b = 2;
1795
- * }
1796
- *
1797
- * Foo.prototype.c = 3;
1798
- *
1799
- * _.keys(new Foo);
1800
- * // => ['a', 'b'] (iteration order is not guaranteed)
1801
- *
1802
- * _.keys('hi');
1803
- * // => ['0', '1']
1804
- */
1805
- function keys(object) {
1806
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
1807
- }
1808
-
1809
- /**
1810
- * This method returns a new empty array.
1811
- *
1812
- * @static
1813
- * @memberOf _
1814
- * @since 4.13.0
1815
- * @category Util
1816
- * @returns {Array} Returns the new empty array.
1817
- * @example
1818
- *
1819
- * var arrays = _.times(2, _.stubArray);
1820
- *
1821
- * console.log(arrays);
1822
- * // => [[], []]
1823
- *
1824
- * console.log(arrays[0] === arrays[1]);
1825
- * // => false
1826
- */
1827
- function stubArray() {
1828
- return [];
1829
- }
1830
-
1831
- /**
1832
- * This method returns `false`.
1833
- *
1834
- * @static
1835
- * @memberOf _
1836
- * @since 4.13.0
1837
- * @category Util
1838
- * @returns {boolean} Returns `false`.
1839
- * @example
1840
- *
1841
- * _.times(2, _.stubFalse);
1842
- * // => [false, false]
1843
- */
1844
- function stubFalse() {
1845
- return false;
1846
- }
1847
-
1848
- module.exports = isEqual;