object-all-values-equal-to 2.1.0 → 3.0.3

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