@reactuses/core 4.0.3-beta.1 → 4.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +28 -2614
- package/dist/index.mjs +12 -2599
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React, { useRef, useEffect, useLayoutEffect, useCallback, useMemo, useState, useReducer } from 'react';
|
|
2
|
+
import { throttle, debounce, isEqual } from 'lodash-es';
|
|
3
|
+
import screenfull from 'screenfull';
|
|
2
4
|
|
|
3
5
|
function usePrevious(state) {
|
|
4
6
|
const ref = useRef();
|
|
@@ -39,7 +41,7 @@ var useUpdateEffect = createUpdateEffect(useEffect);
|
|
|
39
41
|
var index$3 = createUpdateEffect(useLayoutEffect);
|
|
40
42
|
|
|
41
43
|
var _a;
|
|
42
|
-
const isFunction
|
|
44
|
+
const isFunction = (val) => typeof val === "function";
|
|
43
45
|
const isString = (val) => typeof val === "string";
|
|
44
46
|
const isDev = process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
45
47
|
const isBrowser = typeof window !== "undefined";
|
|
@@ -57,7 +59,7 @@ const useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect;
|
|
|
57
59
|
|
|
58
60
|
function useEvent(fn) {
|
|
59
61
|
if (isDev) {
|
|
60
|
-
if (!isFunction
|
|
62
|
+
if (!isFunction(fn)) {
|
|
61
63
|
console.error(
|
|
62
64
|
`useEvent expected parameter is a function, got ${typeof fn}`
|
|
63
65
|
);
|
|
@@ -150,7 +152,7 @@ function useStorage(key, defaultValue, getStorage = () => isBrowser ? sessionSto
|
|
|
150
152
|
getInitialState$3(key, defaultValue, storage, serializer, onError)
|
|
151
153
|
);
|
|
152
154
|
useEffect(() => {
|
|
153
|
-
const data = csrData ? isFunction
|
|
155
|
+
const data = csrData ? isFunction(csrData) ? csrData() : csrData : defaultValue;
|
|
154
156
|
const getStoredValue = () => {
|
|
155
157
|
try {
|
|
156
158
|
const raw = storage == null ? void 0 : storage.getItem(key);
|
|
@@ -168,7 +170,7 @@ function useStorage(key, defaultValue, getStorage = () => isBrowser ? sessionSto
|
|
|
168
170
|
}, [key, defaultValue, serializer, storage, onError, csrData]);
|
|
169
171
|
const updateState = useEvent(
|
|
170
172
|
(valOrFunc) => {
|
|
171
|
-
const currentState = isFunction
|
|
173
|
+
const currentState = isFunction(valOrFunc) ? valOrFunc(state) : valOrFunc;
|
|
172
174
|
setState(currentState);
|
|
173
175
|
if (currentState === null) {
|
|
174
176
|
storage == null ? void 0 : storage.removeItem(key);
|
|
@@ -322,7 +324,7 @@ function usePreferredDark(defaultState) {
|
|
|
322
324
|
|
|
323
325
|
function useMount(fn) {
|
|
324
326
|
if (isDev) {
|
|
325
|
-
if (!isFunction
|
|
327
|
+
if (!isFunction(fn)) {
|
|
326
328
|
console.error(
|
|
327
329
|
`useMount: parameter \`fn\` expected to be a function, but got "${typeof fn}".`
|
|
328
330
|
);
|
|
@@ -335,7 +337,7 @@ function useMount(fn) {
|
|
|
335
337
|
|
|
336
338
|
function useUnmount(fn) {
|
|
337
339
|
if (isDev) {
|
|
338
|
-
if (!isFunction
|
|
340
|
+
if (!isFunction(fn)) {
|
|
339
341
|
console.error(
|
|
340
342
|
`useUnmount expected parameter is a function, got ${typeof fn}`
|
|
341
343
|
);
|
|
@@ -350,2415 +352,9 @@ function useUnmount(fn) {
|
|
|
350
352
|
);
|
|
351
353
|
}
|
|
352
354
|
|
|
353
|
-
/** Detect free variable `global` from Node.js. */
|
|
354
|
-
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
|
355
|
-
|
|
356
|
-
/** Detect free variable `self`. */
|
|
357
|
-
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
358
|
-
|
|
359
|
-
/** Used as a reference to the global object. */
|
|
360
|
-
var root = freeGlobal || freeSelf || Function('return this')();
|
|
361
|
-
|
|
362
|
-
/** Built-in value references. */
|
|
363
|
-
var Symbol = root.Symbol;
|
|
364
|
-
|
|
365
|
-
/** Used for built-in method references. */
|
|
366
|
-
var objectProto$b = Object.prototype;
|
|
367
|
-
|
|
368
|
-
/** Used to check objects for own properties. */
|
|
369
|
-
var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
|
|
370
|
-
|
|
371
|
-
/**
|
|
372
|
-
* Used to resolve the
|
|
373
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
374
|
-
* of values.
|
|
375
|
-
*/
|
|
376
|
-
var nativeObjectToString$1 = objectProto$b.toString;
|
|
377
|
-
|
|
378
|
-
/** Built-in value references. */
|
|
379
|
-
var symToStringTag$1 = Symbol ? Symbol.toStringTag : undefined;
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
383
|
-
*
|
|
384
|
-
* @private
|
|
385
|
-
* @param {*} value The value to query.
|
|
386
|
-
* @returns {string} Returns the raw `toStringTag`.
|
|
387
|
-
*/
|
|
388
|
-
function getRawTag(value) {
|
|
389
|
-
var isOwn = hasOwnProperty$8.call(value, symToStringTag$1),
|
|
390
|
-
tag = value[symToStringTag$1];
|
|
391
|
-
|
|
392
|
-
try {
|
|
393
|
-
value[symToStringTag$1] = undefined;
|
|
394
|
-
var unmasked = true;
|
|
395
|
-
} catch (e) {}
|
|
396
|
-
|
|
397
|
-
var result = nativeObjectToString$1.call(value);
|
|
398
|
-
if (unmasked) {
|
|
399
|
-
if (isOwn) {
|
|
400
|
-
value[symToStringTag$1] = tag;
|
|
401
|
-
} else {
|
|
402
|
-
delete value[symToStringTag$1];
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
return result;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
/** Used for built-in method references. */
|
|
409
|
-
var objectProto$a = Object.prototype;
|
|
410
|
-
|
|
411
|
-
/**
|
|
412
|
-
* Used to resolve the
|
|
413
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
414
|
-
* of values.
|
|
415
|
-
*/
|
|
416
|
-
var nativeObjectToString = objectProto$a.toString;
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* Converts `value` to a string using `Object.prototype.toString`.
|
|
420
|
-
*
|
|
421
|
-
* @private
|
|
422
|
-
* @param {*} value The value to convert.
|
|
423
|
-
* @returns {string} Returns the converted string.
|
|
424
|
-
*/
|
|
425
|
-
function objectToString(value) {
|
|
426
|
-
return nativeObjectToString.call(value);
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
/** `Object#toString` result references. */
|
|
430
|
-
var nullTag = '[object Null]',
|
|
431
|
-
undefinedTag = '[object Undefined]';
|
|
432
|
-
|
|
433
|
-
/** Built-in value references. */
|
|
434
|
-
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
438
|
-
*
|
|
439
|
-
* @private
|
|
440
|
-
* @param {*} value The value to query.
|
|
441
|
-
* @returns {string} Returns the `toStringTag`.
|
|
442
|
-
*/
|
|
443
|
-
function baseGetTag(value) {
|
|
444
|
-
if (value == null) {
|
|
445
|
-
return value === undefined ? undefinedTag : nullTag;
|
|
446
|
-
}
|
|
447
|
-
return (symToStringTag && symToStringTag in Object(value))
|
|
448
|
-
? getRawTag(value)
|
|
449
|
-
: objectToString(value);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
/**
|
|
453
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
454
|
-
* and has a `typeof` result of "object".
|
|
455
|
-
*
|
|
456
|
-
* @static
|
|
457
|
-
* @memberOf _
|
|
458
|
-
* @since 4.0.0
|
|
459
|
-
* @category Lang
|
|
460
|
-
* @param {*} value The value to check.
|
|
461
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
462
|
-
* @example
|
|
463
|
-
*
|
|
464
|
-
* _.isObjectLike({});
|
|
465
|
-
* // => true
|
|
466
|
-
*
|
|
467
|
-
* _.isObjectLike([1, 2, 3]);
|
|
468
|
-
* // => true
|
|
469
|
-
*
|
|
470
|
-
* _.isObjectLike(_.noop);
|
|
471
|
-
* // => false
|
|
472
|
-
*
|
|
473
|
-
* _.isObjectLike(null);
|
|
474
|
-
* // => false
|
|
475
|
-
*/
|
|
476
|
-
function isObjectLike(value) {
|
|
477
|
-
return value != null && typeof value == 'object';
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
/** `Object#toString` result references. */
|
|
481
|
-
var symbolTag$1 = '[object Symbol]';
|
|
482
|
-
|
|
483
|
-
/**
|
|
484
|
-
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
485
|
-
*
|
|
486
|
-
* @static
|
|
487
|
-
* @memberOf _
|
|
488
|
-
* @since 4.0.0
|
|
489
|
-
* @category Lang
|
|
490
|
-
* @param {*} value The value to check.
|
|
491
|
-
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
492
|
-
* @example
|
|
493
|
-
*
|
|
494
|
-
* _.isSymbol(Symbol.iterator);
|
|
495
|
-
* // => true
|
|
496
|
-
*
|
|
497
|
-
* _.isSymbol('abc');
|
|
498
|
-
* // => false
|
|
499
|
-
*/
|
|
500
|
-
function isSymbol(value) {
|
|
501
|
-
return typeof value == 'symbol' ||
|
|
502
|
-
(isObjectLike(value) && baseGetTag(value) == symbolTag$1);
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
/**
|
|
506
|
-
* Checks if `value` is classified as an `Array` object.
|
|
507
|
-
*
|
|
508
|
-
* @static
|
|
509
|
-
* @memberOf _
|
|
510
|
-
* @since 0.1.0
|
|
511
|
-
* @category Lang
|
|
512
|
-
* @param {*} value The value to check.
|
|
513
|
-
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
514
|
-
* @example
|
|
515
|
-
*
|
|
516
|
-
* _.isArray([1, 2, 3]);
|
|
517
|
-
* // => true
|
|
518
|
-
*
|
|
519
|
-
* _.isArray(document.body.children);
|
|
520
|
-
* // => false
|
|
521
|
-
*
|
|
522
|
-
* _.isArray('abc');
|
|
523
|
-
* // => false
|
|
524
|
-
*
|
|
525
|
-
* _.isArray(_.noop);
|
|
526
|
-
* // => false
|
|
527
|
-
*/
|
|
528
|
-
var isArray = Array.isArray;
|
|
529
|
-
|
|
530
|
-
/** Used to match a single whitespace character. */
|
|
531
|
-
var reWhitespace = /\s/;
|
|
532
|
-
|
|
533
|
-
/**
|
|
534
|
-
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
535
|
-
* character of `string`.
|
|
536
|
-
*
|
|
537
|
-
* @private
|
|
538
|
-
* @param {string} string The string to inspect.
|
|
539
|
-
* @returns {number} Returns the index of the last non-whitespace character.
|
|
540
|
-
*/
|
|
541
|
-
function trimmedEndIndex(string) {
|
|
542
|
-
var index = string.length;
|
|
543
|
-
|
|
544
|
-
while (index-- && reWhitespace.test(string.charAt(index))) {}
|
|
545
|
-
return index;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
/** Used to match leading whitespace. */
|
|
549
|
-
var reTrimStart = /^\s+/;
|
|
550
|
-
|
|
551
|
-
/**
|
|
552
|
-
* The base implementation of `_.trim`.
|
|
553
|
-
*
|
|
554
|
-
* @private
|
|
555
|
-
* @param {string} string The string to trim.
|
|
556
|
-
* @returns {string} Returns the trimmed string.
|
|
557
|
-
*/
|
|
558
|
-
function baseTrim(string) {
|
|
559
|
-
return string
|
|
560
|
-
? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
|
|
561
|
-
: string;
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
/**
|
|
565
|
-
* Checks if `value` is the
|
|
566
|
-
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
567
|
-
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
568
|
-
*
|
|
569
|
-
* @static
|
|
570
|
-
* @memberOf _
|
|
571
|
-
* @since 0.1.0
|
|
572
|
-
* @category Lang
|
|
573
|
-
* @param {*} value The value to check.
|
|
574
|
-
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
575
|
-
* @example
|
|
576
|
-
*
|
|
577
|
-
* _.isObject({});
|
|
578
|
-
* // => true
|
|
579
|
-
*
|
|
580
|
-
* _.isObject([1, 2, 3]);
|
|
581
|
-
* // => true
|
|
582
|
-
*
|
|
583
|
-
* _.isObject(_.noop);
|
|
584
|
-
* // => true
|
|
585
|
-
*
|
|
586
|
-
* _.isObject(null);
|
|
587
|
-
* // => false
|
|
588
|
-
*/
|
|
589
|
-
function isObject(value) {
|
|
590
|
-
var type = typeof value;
|
|
591
|
-
return value != null && (type == 'object' || type == 'function');
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
/** Used as references for various `Number` constants. */
|
|
595
|
-
var NAN = 0 / 0;
|
|
596
|
-
|
|
597
|
-
/** Used to detect bad signed hexadecimal string values. */
|
|
598
|
-
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
599
|
-
|
|
600
|
-
/** Used to detect binary string values. */
|
|
601
|
-
var reIsBinary = /^0b[01]+$/i;
|
|
602
|
-
|
|
603
|
-
/** Used to detect octal string values. */
|
|
604
|
-
var reIsOctal = /^0o[0-7]+$/i;
|
|
605
|
-
|
|
606
|
-
/** Built-in method references without a dependency on `root`. */
|
|
607
|
-
var freeParseInt = parseInt;
|
|
608
|
-
|
|
609
|
-
/**
|
|
610
|
-
* Converts `value` to a number.
|
|
611
|
-
*
|
|
612
|
-
* @static
|
|
613
|
-
* @memberOf _
|
|
614
|
-
* @since 4.0.0
|
|
615
|
-
* @category Lang
|
|
616
|
-
* @param {*} value The value to process.
|
|
617
|
-
* @returns {number} Returns the number.
|
|
618
|
-
* @example
|
|
619
|
-
*
|
|
620
|
-
* _.toNumber(3.2);
|
|
621
|
-
* // => 3.2
|
|
622
|
-
*
|
|
623
|
-
* _.toNumber(Number.MIN_VALUE);
|
|
624
|
-
* // => 5e-324
|
|
625
|
-
*
|
|
626
|
-
* _.toNumber(Infinity);
|
|
627
|
-
* // => Infinity
|
|
628
|
-
*
|
|
629
|
-
* _.toNumber('3.2');
|
|
630
|
-
* // => 3.2
|
|
631
|
-
*/
|
|
632
|
-
function toNumber(value) {
|
|
633
|
-
if (typeof value == 'number') {
|
|
634
|
-
return value;
|
|
635
|
-
}
|
|
636
|
-
if (isSymbol(value)) {
|
|
637
|
-
return NAN;
|
|
638
|
-
}
|
|
639
|
-
if (isObject(value)) {
|
|
640
|
-
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
641
|
-
value = isObject(other) ? (other + '') : other;
|
|
642
|
-
}
|
|
643
|
-
if (typeof value != 'string') {
|
|
644
|
-
return value === 0 ? value : +value;
|
|
645
|
-
}
|
|
646
|
-
value = baseTrim(value);
|
|
647
|
-
var isBinary = reIsBinary.test(value);
|
|
648
|
-
return (isBinary || reIsOctal.test(value))
|
|
649
|
-
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
650
|
-
: (reIsBadHex.test(value) ? NAN : +value);
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
/** `Object#toString` result references. */
|
|
654
|
-
var asyncTag = '[object AsyncFunction]',
|
|
655
|
-
funcTag$1 = '[object Function]',
|
|
656
|
-
genTag = '[object GeneratorFunction]',
|
|
657
|
-
proxyTag = '[object Proxy]';
|
|
658
|
-
|
|
659
|
-
/**
|
|
660
|
-
* Checks if `value` is classified as a `Function` object.
|
|
661
|
-
*
|
|
662
|
-
* @static
|
|
663
|
-
* @memberOf _
|
|
664
|
-
* @since 0.1.0
|
|
665
|
-
* @category Lang
|
|
666
|
-
* @param {*} value The value to check.
|
|
667
|
-
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
668
|
-
* @example
|
|
669
|
-
*
|
|
670
|
-
* _.isFunction(_);
|
|
671
|
-
* // => true
|
|
672
|
-
*
|
|
673
|
-
* _.isFunction(/abc/);
|
|
674
|
-
* // => false
|
|
675
|
-
*/
|
|
676
|
-
function isFunction(value) {
|
|
677
|
-
if (!isObject(value)) {
|
|
678
|
-
return false;
|
|
679
|
-
}
|
|
680
|
-
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
681
|
-
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
|
682
|
-
var tag = baseGetTag(value);
|
|
683
|
-
return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
/** Used to detect overreaching core-js shims. */
|
|
687
|
-
var coreJsData = root['__core-js_shared__'];
|
|
688
|
-
|
|
689
|
-
/** Used to detect methods masquerading as native. */
|
|
690
|
-
var maskSrcKey = (function() {
|
|
691
|
-
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
|
692
|
-
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
693
|
-
}());
|
|
694
|
-
|
|
695
|
-
/**
|
|
696
|
-
* Checks if `func` has its source masked.
|
|
697
|
-
*
|
|
698
|
-
* @private
|
|
699
|
-
* @param {Function} func The function to check.
|
|
700
|
-
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
701
|
-
*/
|
|
702
|
-
function isMasked(func) {
|
|
703
|
-
return !!maskSrcKey && (maskSrcKey in func);
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
/** Used for built-in method references. */
|
|
707
|
-
var funcProto$1 = Function.prototype;
|
|
708
|
-
|
|
709
|
-
/** Used to resolve the decompiled source of functions. */
|
|
710
|
-
var funcToString$1 = funcProto$1.toString;
|
|
711
|
-
|
|
712
|
-
/**
|
|
713
|
-
* Converts `func` to its source code.
|
|
714
|
-
*
|
|
715
|
-
* @private
|
|
716
|
-
* @param {Function} func The function to convert.
|
|
717
|
-
* @returns {string} Returns the source code.
|
|
718
|
-
*/
|
|
719
|
-
function toSource(func) {
|
|
720
|
-
if (func != null) {
|
|
721
|
-
try {
|
|
722
|
-
return funcToString$1.call(func);
|
|
723
|
-
} catch (e) {}
|
|
724
|
-
try {
|
|
725
|
-
return (func + '');
|
|
726
|
-
} catch (e) {}
|
|
727
|
-
}
|
|
728
|
-
return '';
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
/**
|
|
732
|
-
* Used to match `RegExp`
|
|
733
|
-
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
734
|
-
*/
|
|
735
|
-
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
736
|
-
|
|
737
|
-
/** Used to detect host constructors (Safari). */
|
|
738
|
-
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
739
|
-
|
|
740
|
-
/** Used for built-in method references. */
|
|
741
|
-
var funcProto = Function.prototype,
|
|
742
|
-
objectProto$9 = Object.prototype;
|
|
743
|
-
|
|
744
|
-
/** Used to resolve the decompiled source of functions. */
|
|
745
|
-
var funcToString = funcProto.toString;
|
|
746
|
-
|
|
747
|
-
/** Used to check objects for own properties. */
|
|
748
|
-
var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
|
|
749
|
-
|
|
750
|
-
/** Used to detect if a method is native. */
|
|
751
|
-
var reIsNative = RegExp('^' +
|
|
752
|
-
funcToString.call(hasOwnProperty$7).replace(reRegExpChar, '\\$&')
|
|
753
|
-
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
754
|
-
);
|
|
755
|
-
|
|
756
|
-
/**
|
|
757
|
-
* The base implementation of `_.isNative` without bad shim checks.
|
|
758
|
-
*
|
|
759
|
-
* @private
|
|
760
|
-
* @param {*} value The value to check.
|
|
761
|
-
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
762
|
-
* else `false`.
|
|
763
|
-
*/
|
|
764
|
-
function baseIsNative(value) {
|
|
765
|
-
if (!isObject(value) || isMasked(value)) {
|
|
766
|
-
return false;
|
|
767
|
-
}
|
|
768
|
-
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
|
769
|
-
return pattern.test(toSource(value));
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
/**
|
|
773
|
-
* Gets the value at `key` of `object`.
|
|
774
|
-
*
|
|
775
|
-
* @private
|
|
776
|
-
* @param {Object} [object] The object to query.
|
|
777
|
-
* @param {string} key The key of the property to get.
|
|
778
|
-
* @returns {*} Returns the property value.
|
|
779
|
-
*/
|
|
780
|
-
function getValue(object, key) {
|
|
781
|
-
return object == null ? undefined : object[key];
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
/**
|
|
785
|
-
* Gets the native function at `key` of `object`.
|
|
786
|
-
*
|
|
787
|
-
* @private
|
|
788
|
-
* @param {Object} object The object to query.
|
|
789
|
-
* @param {string} key The key of the method to get.
|
|
790
|
-
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
791
|
-
*/
|
|
792
|
-
function getNative(object, key) {
|
|
793
|
-
var value = getValue(object, key);
|
|
794
|
-
return baseIsNative(value) ? value : undefined;
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
/* Built-in method references that are verified to be native. */
|
|
798
|
-
var WeakMap = getNative(root, 'WeakMap');
|
|
799
|
-
|
|
800
|
-
/** Used as references for various `Number` constants. */
|
|
801
|
-
var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
|
802
|
-
|
|
803
|
-
/** Used to detect unsigned integer values. */
|
|
804
|
-
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
805
|
-
|
|
806
|
-
/**
|
|
807
|
-
* Checks if `value` is a valid array-like index.
|
|
808
|
-
*
|
|
809
|
-
* @private
|
|
810
|
-
* @param {*} value The value to check.
|
|
811
|
-
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
812
|
-
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
813
|
-
*/
|
|
814
|
-
function isIndex(value, length) {
|
|
815
|
-
var type = typeof value;
|
|
816
|
-
length = length == null ? MAX_SAFE_INTEGER$1 : length;
|
|
817
|
-
|
|
818
|
-
return !!length &&
|
|
819
|
-
(type == 'number' ||
|
|
820
|
-
(type != 'symbol' && reIsUint.test(value))) &&
|
|
821
|
-
(value > -1 && value % 1 == 0 && value < length);
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
/**
|
|
825
|
-
* Performs a
|
|
826
|
-
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
827
|
-
* comparison between two values to determine if they are equivalent.
|
|
828
|
-
*
|
|
829
|
-
* @static
|
|
830
|
-
* @memberOf _
|
|
831
|
-
* @since 4.0.0
|
|
832
|
-
* @category Lang
|
|
833
|
-
* @param {*} value The value to compare.
|
|
834
|
-
* @param {*} other The other value to compare.
|
|
835
|
-
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
836
|
-
* @example
|
|
837
|
-
*
|
|
838
|
-
* var object = { 'a': 1 };
|
|
839
|
-
* var other = { 'a': 1 };
|
|
840
|
-
*
|
|
841
|
-
* _.eq(object, object);
|
|
842
|
-
* // => true
|
|
843
|
-
*
|
|
844
|
-
* _.eq(object, other);
|
|
845
|
-
* // => false
|
|
846
|
-
*
|
|
847
|
-
* _.eq('a', 'a');
|
|
848
|
-
* // => true
|
|
849
|
-
*
|
|
850
|
-
* _.eq('a', Object('a'));
|
|
851
|
-
* // => false
|
|
852
|
-
*
|
|
853
|
-
* _.eq(NaN, NaN);
|
|
854
|
-
* // => true
|
|
855
|
-
*/
|
|
856
|
-
function eq(value, other) {
|
|
857
|
-
return value === other || (value !== value && other !== other);
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
/** Used as references for various `Number` constants. */
|
|
861
|
-
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
862
|
-
|
|
863
|
-
/**
|
|
864
|
-
* Checks if `value` is a valid array-like length.
|
|
865
|
-
*
|
|
866
|
-
* **Note:** This method is loosely based on
|
|
867
|
-
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
|
868
|
-
*
|
|
869
|
-
* @static
|
|
870
|
-
* @memberOf _
|
|
871
|
-
* @since 4.0.0
|
|
872
|
-
* @category Lang
|
|
873
|
-
* @param {*} value The value to check.
|
|
874
|
-
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
|
875
|
-
* @example
|
|
876
|
-
*
|
|
877
|
-
* _.isLength(3);
|
|
878
|
-
* // => true
|
|
879
|
-
*
|
|
880
|
-
* _.isLength(Number.MIN_VALUE);
|
|
881
|
-
* // => false
|
|
882
|
-
*
|
|
883
|
-
* _.isLength(Infinity);
|
|
884
|
-
* // => false
|
|
885
|
-
*
|
|
886
|
-
* _.isLength('3');
|
|
887
|
-
* // => false
|
|
888
|
-
*/
|
|
889
|
-
function isLength(value) {
|
|
890
|
-
return typeof value == 'number' &&
|
|
891
|
-
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
/**
|
|
895
|
-
* Checks if `value` is array-like. A value is considered array-like if it's
|
|
896
|
-
* not a function and has a `value.length` that's an integer greater than or
|
|
897
|
-
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
|
|
898
|
-
*
|
|
899
|
-
* @static
|
|
900
|
-
* @memberOf _
|
|
901
|
-
* @since 4.0.0
|
|
902
|
-
* @category Lang
|
|
903
|
-
* @param {*} value The value to check.
|
|
904
|
-
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
|
905
|
-
* @example
|
|
906
|
-
*
|
|
907
|
-
* _.isArrayLike([1, 2, 3]);
|
|
908
|
-
* // => true
|
|
909
|
-
*
|
|
910
|
-
* _.isArrayLike(document.body.children);
|
|
911
|
-
* // => true
|
|
912
|
-
*
|
|
913
|
-
* _.isArrayLike('abc');
|
|
914
|
-
* // => true
|
|
915
|
-
*
|
|
916
|
-
* _.isArrayLike(_.noop);
|
|
917
|
-
* // => false
|
|
918
|
-
*/
|
|
919
|
-
function isArrayLike(value) {
|
|
920
|
-
return value != null && isLength(value.length) && !isFunction(value);
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
/** Used for built-in method references. */
|
|
924
|
-
var objectProto$8 = Object.prototype;
|
|
925
|
-
|
|
926
|
-
/**
|
|
927
|
-
* Checks if `value` is likely a prototype object.
|
|
928
|
-
*
|
|
929
|
-
* @private
|
|
930
|
-
* @param {*} value The value to check.
|
|
931
|
-
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
|
932
|
-
*/
|
|
933
|
-
function isPrototype(value) {
|
|
934
|
-
var Ctor = value && value.constructor,
|
|
935
|
-
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$8;
|
|
936
|
-
|
|
937
|
-
return value === proto;
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
/**
|
|
941
|
-
* The base implementation of `_.times` without support for iteratee shorthands
|
|
942
|
-
* or max array length checks.
|
|
943
|
-
*
|
|
944
|
-
* @private
|
|
945
|
-
* @param {number} n The number of times to invoke `iteratee`.
|
|
946
|
-
* @param {Function} iteratee The function invoked per iteration.
|
|
947
|
-
* @returns {Array} Returns the array of results.
|
|
948
|
-
*/
|
|
949
|
-
function baseTimes(n, iteratee) {
|
|
950
|
-
var index = -1,
|
|
951
|
-
result = Array(n);
|
|
952
|
-
|
|
953
|
-
while (++index < n) {
|
|
954
|
-
result[index] = iteratee(index);
|
|
955
|
-
}
|
|
956
|
-
return result;
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
/** `Object#toString` result references. */
|
|
960
|
-
var argsTag$2 = '[object Arguments]';
|
|
961
|
-
|
|
962
|
-
/**
|
|
963
|
-
* The base implementation of `_.isArguments`.
|
|
964
|
-
*
|
|
965
|
-
* @private
|
|
966
|
-
* @param {*} value The value to check.
|
|
967
|
-
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
968
|
-
*/
|
|
969
|
-
function baseIsArguments(value) {
|
|
970
|
-
return isObjectLike(value) && baseGetTag(value) == argsTag$2;
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
/** Used for built-in method references. */
|
|
974
|
-
var objectProto$7 = Object.prototype;
|
|
975
|
-
|
|
976
|
-
/** Used to check objects for own properties. */
|
|
977
|
-
var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
|
|
978
|
-
|
|
979
|
-
/** Built-in value references. */
|
|
980
|
-
var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
|
|
981
|
-
|
|
982
|
-
/**
|
|
983
|
-
* Checks if `value` is likely an `arguments` object.
|
|
984
|
-
*
|
|
985
|
-
* @static
|
|
986
|
-
* @memberOf _
|
|
987
|
-
* @since 0.1.0
|
|
988
|
-
* @category Lang
|
|
989
|
-
* @param {*} value The value to check.
|
|
990
|
-
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
991
|
-
* else `false`.
|
|
992
|
-
* @example
|
|
993
|
-
*
|
|
994
|
-
* _.isArguments(function() { return arguments; }());
|
|
995
|
-
* // => true
|
|
996
|
-
*
|
|
997
|
-
* _.isArguments([1, 2, 3]);
|
|
998
|
-
* // => false
|
|
999
|
-
*/
|
|
1000
|
-
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
|
1001
|
-
return isObjectLike(value) && hasOwnProperty$6.call(value, 'callee') &&
|
|
1002
|
-
!propertyIsEnumerable$1.call(value, 'callee');
|
|
1003
|
-
};
|
|
1004
|
-
|
|
1005
|
-
/**
|
|
1006
|
-
* This method returns `false`.
|
|
1007
|
-
*
|
|
1008
|
-
* @static
|
|
1009
|
-
* @memberOf _
|
|
1010
|
-
* @since 4.13.0
|
|
1011
|
-
* @category Util
|
|
1012
|
-
* @returns {boolean} Returns `false`.
|
|
1013
|
-
* @example
|
|
1014
|
-
*
|
|
1015
|
-
* _.times(2, _.stubFalse);
|
|
1016
|
-
* // => [false, false]
|
|
1017
|
-
*/
|
|
1018
|
-
function stubFalse() {
|
|
1019
|
-
return false;
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
/** Detect free variable `exports`. */
|
|
1023
|
-
var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
|
1024
|
-
|
|
1025
|
-
/** Detect free variable `module`. */
|
|
1026
|
-
var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
|
|
1027
|
-
|
|
1028
|
-
/** Detect the popular CommonJS extension `module.exports`. */
|
|
1029
|
-
var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
|
|
1030
|
-
|
|
1031
|
-
/** Built-in value references. */
|
|
1032
|
-
var Buffer = moduleExports$1 ? root.Buffer : undefined;
|
|
1033
|
-
|
|
1034
|
-
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1035
|
-
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
|
|
1036
|
-
|
|
1037
|
-
/**
|
|
1038
|
-
* Checks if `value` is a buffer.
|
|
1039
|
-
*
|
|
1040
|
-
* @static
|
|
1041
|
-
* @memberOf _
|
|
1042
|
-
* @since 4.3.0
|
|
1043
|
-
* @category Lang
|
|
1044
|
-
* @param {*} value The value to check.
|
|
1045
|
-
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
|
1046
|
-
* @example
|
|
1047
|
-
*
|
|
1048
|
-
* _.isBuffer(new Buffer(2));
|
|
1049
|
-
* // => true
|
|
1050
|
-
*
|
|
1051
|
-
* _.isBuffer(new Uint8Array(2));
|
|
1052
|
-
* // => false
|
|
1053
|
-
*/
|
|
1054
|
-
var isBuffer = nativeIsBuffer || stubFalse;
|
|
1055
|
-
|
|
1056
|
-
/** `Object#toString` result references. */
|
|
1057
|
-
var argsTag$1 = '[object Arguments]',
|
|
1058
|
-
arrayTag$1 = '[object Array]',
|
|
1059
|
-
boolTag$1 = '[object Boolean]',
|
|
1060
|
-
dateTag$1 = '[object Date]',
|
|
1061
|
-
errorTag$1 = '[object Error]',
|
|
1062
|
-
funcTag = '[object Function]',
|
|
1063
|
-
mapTag$2 = '[object Map]',
|
|
1064
|
-
numberTag$1 = '[object Number]',
|
|
1065
|
-
objectTag$2 = '[object Object]',
|
|
1066
|
-
regexpTag$1 = '[object RegExp]',
|
|
1067
|
-
setTag$2 = '[object Set]',
|
|
1068
|
-
stringTag$1 = '[object String]',
|
|
1069
|
-
weakMapTag$1 = '[object WeakMap]';
|
|
1070
|
-
|
|
1071
|
-
var arrayBufferTag$1 = '[object ArrayBuffer]',
|
|
1072
|
-
dataViewTag$2 = '[object DataView]',
|
|
1073
|
-
float32Tag = '[object Float32Array]',
|
|
1074
|
-
float64Tag = '[object Float64Array]',
|
|
1075
|
-
int8Tag = '[object Int8Array]',
|
|
1076
|
-
int16Tag = '[object Int16Array]',
|
|
1077
|
-
int32Tag = '[object Int32Array]',
|
|
1078
|
-
uint8Tag = '[object Uint8Array]',
|
|
1079
|
-
uint8ClampedTag = '[object Uint8ClampedArray]',
|
|
1080
|
-
uint16Tag = '[object Uint16Array]',
|
|
1081
|
-
uint32Tag = '[object Uint32Array]';
|
|
1082
|
-
|
|
1083
|
-
/** Used to identify `toStringTag` values of typed arrays. */
|
|
1084
|
-
var typedArrayTags = {};
|
|
1085
|
-
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
|
1086
|
-
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
|
1087
|
-
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
|
1088
|
-
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
|
1089
|
-
typedArrayTags[uint32Tag] = true;
|
|
1090
|
-
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
|
|
1091
|
-
typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] =
|
|
1092
|
-
typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] =
|
|
1093
|
-
typedArrayTags[errorTag$1] = typedArrayTags[funcTag] =
|
|
1094
|
-
typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] =
|
|
1095
|
-
typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$1] =
|
|
1096
|
-
typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] =
|
|
1097
|
-
typedArrayTags[weakMapTag$1] = false;
|
|
1098
|
-
|
|
1099
|
-
/**
|
|
1100
|
-
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
|
1101
|
-
*
|
|
1102
|
-
* @private
|
|
1103
|
-
* @param {*} value The value to check.
|
|
1104
|
-
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
1105
|
-
*/
|
|
1106
|
-
function baseIsTypedArray(value) {
|
|
1107
|
-
return isObjectLike(value) &&
|
|
1108
|
-
isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
/**
|
|
1112
|
-
* The base implementation of `_.unary` without support for storing metadata.
|
|
1113
|
-
*
|
|
1114
|
-
* @private
|
|
1115
|
-
* @param {Function} func The function to cap arguments for.
|
|
1116
|
-
* @returns {Function} Returns the new capped function.
|
|
1117
|
-
*/
|
|
1118
|
-
function baseUnary(func) {
|
|
1119
|
-
return function(value) {
|
|
1120
|
-
return func(value);
|
|
1121
|
-
};
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
/** Detect free variable `exports`. */
|
|
1125
|
-
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
|
1126
|
-
|
|
1127
|
-
/** Detect free variable `module`. */
|
|
1128
|
-
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
|
1129
|
-
|
|
1130
|
-
/** Detect the popular CommonJS extension `module.exports`. */
|
|
1131
|
-
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
1132
|
-
|
|
1133
|
-
/** Detect free variable `process` from Node.js. */
|
|
1134
|
-
var freeProcess = moduleExports && freeGlobal.process;
|
|
1135
|
-
|
|
1136
|
-
/** Used to access faster Node.js helpers. */
|
|
1137
|
-
var nodeUtil = (function() {
|
|
1138
|
-
try {
|
|
1139
|
-
// Use `util.types` for Node.js 10+.
|
|
1140
|
-
var types = freeModule && freeModule.require && freeModule.require('util').types;
|
|
1141
|
-
|
|
1142
|
-
if (types) {
|
|
1143
|
-
return types;
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
// Legacy `process.binding('util')` for Node.js < 10.
|
|
1147
|
-
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
|
1148
|
-
} catch (e) {}
|
|
1149
|
-
}());
|
|
1150
|
-
|
|
1151
|
-
/* Node.js helper references. */
|
|
1152
|
-
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
1153
|
-
|
|
1154
|
-
/**
|
|
1155
|
-
* Checks if `value` is classified as a typed array.
|
|
1156
|
-
*
|
|
1157
|
-
* @static
|
|
1158
|
-
* @memberOf _
|
|
1159
|
-
* @since 3.0.0
|
|
1160
|
-
* @category Lang
|
|
1161
|
-
* @param {*} value The value to check.
|
|
1162
|
-
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
1163
|
-
* @example
|
|
1164
|
-
*
|
|
1165
|
-
* _.isTypedArray(new Uint8Array);
|
|
1166
|
-
* // => true
|
|
1167
|
-
*
|
|
1168
|
-
* _.isTypedArray([]);
|
|
1169
|
-
* // => false
|
|
1170
|
-
*/
|
|
1171
|
-
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
1172
|
-
|
|
1173
|
-
/** Used for built-in method references. */
|
|
1174
|
-
var objectProto$6 = Object.prototype;
|
|
1175
|
-
|
|
1176
|
-
/** Used to check objects for own properties. */
|
|
1177
|
-
var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
|
|
1178
|
-
|
|
1179
|
-
/**
|
|
1180
|
-
* Creates an array of the enumerable property names of the array-like `value`.
|
|
1181
|
-
*
|
|
1182
|
-
* @private
|
|
1183
|
-
* @param {*} value The value to query.
|
|
1184
|
-
* @param {boolean} inherited Specify returning inherited property names.
|
|
1185
|
-
* @returns {Array} Returns the array of property names.
|
|
1186
|
-
*/
|
|
1187
|
-
function arrayLikeKeys(value, inherited) {
|
|
1188
|
-
var isArr = isArray(value),
|
|
1189
|
-
isArg = !isArr && isArguments(value),
|
|
1190
|
-
isBuff = !isArr && !isArg && isBuffer(value),
|
|
1191
|
-
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
|
1192
|
-
skipIndexes = isArr || isArg || isBuff || isType,
|
|
1193
|
-
result = skipIndexes ? baseTimes(value.length, String) : [],
|
|
1194
|
-
length = result.length;
|
|
1195
|
-
|
|
1196
|
-
for (var key in value) {
|
|
1197
|
-
if ((inherited || hasOwnProperty$5.call(value, key)) &&
|
|
1198
|
-
!(skipIndexes && (
|
|
1199
|
-
// Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1200
|
-
key == 'length' ||
|
|
1201
|
-
// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1202
|
-
(isBuff && (key == 'offset' || key == 'parent')) ||
|
|
1203
|
-
// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1204
|
-
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
|
1205
|
-
// Skip index properties.
|
|
1206
|
-
isIndex(key, length)
|
|
1207
|
-
))) {
|
|
1208
|
-
result.push(key);
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
|
-
return result;
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
/**
|
|
1215
|
-
* Creates a unary function that invokes `func` with its argument transformed.
|
|
1216
|
-
*
|
|
1217
|
-
* @private
|
|
1218
|
-
* @param {Function} func The function to wrap.
|
|
1219
|
-
* @param {Function} transform The argument transform.
|
|
1220
|
-
* @returns {Function} Returns the new function.
|
|
1221
|
-
*/
|
|
1222
|
-
function overArg(func, transform) {
|
|
1223
|
-
return function(arg) {
|
|
1224
|
-
return func(transform(arg));
|
|
1225
|
-
};
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1229
|
-
var nativeKeys = overArg(Object.keys, Object);
|
|
1230
|
-
|
|
1231
|
-
/** Used for built-in method references. */
|
|
1232
|
-
var objectProto$5 = Object.prototype;
|
|
1233
|
-
|
|
1234
|
-
/** Used to check objects for own properties. */
|
|
1235
|
-
var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
|
|
1236
|
-
|
|
1237
|
-
/**
|
|
1238
|
-
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
|
|
1239
|
-
*
|
|
1240
|
-
* @private
|
|
1241
|
-
* @param {Object} object The object to query.
|
|
1242
|
-
* @returns {Array} Returns the array of property names.
|
|
1243
|
-
*/
|
|
1244
|
-
function baseKeys(object) {
|
|
1245
|
-
if (!isPrototype(object)) {
|
|
1246
|
-
return nativeKeys(object);
|
|
1247
|
-
}
|
|
1248
|
-
var result = [];
|
|
1249
|
-
for (var key in Object(object)) {
|
|
1250
|
-
if (hasOwnProperty$4.call(object, key) && key != 'constructor') {
|
|
1251
|
-
result.push(key);
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
return result;
|
|
1255
|
-
}
|
|
1256
|
-
|
|
1257
|
-
/**
|
|
1258
|
-
* Creates an array of the own enumerable property names of `object`.
|
|
1259
|
-
*
|
|
1260
|
-
* **Note:** Non-object values are coerced to objects. See the
|
|
1261
|
-
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
1262
|
-
* for more details.
|
|
1263
|
-
*
|
|
1264
|
-
* @static
|
|
1265
|
-
* @since 0.1.0
|
|
1266
|
-
* @memberOf _
|
|
1267
|
-
* @category Object
|
|
1268
|
-
* @param {Object} object The object to query.
|
|
1269
|
-
* @returns {Array} Returns the array of property names.
|
|
1270
|
-
* @example
|
|
1271
|
-
*
|
|
1272
|
-
* function Foo() {
|
|
1273
|
-
* this.a = 1;
|
|
1274
|
-
* this.b = 2;
|
|
1275
|
-
* }
|
|
1276
|
-
*
|
|
1277
|
-
* Foo.prototype.c = 3;
|
|
1278
|
-
*
|
|
1279
|
-
* _.keys(new Foo);
|
|
1280
|
-
* // => ['a', 'b'] (iteration order is not guaranteed)
|
|
1281
|
-
*
|
|
1282
|
-
* _.keys('hi');
|
|
1283
|
-
* // => ['0', '1']
|
|
1284
|
-
*/
|
|
1285
|
-
function keys(object) {
|
|
1286
|
-
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1289
|
-
/* Built-in method references that are verified to be native. */
|
|
1290
|
-
var nativeCreate = getNative(Object, 'create');
|
|
1291
|
-
|
|
1292
|
-
/**
|
|
1293
|
-
* Removes all key-value entries from the hash.
|
|
1294
|
-
*
|
|
1295
|
-
* @private
|
|
1296
|
-
* @name clear
|
|
1297
|
-
* @memberOf Hash
|
|
1298
|
-
*/
|
|
1299
|
-
function hashClear() {
|
|
1300
|
-
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
1301
|
-
this.size = 0;
|
|
1302
|
-
}
|
|
1303
|
-
|
|
1304
|
-
/**
|
|
1305
|
-
* Removes `key` and its value from the hash.
|
|
1306
|
-
*
|
|
1307
|
-
* @private
|
|
1308
|
-
* @name delete
|
|
1309
|
-
* @memberOf Hash
|
|
1310
|
-
* @param {Object} hash The hash to modify.
|
|
1311
|
-
* @param {string} key The key of the value to remove.
|
|
1312
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1313
|
-
*/
|
|
1314
|
-
function hashDelete(key) {
|
|
1315
|
-
var result = this.has(key) && delete this.__data__[key];
|
|
1316
|
-
this.size -= result ? 1 : 0;
|
|
1317
|
-
return result;
|
|
1318
|
-
}
|
|
1319
|
-
|
|
1320
|
-
/** Used to stand-in for `undefined` hash values. */
|
|
1321
|
-
var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
|
|
1322
|
-
|
|
1323
|
-
/** Used for built-in method references. */
|
|
1324
|
-
var objectProto$4 = Object.prototype;
|
|
1325
|
-
|
|
1326
|
-
/** Used to check objects for own properties. */
|
|
1327
|
-
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
1328
|
-
|
|
1329
|
-
/**
|
|
1330
|
-
* Gets the hash value for `key`.
|
|
1331
|
-
*
|
|
1332
|
-
* @private
|
|
1333
|
-
* @name get
|
|
1334
|
-
* @memberOf Hash
|
|
1335
|
-
* @param {string} key The key of the value to get.
|
|
1336
|
-
* @returns {*} Returns the entry value.
|
|
1337
|
-
*/
|
|
1338
|
-
function hashGet(key) {
|
|
1339
|
-
var data = this.__data__;
|
|
1340
|
-
if (nativeCreate) {
|
|
1341
|
-
var result = data[key];
|
|
1342
|
-
return result === HASH_UNDEFINED$2 ? undefined : result;
|
|
1343
|
-
}
|
|
1344
|
-
return hasOwnProperty$3.call(data, key) ? data[key] : undefined;
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
|
-
/** Used for built-in method references. */
|
|
1348
|
-
var objectProto$3 = Object.prototype;
|
|
1349
|
-
|
|
1350
|
-
/** Used to check objects for own properties. */
|
|
1351
|
-
var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
|
|
1352
|
-
|
|
1353
|
-
/**
|
|
1354
|
-
* Checks if a hash value for `key` exists.
|
|
1355
|
-
*
|
|
1356
|
-
* @private
|
|
1357
|
-
* @name has
|
|
1358
|
-
* @memberOf Hash
|
|
1359
|
-
* @param {string} key The key of the entry to check.
|
|
1360
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1361
|
-
*/
|
|
1362
|
-
function hashHas(key) {
|
|
1363
|
-
var data = this.__data__;
|
|
1364
|
-
return nativeCreate ? (data[key] !== undefined) : hasOwnProperty$2.call(data, key);
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
/** Used to stand-in for `undefined` hash values. */
|
|
1368
|
-
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
|
1369
|
-
|
|
1370
|
-
/**
|
|
1371
|
-
* Sets the hash `key` to `value`.
|
|
1372
|
-
*
|
|
1373
|
-
* @private
|
|
1374
|
-
* @name set
|
|
1375
|
-
* @memberOf Hash
|
|
1376
|
-
* @param {string} key The key of the value to set.
|
|
1377
|
-
* @param {*} value The value to set.
|
|
1378
|
-
* @returns {Object} Returns the hash instance.
|
|
1379
|
-
*/
|
|
1380
|
-
function hashSet(key, value) {
|
|
1381
|
-
var data = this.__data__;
|
|
1382
|
-
this.size += this.has(key) ? 0 : 1;
|
|
1383
|
-
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
|
|
1384
|
-
return this;
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1387
|
-
/**
|
|
1388
|
-
* Creates a hash object.
|
|
1389
|
-
*
|
|
1390
|
-
* @private
|
|
1391
|
-
* @constructor
|
|
1392
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
1393
|
-
*/
|
|
1394
|
-
function Hash(entries) {
|
|
1395
|
-
var index = -1,
|
|
1396
|
-
length = entries == null ? 0 : entries.length;
|
|
1397
|
-
|
|
1398
|
-
this.clear();
|
|
1399
|
-
while (++index < length) {
|
|
1400
|
-
var entry = entries[index];
|
|
1401
|
-
this.set(entry[0], entry[1]);
|
|
1402
|
-
}
|
|
1403
|
-
}
|
|
1404
|
-
|
|
1405
|
-
// Add methods to `Hash`.
|
|
1406
|
-
Hash.prototype.clear = hashClear;
|
|
1407
|
-
Hash.prototype['delete'] = hashDelete;
|
|
1408
|
-
Hash.prototype.get = hashGet;
|
|
1409
|
-
Hash.prototype.has = hashHas;
|
|
1410
|
-
Hash.prototype.set = hashSet;
|
|
1411
|
-
|
|
1412
|
-
/**
|
|
1413
|
-
* Removes all key-value entries from the list cache.
|
|
1414
|
-
*
|
|
1415
|
-
* @private
|
|
1416
|
-
* @name clear
|
|
1417
|
-
* @memberOf ListCache
|
|
1418
|
-
*/
|
|
1419
|
-
function listCacheClear() {
|
|
1420
|
-
this.__data__ = [];
|
|
1421
|
-
this.size = 0;
|
|
1422
|
-
}
|
|
1423
|
-
|
|
1424
|
-
/**
|
|
1425
|
-
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
1426
|
-
*
|
|
1427
|
-
* @private
|
|
1428
|
-
* @param {Array} array The array to inspect.
|
|
1429
|
-
* @param {*} key The key to search for.
|
|
1430
|
-
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
1431
|
-
*/
|
|
1432
|
-
function assocIndexOf(array, key) {
|
|
1433
|
-
var length = array.length;
|
|
1434
|
-
while (length--) {
|
|
1435
|
-
if (eq(array[length][0], key)) {
|
|
1436
|
-
return length;
|
|
1437
|
-
}
|
|
1438
|
-
}
|
|
1439
|
-
return -1;
|
|
1440
|
-
}
|
|
1441
|
-
|
|
1442
|
-
/** Used for built-in method references. */
|
|
1443
|
-
var arrayProto = Array.prototype;
|
|
1444
|
-
|
|
1445
|
-
/** Built-in value references. */
|
|
1446
|
-
var splice = arrayProto.splice;
|
|
1447
|
-
|
|
1448
|
-
/**
|
|
1449
|
-
* Removes `key` and its value from the list cache.
|
|
1450
|
-
*
|
|
1451
|
-
* @private
|
|
1452
|
-
* @name delete
|
|
1453
|
-
* @memberOf ListCache
|
|
1454
|
-
* @param {string} key The key of the value to remove.
|
|
1455
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1456
|
-
*/
|
|
1457
|
-
function listCacheDelete(key) {
|
|
1458
|
-
var data = this.__data__,
|
|
1459
|
-
index = assocIndexOf(data, key);
|
|
1460
|
-
|
|
1461
|
-
if (index < 0) {
|
|
1462
|
-
return false;
|
|
1463
|
-
}
|
|
1464
|
-
var lastIndex = data.length - 1;
|
|
1465
|
-
if (index == lastIndex) {
|
|
1466
|
-
data.pop();
|
|
1467
|
-
} else {
|
|
1468
|
-
splice.call(data, index, 1);
|
|
1469
|
-
}
|
|
1470
|
-
--this.size;
|
|
1471
|
-
return true;
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1474
|
-
/**
|
|
1475
|
-
* Gets the list cache value for `key`.
|
|
1476
|
-
*
|
|
1477
|
-
* @private
|
|
1478
|
-
* @name get
|
|
1479
|
-
* @memberOf ListCache
|
|
1480
|
-
* @param {string} key The key of the value to get.
|
|
1481
|
-
* @returns {*} Returns the entry value.
|
|
1482
|
-
*/
|
|
1483
|
-
function listCacheGet(key) {
|
|
1484
|
-
var data = this.__data__,
|
|
1485
|
-
index = assocIndexOf(data, key);
|
|
1486
|
-
|
|
1487
|
-
return index < 0 ? undefined : data[index][1];
|
|
1488
|
-
}
|
|
1489
|
-
|
|
1490
|
-
/**
|
|
1491
|
-
* Checks if a list cache value for `key` exists.
|
|
1492
|
-
*
|
|
1493
|
-
* @private
|
|
1494
|
-
* @name has
|
|
1495
|
-
* @memberOf ListCache
|
|
1496
|
-
* @param {string} key The key of the entry to check.
|
|
1497
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1498
|
-
*/
|
|
1499
|
-
function listCacheHas(key) {
|
|
1500
|
-
return assocIndexOf(this.__data__, key) > -1;
|
|
1501
|
-
}
|
|
1502
|
-
|
|
1503
|
-
/**
|
|
1504
|
-
* Sets the list cache `key` to `value`.
|
|
1505
|
-
*
|
|
1506
|
-
* @private
|
|
1507
|
-
* @name set
|
|
1508
|
-
* @memberOf ListCache
|
|
1509
|
-
* @param {string} key The key of the value to set.
|
|
1510
|
-
* @param {*} value The value to set.
|
|
1511
|
-
* @returns {Object} Returns the list cache instance.
|
|
1512
|
-
*/
|
|
1513
|
-
function listCacheSet(key, value) {
|
|
1514
|
-
var data = this.__data__,
|
|
1515
|
-
index = assocIndexOf(data, key);
|
|
1516
|
-
|
|
1517
|
-
if (index < 0) {
|
|
1518
|
-
++this.size;
|
|
1519
|
-
data.push([key, value]);
|
|
1520
|
-
} else {
|
|
1521
|
-
data[index][1] = value;
|
|
1522
|
-
}
|
|
1523
|
-
return this;
|
|
1524
|
-
}
|
|
1525
|
-
|
|
1526
|
-
/**
|
|
1527
|
-
* Creates an list cache object.
|
|
1528
|
-
*
|
|
1529
|
-
* @private
|
|
1530
|
-
* @constructor
|
|
1531
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
1532
|
-
*/
|
|
1533
|
-
function ListCache(entries) {
|
|
1534
|
-
var index = -1,
|
|
1535
|
-
length = entries == null ? 0 : entries.length;
|
|
1536
|
-
|
|
1537
|
-
this.clear();
|
|
1538
|
-
while (++index < length) {
|
|
1539
|
-
var entry = entries[index];
|
|
1540
|
-
this.set(entry[0], entry[1]);
|
|
1541
|
-
}
|
|
1542
|
-
}
|
|
1543
|
-
|
|
1544
|
-
// Add methods to `ListCache`.
|
|
1545
|
-
ListCache.prototype.clear = listCacheClear;
|
|
1546
|
-
ListCache.prototype['delete'] = listCacheDelete;
|
|
1547
|
-
ListCache.prototype.get = listCacheGet;
|
|
1548
|
-
ListCache.prototype.has = listCacheHas;
|
|
1549
|
-
ListCache.prototype.set = listCacheSet;
|
|
1550
|
-
|
|
1551
|
-
/* Built-in method references that are verified to be native. */
|
|
1552
|
-
var Map$1 = getNative(root, 'Map');
|
|
1553
|
-
|
|
1554
|
-
/**
|
|
1555
|
-
* Removes all key-value entries from the map.
|
|
1556
|
-
*
|
|
1557
|
-
* @private
|
|
1558
|
-
* @name clear
|
|
1559
|
-
* @memberOf MapCache
|
|
1560
|
-
*/
|
|
1561
|
-
function mapCacheClear() {
|
|
1562
|
-
this.size = 0;
|
|
1563
|
-
this.__data__ = {
|
|
1564
|
-
'hash': new Hash,
|
|
1565
|
-
'map': new (Map$1 || ListCache),
|
|
1566
|
-
'string': new Hash
|
|
1567
|
-
};
|
|
1568
|
-
}
|
|
1569
|
-
|
|
1570
|
-
/**
|
|
1571
|
-
* Checks if `value` is suitable for use as unique object key.
|
|
1572
|
-
*
|
|
1573
|
-
* @private
|
|
1574
|
-
* @param {*} value The value to check.
|
|
1575
|
-
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
1576
|
-
*/
|
|
1577
|
-
function isKeyable(value) {
|
|
1578
|
-
var type = typeof value;
|
|
1579
|
-
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
1580
|
-
? (value !== '__proto__')
|
|
1581
|
-
: (value === null);
|
|
1582
|
-
}
|
|
1583
|
-
|
|
1584
|
-
/**
|
|
1585
|
-
* Gets the data for `map`.
|
|
1586
|
-
*
|
|
1587
|
-
* @private
|
|
1588
|
-
* @param {Object} map The map to query.
|
|
1589
|
-
* @param {string} key The reference key.
|
|
1590
|
-
* @returns {*} Returns the map data.
|
|
1591
|
-
*/
|
|
1592
|
-
function getMapData(map, key) {
|
|
1593
|
-
var data = map.__data__;
|
|
1594
|
-
return isKeyable(key)
|
|
1595
|
-
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
1596
|
-
: data.map;
|
|
1597
|
-
}
|
|
1598
|
-
|
|
1599
|
-
/**
|
|
1600
|
-
* Removes `key` and its value from the map.
|
|
1601
|
-
*
|
|
1602
|
-
* @private
|
|
1603
|
-
* @name delete
|
|
1604
|
-
* @memberOf MapCache
|
|
1605
|
-
* @param {string} key The key of the value to remove.
|
|
1606
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1607
|
-
*/
|
|
1608
|
-
function mapCacheDelete(key) {
|
|
1609
|
-
var result = getMapData(this, key)['delete'](key);
|
|
1610
|
-
this.size -= result ? 1 : 0;
|
|
1611
|
-
return result;
|
|
1612
|
-
}
|
|
1613
|
-
|
|
1614
|
-
/**
|
|
1615
|
-
* Gets the map value for `key`.
|
|
1616
|
-
*
|
|
1617
|
-
* @private
|
|
1618
|
-
* @name get
|
|
1619
|
-
* @memberOf MapCache
|
|
1620
|
-
* @param {string} key The key of the value to get.
|
|
1621
|
-
* @returns {*} Returns the entry value.
|
|
1622
|
-
*/
|
|
1623
|
-
function mapCacheGet(key) {
|
|
1624
|
-
return getMapData(this, key).get(key);
|
|
1625
|
-
}
|
|
1626
|
-
|
|
1627
|
-
/**
|
|
1628
|
-
* Checks if a map value for `key` exists.
|
|
1629
|
-
*
|
|
1630
|
-
* @private
|
|
1631
|
-
* @name has
|
|
1632
|
-
* @memberOf MapCache
|
|
1633
|
-
* @param {string} key The key of the entry to check.
|
|
1634
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1635
|
-
*/
|
|
1636
|
-
function mapCacheHas(key) {
|
|
1637
|
-
return getMapData(this, key).has(key);
|
|
1638
|
-
}
|
|
1639
|
-
|
|
1640
|
-
/**
|
|
1641
|
-
* Sets the map `key` to `value`.
|
|
1642
|
-
*
|
|
1643
|
-
* @private
|
|
1644
|
-
* @name set
|
|
1645
|
-
* @memberOf MapCache
|
|
1646
|
-
* @param {string} key The key of the value to set.
|
|
1647
|
-
* @param {*} value The value to set.
|
|
1648
|
-
* @returns {Object} Returns the map cache instance.
|
|
1649
|
-
*/
|
|
1650
|
-
function mapCacheSet(key, value) {
|
|
1651
|
-
var data = getMapData(this, key),
|
|
1652
|
-
size = data.size;
|
|
1653
|
-
|
|
1654
|
-
data.set(key, value);
|
|
1655
|
-
this.size += data.size == size ? 0 : 1;
|
|
1656
|
-
return this;
|
|
1657
|
-
}
|
|
1658
|
-
|
|
1659
|
-
/**
|
|
1660
|
-
* Creates a map cache object to store key-value pairs.
|
|
1661
|
-
*
|
|
1662
|
-
* @private
|
|
1663
|
-
* @constructor
|
|
1664
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
1665
|
-
*/
|
|
1666
|
-
function MapCache(entries) {
|
|
1667
|
-
var index = -1,
|
|
1668
|
-
length = entries == null ? 0 : entries.length;
|
|
1669
|
-
|
|
1670
|
-
this.clear();
|
|
1671
|
-
while (++index < length) {
|
|
1672
|
-
var entry = entries[index];
|
|
1673
|
-
this.set(entry[0], entry[1]);
|
|
1674
|
-
}
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
|
-
// Add methods to `MapCache`.
|
|
1678
|
-
MapCache.prototype.clear = mapCacheClear;
|
|
1679
|
-
MapCache.prototype['delete'] = mapCacheDelete;
|
|
1680
|
-
MapCache.prototype.get = mapCacheGet;
|
|
1681
|
-
MapCache.prototype.has = mapCacheHas;
|
|
1682
|
-
MapCache.prototype.set = mapCacheSet;
|
|
1683
|
-
|
|
1684
|
-
/**
|
|
1685
|
-
* Appends the elements of `values` to `array`.
|
|
1686
|
-
*
|
|
1687
|
-
* @private
|
|
1688
|
-
* @param {Array} array The array to modify.
|
|
1689
|
-
* @param {Array} values The values to append.
|
|
1690
|
-
* @returns {Array} Returns `array`.
|
|
1691
|
-
*/
|
|
1692
|
-
function arrayPush(array, values) {
|
|
1693
|
-
var index = -1,
|
|
1694
|
-
length = values.length,
|
|
1695
|
-
offset = array.length;
|
|
1696
|
-
|
|
1697
|
-
while (++index < length) {
|
|
1698
|
-
array[offset + index] = values[index];
|
|
1699
|
-
}
|
|
1700
|
-
return array;
|
|
1701
|
-
}
|
|
1702
|
-
|
|
1703
|
-
/**
|
|
1704
|
-
* Removes all key-value entries from the stack.
|
|
1705
|
-
*
|
|
1706
|
-
* @private
|
|
1707
|
-
* @name clear
|
|
1708
|
-
* @memberOf Stack
|
|
1709
|
-
*/
|
|
1710
|
-
function stackClear() {
|
|
1711
|
-
this.__data__ = new ListCache;
|
|
1712
|
-
this.size = 0;
|
|
1713
|
-
}
|
|
1714
|
-
|
|
1715
|
-
/**
|
|
1716
|
-
* Removes `key` and its value from the stack.
|
|
1717
|
-
*
|
|
1718
|
-
* @private
|
|
1719
|
-
* @name delete
|
|
1720
|
-
* @memberOf Stack
|
|
1721
|
-
* @param {string} key The key of the value to remove.
|
|
1722
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1723
|
-
*/
|
|
1724
|
-
function stackDelete(key) {
|
|
1725
|
-
var data = this.__data__,
|
|
1726
|
-
result = data['delete'](key);
|
|
1727
|
-
|
|
1728
|
-
this.size = data.size;
|
|
1729
|
-
return result;
|
|
1730
|
-
}
|
|
1731
|
-
|
|
1732
|
-
/**
|
|
1733
|
-
* Gets the stack value for `key`.
|
|
1734
|
-
*
|
|
1735
|
-
* @private
|
|
1736
|
-
* @name get
|
|
1737
|
-
* @memberOf Stack
|
|
1738
|
-
* @param {string} key The key of the value to get.
|
|
1739
|
-
* @returns {*} Returns the entry value.
|
|
1740
|
-
*/
|
|
1741
|
-
function stackGet(key) {
|
|
1742
|
-
return this.__data__.get(key);
|
|
1743
|
-
}
|
|
1744
|
-
|
|
1745
|
-
/**
|
|
1746
|
-
* Checks if a stack value for `key` exists.
|
|
1747
|
-
*
|
|
1748
|
-
* @private
|
|
1749
|
-
* @name has
|
|
1750
|
-
* @memberOf Stack
|
|
1751
|
-
* @param {string} key The key of the entry to check.
|
|
1752
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1753
|
-
*/
|
|
1754
|
-
function stackHas(key) {
|
|
1755
|
-
return this.__data__.has(key);
|
|
1756
|
-
}
|
|
1757
|
-
|
|
1758
|
-
/** Used as the size to enable large array optimizations. */
|
|
1759
|
-
var LARGE_ARRAY_SIZE = 200;
|
|
1760
|
-
|
|
1761
|
-
/**
|
|
1762
|
-
* Sets the stack `key` to `value`.
|
|
1763
|
-
*
|
|
1764
|
-
* @private
|
|
1765
|
-
* @name set
|
|
1766
|
-
* @memberOf Stack
|
|
1767
|
-
* @param {string} key The key of the value to set.
|
|
1768
|
-
* @param {*} value The value to set.
|
|
1769
|
-
* @returns {Object} Returns the stack cache instance.
|
|
1770
|
-
*/
|
|
1771
|
-
function stackSet(key, value) {
|
|
1772
|
-
var data = this.__data__;
|
|
1773
|
-
if (data instanceof ListCache) {
|
|
1774
|
-
var pairs = data.__data__;
|
|
1775
|
-
if (!Map$1 || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
|
1776
|
-
pairs.push([key, value]);
|
|
1777
|
-
this.size = ++data.size;
|
|
1778
|
-
return this;
|
|
1779
|
-
}
|
|
1780
|
-
data = this.__data__ = new MapCache(pairs);
|
|
1781
|
-
}
|
|
1782
|
-
data.set(key, value);
|
|
1783
|
-
this.size = data.size;
|
|
1784
|
-
return this;
|
|
1785
|
-
}
|
|
1786
|
-
|
|
1787
|
-
/**
|
|
1788
|
-
* Creates a stack cache object to store key-value pairs.
|
|
1789
|
-
*
|
|
1790
|
-
* @private
|
|
1791
|
-
* @constructor
|
|
1792
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
1793
|
-
*/
|
|
1794
|
-
function Stack(entries) {
|
|
1795
|
-
var data = this.__data__ = new ListCache(entries);
|
|
1796
|
-
this.size = data.size;
|
|
1797
|
-
}
|
|
1798
|
-
|
|
1799
|
-
// Add methods to `Stack`.
|
|
1800
|
-
Stack.prototype.clear = stackClear;
|
|
1801
|
-
Stack.prototype['delete'] = stackDelete;
|
|
1802
|
-
Stack.prototype.get = stackGet;
|
|
1803
|
-
Stack.prototype.has = stackHas;
|
|
1804
|
-
Stack.prototype.set = stackSet;
|
|
1805
|
-
|
|
1806
|
-
/**
|
|
1807
|
-
* A specialized version of `_.filter` for arrays without support for
|
|
1808
|
-
* iteratee shorthands.
|
|
1809
|
-
*
|
|
1810
|
-
* @private
|
|
1811
|
-
* @param {Array} [array] The array to iterate over.
|
|
1812
|
-
* @param {Function} predicate The function invoked per iteration.
|
|
1813
|
-
* @returns {Array} Returns the new filtered array.
|
|
1814
|
-
*/
|
|
1815
|
-
function arrayFilter(array, predicate) {
|
|
1816
|
-
var index = -1,
|
|
1817
|
-
length = array == null ? 0 : array.length,
|
|
1818
|
-
resIndex = 0,
|
|
1819
|
-
result = [];
|
|
1820
|
-
|
|
1821
|
-
while (++index < length) {
|
|
1822
|
-
var value = array[index];
|
|
1823
|
-
if (predicate(value, index, array)) {
|
|
1824
|
-
result[resIndex++] = value;
|
|
1825
|
-
}
|
|
1826
|
-
}
|
|
1827
|
-
return result;
|
|
1828
|
-
}
|
|
1829
|
-
|
|
1830
|
-
/**
|
|
1831
|
-
* This method returns a new empty array.
|
|
1832
|
-
*
|
|
1833
|
-
* @static
|
|
1834
|
-
* @memberOf _
|
|
1835
|
-
* @since 4.13.0
|
|
1836
|
-
* @category Util
|
|
1837
|
-
* @returns {Array} Returns the new empty array.
|
|
1838
|
-
* @example
|
|
1839
|
-
*
|
|
1840
|
-
* var arrays = _.times(2, _.stubArray);
|
|
1841
|
-
*
|
|
1842
|
-
* console.log(arrays);
|
|
1843
|
-
* // => [[], []]
|
|
1844
|
-
*
|
|
1845
|
-
* console.log(arrays[0] === arrays[1]);
|
|
1846
|
-
* // => false
|
|
1847
|
-
*/
|
|
1848
|
-
function stubArray() {
|
|
1849
|
-
return [];
|
|
1850
|
-
}
|
|
1851
|
-
|
|
1852
|
-
/** Used for built-in method references. */
|
|
1853
|
-
var objectProto$2 = Object.prototype;
|
|
1854
|
-
|
|
1855
|
-
/** Built-in value references. */
|
|
1856
|
-
var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
|
|
1857
|
-
|
|
1858
|
-
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1859
|
-
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
1860
|
-
|
|
1861
|
-
/**
|
|
1862
|
-
* Creates an array of the own enumerable symbols of `object`.
|
|
1863
|
-
*
|
|
1864
|
-
* @private
|
|
1865
|
-
* @param {Object} object The object to query.
|
|
1866
|
-
* @returns {Array} Returns the array of symbols.
|
|
1867
|
-
*/
|
|
1868
|
-
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
|
1869
|
-
if (object == null) {
|
|
1870
|
-
return [];
|
|
1871
|
-
}
|
|
1872
|
-
object = Object(object);
|
|
1873
|
-
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
|
1874
|
-
return propertyIsEnumerable.call(object, symbol);
|
|
1875
|
-
});
|
|
1876
|
-
};
|
|
1877
|
-
|
|
1878
|
-
/**
|
|
1879
|
-
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
|
|
1880
|
-
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
|
|
1881
|
-
* symbols of `object`.
|
|
1882
|
-
*
|
|
1883
|
-
* @private
|
|
1884
|
-
* @param {Object} object The object to query.
|
|
1885
|
-
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
1886
|
-
* @param {Function} symbolsFunc The function to get the symbols of `object`.
|
|
1887
|
-
* @returns {Array} Returns the array of property names and symbols.
|
|
1888
|
-
*/
|
|
1889
|
-
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
1890
|
-
var result = keysFunc(object);
|
|
1891
|
-
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
1892
|
-
}
|
|
1893
|
-
|
|
1894
|
-
/**
|
|
1895
|
-
* Creates an array of own enumerable property names and symbols of `object`.
|
|
1896
|
-
*
|
|
1897
|
-
* @private
|
|
1898
|
-
* @param {Object} object The object to query.
|
|
1899
|
-
* @returns {Array} Returns the array of property names and symbols.
|
|
1900
|
-
*/
|
|
1901
|
-
function getAllKeys(object) {
|
|
1902
|
-
return baseGetAllKeys(object, keys, getSymbols);
|
|
1903
|
-
}
|
|
1904
|
-
|
|
1905
|
-
/* Built-in method references that are verified to be native. */
|
|
1906
|
-
var DataView = getNative(root, 'DataView');
|
|
1907
|
-
|
|
1908
|
-
/* Built-in method references that are verified to be native. */
|
|
1909
|
-
var Promise$1 = getNative(root, 'Promise');
|
|
1910
|
-
|
|
1911
|
-
/* Built-in method references that are verified to be native. */
|
|
1912
|
-
var Set$1 = getNative(root, 'Set');
|
|
1913
|
-
|
|
1914
|
-
/** `Object#toString` result references. */
|
|
1915
|
-
var mapTag$1 = '[object Map]',
|
|
1916
|
-
objectTag$1 = '[object Object]',
|
|
1917
|
-
promiseTag = '[object Promise]',
|
|
1918
|
-
setTag$1 = '[object Set]',
|
|
1919
|
-
weakMapTag = '[object WeakMap]';
|
|
1920
|
-
|
|
1921
|
-
var dataViewTag$1 = '[object DataView]';
|
|
1922
|
-
|
|
1923
|
-
/** Used to detect maps, sets, and weakmaps. */
|
|
1924
|
-
var dataViewCtorString = toSource(DataView),
|
|
1925
|
-
mapCtorString = toSource(Map$1),
|
|
1926
|
-
promiseCtorString = toSource(Promise$1),
|
|
1927
|
-
setCtorString = toSource(Set$1),
|
|
1928
|
-
weakMapCtorString = toSource(WeakMap);
|
|
1929
|
-
|
|
1930
|
-
/**
|
|
1931
|
-
* Gets the `toStringTag` of `value`.
|
|
1932
|
-
*
|
|
1933
|
-
* @private
|
|
1934
|
-
* @param {*} value The value to query.
|
|
1935
|
-
* @returns {string} Returns the `toStringTag`.
|
|
1936
|
-
*/
|
|
1937
|
-
var getTag = baseGetTag;
|
|
1938
|
-
|
|
1939
|
-
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
|
1940
|
-
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$1) ||
|
|
1941
|
-
(Map$1 && getTag(new Map$1) != mapTag$1) ||
|
|
1942
|
-
(Promise$1 && getTag(Promise$1.resolve()) != promiseTag) ||
|
|
1943
|
-
(Set$1 && getTag(new Set$1) != setTag$1) ||
|
|
1944
|
-
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
|
1945
|
-
getTag = function(value) {
|
|
1946
|
-
var result = baseGetTag(value),
|
|
1947
|
-
Ctor = result == objectTag$1 ? value.constructor : undefined,
|
|
1948
|
-
ctorString = Ctor ? toSource(Ctor) : '';
|
|
1949
|
-
|
|
1950
|
-
if (ctorString) {
|
|
1951
|
-
switch (ctorString) {
|
|
1952
|
-
case dataViewCtorString: return dataViewTag$1;
|
|
1953
|
-
case mapCtorString: return mapTag$1;
|
|
1954
|
-
case promiseCtorString: return promiseTag;
|
|
1955
|
-
case setCtorString: return setTag$1;
|
|
1956
|
-
case weakMapCtorString: return weakMapTag;
|
|
1957
|
-
}
|
|
1958
|
-
}
|
|
1959
|
-
return result;
|
|
1960
|
-
};
|
|
1961
|
-
}
|
|
1962
|
-
|
|
1963
|
-
var getTag$1 = getTag;
|
|
1964
|
-
|
|
1965
|
-
/** Built-in value references. */
|
|
1966
|
-
var Uint8Array = root.Uint8Array;
|
|
1967
|
-
|
|
1968
|
-
/** Used to stand-in for `undefined` hash values. */
|
|
1969
|
-
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
1970
|
-
|
|
1971
|
-
/**
|
|
1972
|
-
* Adds `value` to the array cache.
|
|
1973
|
-
*
|
|
1974
|
-
* @private
|
|
1975
|
-
* @name add
|
|
1976
|
-
* @memberOf SetCache
|
|
1977
|
-
* @alias push
|
|
1978
|
-
* @param {*} value The value to cache.
|
|
1979
|
-
* @returns {Object} Returns the cache instance.
|
|
1980
|
-
*/
|
|
1981
|
-
function setCacheAdd(value) {
|
|
1982
|
-
this.__data__.set(value, HASH_UNDEFINED);
|
|
1983
|
-
return this;
|
|
1984
|
-
}
|
|
1985
|
-
|
|
1986
|
-
/**
|
|
1987
|
-
* Checks if `value` is in the array cache.
|
|
1988
|
-
*
|
|
1989
|
-
* @private
|
|
1990
|
-
* @name has
|
|
1991
|
-
* @memberOf SetCache
|
|
1992
|
-
* @param {*} value The value to search for.
|
|
1993
|
-
* @returns {number} Returns `true` if `value` is found, else `false`.
|
|
1994
|
-
*/
|
|
1995
|
-
function setCacheHas(value) {
|
|
1996
|
-
return this.__data__.has(value);
|
|
1997
|
-
}
|
|
1998
|
-
|
|
1999
|
-
/**
|
|
2000
|
-
*
|
|
2001
|
-
* Creates an array cache object to store unique values.
|
|
2002
|
-
*
|
|
2003
|
-
* @private
|
|
2004
|
-
* @constructor
|
|
2005
|
-
* @param {Array} [values] The values to cache.
|
|
2006
|
-
*/
|
|
2007
|
-
function SetCache(values) {
|
|
2008
|
-
var index = -1,
|
|
2009
|
-
length = values == null ? 0 : values.length;
|
|
2010
|
-
|
|
2011
|
-
this.__data__ = new MapCache;
|
|
2012
|
-
while (++index < length) {
|
|
2013
|
-
this.add(values[index]);
|
|
2014
|
-
}
|
|
2015
|
-
}
|
|
2016
|
-
|
|
2017
|
-
// Add methods to `SetCache`.
|
|
2018
|
-
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
|
2019
|
-
SetCache.prototype.has = setCacheHas;
|
|
2020
|
-
|
|
2021
|
-
/**
|
|
2022
|
-
* A specialized version of `_.some` for arrays without support for iteratee
|
|
2023
|
-
* shorthands.
|
|
2024
|
-
*
|
|
2025
|
-
* @private
|
|
2026
|
-
* @param {Array} [array] The array to iterate over.
|
|
2027
|
-
* @param {Function} predicate The function invoked per iteration.
|
|
2028
|
-
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
|
2029
|
-
* else `false`.
|
|
2030
|
-
*/
|
|
2031
|
-
function arraySome(array, predicate) {
|
|
2032
|
-
var index = -1,
|
|
2033
|
-
length = array == null ? 0 : array.length;
|
|
2034
|
-
|
|
2035
|
-
while (++index < length) {
|
|
2036
|
-
if (predicate(array[index], index, array)) {
|
|
2037
|
-
return true;
|
|
2038
|
-
}
|
|
2039
|
-
}
|
|
2040
|
-
return false;
|
|
2041
|
-
}
|
|
2042
|
-
|
|
2043
|
-
/**
|
|
2044
|
-
* Checks if a `cache` value for `key` exists.
|
|
2045
|
-
*
|
|
2046
|
-
* @private
|
|
2047
|
-
* @param {Object} cache The cache to query.
|
|
2048
|
-
* @param {string} key The key of the entry to check.
|
|
2049
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
2050
|
-
*/
|
|
2051
|
-
function cacheHas(cache, key) {
|
|
2052
|
-
return cache.has(key);
|
|
2053
|
-
}
|
|
2054
|
-
|
|
2055
|
-
/** Used to compose bitmasks for value comparisons. */
|
|
2056
|
-
var COMPARE_PARTIAL_FLAG$3 = 1,
|
|
2057
|
-
COMPARE_UNORDERED_FLAG$1 = 2;
|
|
2058
|
-
|
|
2059
|
-
/**
|
|
2060
|
-
* A specialized version of `baseIsEqualDeep` for arrays with support for
|
|
2061
|
-
* partial deep comparisons.
|
|
2062
|
-
*
|
|
2063
|
-
* @private
|
|
2064
|
-
* @param {Array} array The array to compare.
|
|
2065
|
-
* @param {Array} other The other array to compare.
|
|
2066
|
-
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
2067
|
-
* @param {Function} customizer The function to customize comparisons.
|
|
2068
|
-
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
2069
|
-
* @param {Object} stack Tracks traversed `array` and `other` objects.
|
|
2070
|
-
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
|
2071
|
-
*/
|
|
2072
|
-
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
2073
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
|
|
2074
|
-
arrLength = array.length,
|
|
2075
|
-
othLength = other.length;
|
|
2076
|
-
|
|
2077
|
-
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
2078
|
-
return false;
|
|
2079
|
-
}
|
|
2080
|
-
// Check that cyclic values are equal.
|
|
2081
|
-
var arrStacked = stack.get(array);
|
|
2082
|
-
var othStacked = stack.get(other);
|
|
2083
|
-
if (arrStacked && othStacked) {
|
|
2084
|
-
return arrStacked == other && othStacked == array;
|
|
2085
|
-
}
|
|
2086
|
-
var index = -1,
|
|
2087
|
-
result = true,
|
|
2088
|
-
seen = (bitmask & COMPARE_UNORDERED_FLAG$1) ? new SetCache : undefined;
|
|
2089
|
-
|
|
2090
|
-
stack.set(array, other);
|
|
2091
|
-
stack.set(other, array);
|
|
2092
|
-
|
|
2093
|
-
// Ignore non-index properties.
|
|
2094
|
-
while (++index < arrLength) {
|
|
2095
|
-
var arrValue = array[index],
|
|
2096
|
-
othValue = other[index];
|
|
2097
|
-
|
|
2098
|
-
if (customizer) {
|
|
2099
|
-
var compared = isPartial
|
|
2100
|
-
? customizer(othValue, arrValue, index, other, array, stack)
|
|
2101
|
-
: customizer(arrValue, othValue, index, array, other, stack);
|
|
2102
|
-
}
|
|
2103
|
-
if (compared !== undefined) {
|
|
2104
|
-
if (compared) {
|
|
2105
|
-
continue;
|
|
2106
|
-
}
|
|
2107
|
-
result = false;
|
|
2108
|
-
break;
|
|
2109
|
-
}
|
|
2110
|
-
// Recursively compare arrays (susceptible to call stack limits).
|
|
2111
|
-
if (seen) {
|
|
2112
|
-
if (!arraySome(other, function(othValue, othIndex) {
|
|
2113
|
-
if (!cacheHas(seen, othIndex) &&
|
|
2114
|
-
(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
|
2115
|
-
return seen.push(othIndex);
|
|
2116
|
-
}
|
|
2117
|
-
})) {
|
|
2118
|
-
result = false;
|
|
2119
|
-
break;
|
|
2120
|
-
}
|
|
2121
|
-
} else if (!(
|
|
2122
|
-
arrValue === othValue ||
|
|
2123
|
-
equalFunc(arrValue, othValue, bitmask, customizer, stack)
|
|
2124
|
-
)) {
|
|
2125
|
-
result = false;
|
|
2126
|
-
break;
|
|
2127
|
-
}
|
|
2128
|
-
}
|
|
2129
|
-
stack['delete'](array);
|
|
2130
|
-
stack['delete'](other);
|
|
2131
|
-
return result;
|
|
2132
|
-
}
|
|
2133
|
-
|
|
2134
|
-
/**
|
|
2135
|
-
* Converts `map` to its key-value pairs.
|
|
2136
|
-
*
|
|
2137
|
-
* @private
|
|
2138
|
-
* @param {Object} map The map to convert.
|
|
2139
|
-
* @returns {Array} Returns the key-value pairs.
|
|
2140
|
-
*/
|
|
2141
|
-
function mapToArray(map) {
|
|
2142
|
-
var index = -1,
|
|
2143
|
-
result = Array(map.size);
|
|
2144
|
-
|
|
2145
|
-
map.forEach(function(value, key) {
|
|
2146
|
-
result[++index] = [key, value];
|
|
2147
|
-
});
|
|
2148
|
-
return result;
|
|
2149
|
-
}
|
|
2150
|
-
|
|
2151
|
-
/**
|
|
2152
|
-
* Converts `set` to an array of its values.
|
|
2153
|
-
*
|
|
2154
|
-
* @private
|
|
2155
|
-
* @param {Object} set The set to convert.
|
|
2156
|
-
* @returns {Array} Returns the values.
|
|
2157
|
-
*/
|
|
2158
|
-
function setToArray(set) {
|
|
2159
|
-
var index = -1,
|
|
2160
|
-
result = Array(set.size);
|
|
2161
|
-
|
|
2162
|
-
set.forEach(function(value) {
|
|
2163
|
-
result[++index] = value;
|
|
2164
|
-
});
|
|
2165
|
-
return result;
|
|
2166
|
-
}
|
|
2167
|
-
|
|
2168
|
-
/** Used to compose bitmasks for value comparisons. */
|
|
2169
|
-
var COMPARE_PARTIAL_FLAG$2 = 1,
|
|
2170
|
-
COMPARE_UNORDERED_FLAG = 2;
|
|
2171
|
-
|
|
2172
|
-
/** `Object#toString` result references. */
|
|
2173
|
-
var boolTag = '[object Boolean]',
|
|
2174
|
-
dateTag = '[object Date]',
|
|
2175
|
-
errorTag = '[object Error]',
|
|
2176
|
-
mapTag = '[object Map]',
|
|
2177
|
-
numberTag = '[object Number]',
|
|
2178
|
-
regexpTag = '[object RegExp]',
|
|
2179
|
-
setTag = '[object Set]',
|
|
2180
|
-
stringTag = '[object String]',
|
|
2181
|
-
symbolTag = '[object Symbol]';
|
|
2182
|
-
|
|
2183
|
-
var arrayBufferTag = '[object ArrayBuffer]',
|
|
2184
|
-
dataViewTag = '[object DataView]';
|
|
2185
|
-
|
|
2186
|
-
/** Used to convert symbols to primitives and strings. */
|
|
2187
|
-
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
|
2188
|
-
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
|
2189
|
-
|
|
2190
|
-
/**
|
|
2191
|
-
* A specialized version of `baseIsEqualDeep` for comparing objects of
|
|
2192
|
-
* the same `toStringTag`.
|
|
2193
|
-
*
|
|
2194
|
-
* **Note:** This function only supports comparing values with tags of
|
|
2195
|
-
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
|
|
2196
|
-
*
|
|
2197
|
-
* @private
|
|
2198
|
-
* @param {Object} object The object to compare.
|
|
2199
|
-
* @param {Object} other The other object to compare.
|
|
2200
|
-
* @param {string} tag The `toStringTag` of the objects to compare.
|
|
2201
|
-
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
2202
|
-
* @param {Function} customizer The function to customize comparisons.
|
|
2203
|
-
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
2204
|
-
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
|
2205
|
-
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
2206
|
-
*/
|
|
2207
|
-
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
2208
|
-
switch (tag) {
|
|
2209
|
-
case dataViewTag:
|
|
2210
|
-
if ((object.byteLength != other.byteLength) ||
|
|
2211
|
-
(object.byteOffset != other.byteOffset)) {
|
|
2212
|
-
return false;
|
|
2213
|
-
}
|
|
2214
|
-
object = object.buffer;
|
|
2215
|
-
other = other.buffer;
|
|
2216
|
-
|
|
2217
|
-
case arrayBufferTag:
|
|
2218
|
-
if ((object.byteLength != other.byteLength) ||
|
|
2219
|
-
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
|
2220
|
-
return false;
|
|
2221
|
-
}
|
|
2222
|
-
return true;
|
|
2223
|
-
|
|
2224
|
-
case boolTag:
|
|
2225
|
-
case dateTag:
|
|
2226
|
-
case numberTag:
|
|
2227
|
-
// Coerce booleans to `1` or `0` and dates to milliseconds.
|
|
2228
|
-
// Invalid dates are coerced to `NaN`.
|
|
2229
|
-
return eq(+object, +other);
|
|
2230
|
-
|
|
2231
|
-
case errorTag:
|
|
2232
|
-
return object.name == other.name && object.message == other.message;
|
|
2233
|
-
|
|
2234
|
-
case regexpTag:
|
|
2235
|
-
case stringTag:
|
|
2236
|
-
// Coerce regexes to strings and treat strings, primitives and objects,
|
|
2237
|
-
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
|
|
2238
|
-
// for more details.
|
|
2239
|
-
return object == (other + '');
|
|
2240
|
-
|
|
2241
|
-
case mapTag:
|
|
2242
|
-
var convert = mapToArray;
|
|
2243
|
-
|
|
2244
|
-
case setTag:
|
|
2245
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
|
|
2246
|
-
convert || (convert = setToArray);
|
|
2247
|
-
|
|
2248
|
-
if (object.size != other.size && !isPartial) {
|
|
2249
|
-
return false;
|
|
2250
|
-
}
|
|
2251
|
-
// Assume cyclic values are equal.
|
|
2252
|
-
var stacked = stack.get(object);
|
|
2253
|
-
if (stacked) {
|
|
2254
|
-
return stacked == other;
|
|
2255
|
-
}
|
|
2256
|
-
bitmask |= COMPARE_UNORDERED_FLAG;
|
|
2257
|
-
|
|
2258
|
-
// Recursively compare objects (susceptible to call stack limits).
|
|
2259
|
-
stack.set(object, other);
|
|
2260
|
-
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
|
2261
|
-
stack['delete'](object);
|
|
2262
|
-
return result;
|
|
2263
|
-
|
|
2264
|
-
case symbolTag:
|
|
2265
|
-
if (symbolValueOf) {
|
|
2266
|
-
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
2267
|
-
}
|
|
2268
|
-
}
|
|
2269
|
-
return false;
|
|
2270
|
-
}
|
|
2271
|
-
|
|
2272
|
-
/** Used to compose bitmasks for value comparisons. */
|
|
2273
|
-
var COMPARE_PARTIAL_FLAG$1 = 1;
|
|
2274
|
-
|
|
2275
|
-
/** Used for built-in method references. */
|
|
2276
|
-
var objectProto$1 = Object.prototype;
|
|
2277
|
-
|
|
2278
|
-
/** Used to check objects for own properties. */
|
|
2279
|
-
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
2280
|
-
|
|
2281
|
-
/**
|
|
2282
|
-
* A specialized version of `baseIsEqualDeep` for objects with support for
|
|
2283
|
-
* partial deep comparisons.
|
|
2284
|
-
*
|
|
2285
|
-
* @private
|
|
2286
|
-
* @param {Object} object The object to compare.
|
|
2287
|
-
* @param {Object} other The other object to compare.
|
|
2288
|
-
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
2289
|
-
* @param {Function} customizer The function to customize comparisons.
|
|
2290
|
-
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
2291
|
-
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
|
2292
|
-
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
2293
|
-
*/
|
|
2294
|
-
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
2295
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1,
|
|
2296
|
-
objProps = getAllKeys(object),
|
|
2297
|
-
objLength = objProps.length,
|
|
2298
|
-
othProps = getAllKeys(other),
|
|
2299
|
-
othLength = othProps.length;
|
|
2300
|
-
|
|
2301
|
-
if (objLength != othLength && !isPartial) {
|
|
2302
|
-
return false;
|
|
2303
|
-
}
|
|
2304
|
-
var index = objLength;
|
|
2305
|
-
while (index--) {
|
|
2306
|
-
var key = objProps[index];
|
|
2307
|
-
if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
|
|
2308
|
-
return false;
|
|
2309
|
-
}
|
|
2310
|
-
}
|
|
2311
|
-
// Check that cyclic values are equal.
|
|
2312
|
-
var objStacked = stack.get(object);
|
|
2313
|
-
var othStacked = stack.get(other);
|
|
2314
|
-
if (objStacked && othStacked) {
|
|
2315
|
-
return objStacked == other && othStacked == object;
|
|
2316
|
-
}
|
|
2317
|
-
var result = true;
|
|
2318
|
-
stack.set(object, other);
|
|
2319
|
-
stack.set(other, object);
|
|
2320
|
-
|
|
2321
|
-
var skipCtor = isPartial;
|
|
2322
|
-
while (++index < objLength) {
|
|
2323
|
-
key = objProps[index];
|
|
2324
|
-
var objValue = object[key],
|
|
2325
|
-
othValue = other[key];
|
|
2326
|
-
|
|
2327
|
-
if (customizer) {
|
|
2328
|
-
var compared = isPartial
|
|
2329
|
-
? customizer(othValue, objValue, key, other, object, stack)
|
|
2330
|
-
: customizer(objValue, othValue, key, object, other, stack);
|
|
2331
|
-
}
|
|
2332
|
-
// Recursively compare objects (susceptible to call stack limits).
|
|
2333
|
-
if (!(compared === undefined
|
|
2334
|
-
? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
|
|
2335
|
-
: compared
|
|
2336
|
-
)) {
|
|
2337
|
-
result = false;
|
|
2338
|
-
break;
|
|
2339
|
-
}
|
|
2340
|
-
skipCtor || (skipCtor = key == 'constructor');
|
|
2341
|
-
}
|
|
2342
|
-
if (result && !skipCtor) {
|
|
2343
|
-
var objCtor = object.constructor,
|
|
2344
|
-
othCtor = other.constructor;
|
|
2345
|
-
|
|
2346
|
-
// Non `Object` object instances with different constructors are not equal.
|
|
2347
|
-
if (objCtor != othCtor &&
|
|
2348
|
-
('constructor' in object && 'constructor' in other) &&
|
|
2349
|
-
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
|
|
2350
|
-
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
|
2351
|
-
result = false;
|
|
2352
|
-
}
|
|
2353
|
-
}
|
|
2354
|
-
stack['delete'](object);
|
|
2355
|
-
stack['delete'](other);
|
|
2356
|
-
return result;
|
|
2357
|
-
}
|
|
2358
|
-
|
|
2359
|
-
/** Used to compose bitmasks for value comparisons. */
|
|
2360
|
-
var COMPARE_PARTIAL_FLAG = 1;
|
|
2361
|
-
|
|
2362
|
-
/** `Object#toString` result references. */
|
|
2363
|
-
var argsTag = '[object Arguments]',
|
|
2364
|
-
arrayTag = '[object Array]',
|
|
2365
|
-
objectTag = '[object Object]';
|
|
2366
|
-
|
|
2367
|
-
/** Used for built-in method references. */
|
|
2368
|
-
var objectProto = Object.prototype;
|
|
2369
|
-
|
|
2370
|
-
/** Used to check objects for own properties. */
|
|
2371
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
2372
|
-
|
|
2373
|
-
/**
|
|
2374
|
-
* A specialized version of `baseIsEqual` for arrays and objects which performs
|
|
2375
|
-
* deep comparisons and tracks traversed objects enabling objects with circular
|
|
2376
|
-
* references to be compared.
|
|
2377
|
-
*
|
|
2378
|
-
* @private
|
|
2379
|
-
* @param {Object} object The object to compare.
|
|
2380
|
-
* @param {Object} other The other object to compare.
|
|
2381
|
-
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
2382
|
-
* @param {Function} customizer The function to customize comparisons.
|
|
2383
|
-
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
2384
|
-
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
|
|
2385
|
-
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
2386
|
-
*/
|
|
2387
|
-
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
2388
|
-
var objIsArr = isArray(object),
|
|
2389
|
-
othIsArr = isArray(other),
|
|
2390
|
-
objTag = objIsArr ? arrayTag : getTag$1(object),
|
|
2391
|
-
othTag = othIsArr ? arrayTag : getTag$1(other);
|
|
2392
|
-
|
|
2393
|
-
objTag = objTag == argsTag ? objectTag : objTag;
|
|
2394
|
-
othTag = othTag == argsTag ? objectTag : othTag;
|
|
2395
|
-
|
|
2396
|
-
var objIsObj = objTag == objectTag,
|
|
2397
|
-
othIsObj = othTag == objectTag,
|
|
2398
|
-
isSameTag = objTag == othTag;
|
|
2399
|
-
|
|
2400
|
-
if (isSameTag && isBuffer(object)) {
|
|
2401
|
-
if (!isBuffer(other)) {
|
|
2402
|
-
return false;
|
|
2403
|
-
}
|
|
2404
|
-
objIsArr = true;
|
|
2405
|
-
objIsObj = false;
|
|
2406
|
-
}
|
|
2407
|
-
if (isSameTag && !objIsObj) {
|
|
2408
|
-
stack || (stack = new Stack);
|
|
2409
|
-
return (objIsArr || isTypedArray(object))
|
|
2410
|
-
? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
|
|
2411
|
-
: equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
2412
|
-
}
|
|
2413
|
-
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
2414
|
-
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
|
2415
|
-
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
|
2416
|
-
|
|
2417
|
-
if (objIsWrapped || othIsWrapped) {
|
|
2418
|
-
var objUnwrapped = objIsWrapped ? object.value() : object,
|
|
2419
|
-
othUnwrapped = othIsWrapped ? other.value() : other;
|
|
2420
|
-
|
|
2421
|
-
stack || (stack = new Stack);
|
|
2422
|
-
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
|
2423
|
-
}
|
|
2424
|
-
}
|
|
2425
|
-
if (!isSameTag) {
|
|
2426
|
-
return false;
|
|
2427
|
-
}
|
|
2428
|
-
stack || (stack = new Stack);
|
|
2429
|
-
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
|
2430
|
-
}
|
|
2431
|
-
|
|
2432
|
-
/**
|
|
2433
|
-
* The base implementation of `_.isEqual` which supports partial comparisons
|
|
2434
|
-
* and tracks traversed objects.
|
|
2435
|
-
*
|
|
2436
|
-
* @private
|
|
2437
|
-
* @param {*} value The value to compare.
|
|
2438
|
-
* @param {*} other The other value to compare.
|
|
2439
|
-
* @param {boolean} bitmask The bitmask flags.
|
|
2440
|
-
* 1 - Unordered comparison
|
|
2441
|
-
* 2 - Partial comparison
|
|
2442
|
-
* @param {Function} [customizer] The function to customize comparisons.
|
|
2443
|
-
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
|
|
2444
|
-
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
2445
|
-
*/
|
|
2446
|
-
function baseIsEqual(value, other, bitmask, customizer, stack) {
|
|
2447
|
-
if (value === other) {
|
|
2448
|
-
return true;
|
|
2449
|
-
}
|
|
2450
|
-
if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
|
|
2451
|
-
return value !== value && other !== other;
|
|
2452
|
-
}
|
|
2453
|
-
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
|
2454
|
-
}
|
|
2455
|
-
|
|
2456
|
-
/**
|
|
2457
|
-
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
2458
|
-
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
2459
|
-
*
|
|
2460
|
-
* @static
|
|
2461
|
-
* @memberOf _
|
|
2462
|
-
* @since 2.4.0
|
|
2463
|
-
* @category Date
|
|
2464
|
-
* @returns {number} Returns the timestamp.
|
|
2465
|
-
* @example
|
|
2466
|
-
*
|
|
2467
|
-
* _.defer(function(stamp) {
|
|
2468
|
-
* console.log(_.now() - stamp);
|
|
2469
|
-
* }, _.now());
|
|
2470
|
-
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
2471
|
-
*/
|
|
2472
|
-
var now = function() {
|
|
2473
|
-
return root.Date.now();
|
|
2474
|
-
};
|
|
2475
|
-
|
|
2476
|
-
/** Error message constants. */
|
|
2477
|
-
var FUNC_ERROR_TEXT$1 = 'Expected a function';
|
|
2478
|
-
|
|
2479
|
-
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
2480
|
-
var nativeMax = Math.max,
|
|
2481
|
-
nativeMin = Math.min;
|
|
2482
|
-
|
|
2483
|
-
/**
|
|
2484
|
-
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
2485
|
-
* milliseconds have elapsed since the last time the debounced function was
|
|
2486
|
-
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
2487
|
-
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
2488
|
-
* Provide `options` to indicate whether `func` should be invoked on the
|
|
2489
|
-
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
2490
|
-
* with the last arguments provided to the debounced function. Subsequent
|
|
2491
|
-
* calls to the debounced function return the result of the last `func`
|
|
2492
|
-
* invocation.
|
|
2493
|
-
*
|
|
2494
|
-
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
2495
|
-
* invoked on the trailing edge of the timeout only if the debounced function
|
|
2496
|
-
* is invoked more than once during the `wait` timeout.
|
|
2497
|
-
*
|
|
2498
|
-
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
2499
|
-
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
2500
|
-
*
|
|
2501
|
-
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
2502
|
-
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
2503
|
-
*
|
|
2504
|
-
* @static
|
|
2505
|
-
* @memberOf _
|
|
2506
|
-
* @since 0.1.0
|
|
2507
|
-
* @category Function
|
|
2508
|
-
* @param {Function} func The function to debounce.
|
|
2509
|
-
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
2510
|
-
* @param {Object} [options={}] The options object.
|
|
2511
|
-
* @param {boolean} [options.leading=false]
|
|
2512
|
-
* Specify invoking on the leading edge of the timeout.
|
|
2513
|
-
* @param {number} [options.maxWait]
|
|
2514
|
-
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
2515
|
-
* @param {boolean} [options.trailing=true]
|
|
2516
|
-
* Specify invoking on the trailing edge of the timeout.
|
|
2517
|
-
* @returns {Function} Returns the new debounced function.
|
|
2518
|
-
* @example
|
|
2519
|
-
*
|
|
2520
|
-
* // Avoid costly calculations while the window size is in flux.
|
|
2521
|
-
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
2522
|
-
*
|
|
2523
|
-
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
2524
|
-
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
2525
|
-
* 'leading': true,
|
|
2526
|
-
* 'trailing': false
|
|
2527
|
-
* }));
|
|
2528
|
-
*
|
|
2529
|
-
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
2530
|
-
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
2531
|
-
* var source = new EventSource('/stream');
|
|
2532
|
-
* jQuery(source).on('message', debounced);
|
|
2533
|
-
*
|
|
2534
|
-
* // Cancel the trailing debounced invocation.
|
|
2535
|
-
* jQuery(window).on('popstate', debounced.cancel);
|
|
2536
|
-
*/
|
|
2537
|
-
function debounce(func, wait, options) {
|
|
2538
|
-
var lastArgs,
|
|
2539
|
-
lastThis,
|
|
2540
|
-
maxWait,
|
|
2541
|
-
result,
|
|
2542
|
-
timerId,
|
|
2543
|
-
lastCallTime,
|
|
2544
|
-
lastInvokeTime = 0,
|
|
2545
|
-
leading = false,
|
|
2546
|
-
maxing = false,
|
|
2547
|
-
trailing = true;
|
|
2548
|
-
|
|
2549
|
-
if (typeof func != 'function') {
|
|
2550
|
-
throw new TypeError(FUNC_ERROR_TEXT$1);
|
|
2551
|
-
}
|
|
2552
|
-
wait = toNumber(wait) || 0;
|
|
2553
|
-
if (isObject(options)) {
|
|
2554
|
-
leading = !!options.leading;
|
|
2555
|
-
maxing = 'maxWait' in options;
|
|
2556
|
-
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
2557
|
-
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
2558
|
-
}
|
|
2559
|
-
|
|
2560
|
-
function invokeFunc(time) {
|
|
2561
|
-
var args = lastArgs,
|
|
2562
|
-
thisArg = lastThis;
|
|
2563
|
-
|
|
2564
|
-
lastArgs = lastThis = undefined;
|
|
2565
|
-
lastInvokeTime = time;
|
|
2566
|
-
result = func.apply(thisArg, args);
|
|
2567
|
-
return result;
|
|
2568
|
-
}
|
|
2569
|
-
|
|
2570
|
-
function leadingEdge(time) {
|
|
2571
|
-
// Reset any `maxWait` timer.
|
|
2572
|
-
lastInvokeTime = time;
|
|
2573
|
-
// Start the timer for the trailing edge.
|
|
2574
|
-
timerId = setTimeout(timerExpired, wait);
|
|
2575
|
-
// Invoke the leading edge.
|
|
2576
|
-
return leading ? invokeFunc(time) : result;
|
|
2577
|
-
}
|
|
2578
|
-
|
|
2579
|
-
function remainingWait(time) {
|
|
2580
|
-
var timeSinceLastCall = time - lastCallTime,
|
|
2581
|
-
timeSinceLastInvoke = time - lastInvokeTime,
|
|
2582
|
-
timeWaiting = wait - timeSinceLastCall;
|
|
2583
|
-
|
|
2584
|
-
return maxing
|
|
2585
|
-
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
2586
|
-
: timeWaiting;
|
|
2587
|
-
}
|
|
2588
|
-
|
|
2589
|
-
function shouldInvoke(time) {
|
|
2590
|
-
var timeSinceLastCall = time - lastCallTime,
|
|
2591
|
-
timeSinceLastInvoke = time - lastInvokeTime;
|
|
2592
|
-
|
|
2593
|
-
// Either this is the first call, activity has stopped and we're at the
|
|
2594
|
-
// trailing edge, the system time has gone backwards and we're treating
|
|
2595
|
-
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
2596
|
-
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
2597
|
-
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
2598
|
-
}
|
|
2599
|
-
|
|
2600
|
-
function timerExpired() {
|
|
2601
|
-
var time = now();
|
|
2602
|
-
if (shouldInvoke(time)) {
|
|
2603
|
-
return trailingEdge(time);
|
|
2604
|
-
}
|
|
2605
|
-
// Restart the timer.
|
|
2606
|
-
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
2607
|
-
}
|
|
2608
|
-
|
|
2609
|
-
function trailingEdge(time) {
|
|
2610
|
-
timerId = undefined;
|
|
2611
|
-
|
|
2612
|
-
// Only invoke if we have `lastArgs` which means `func` has been
|
|
2613
|
-
// debounced at least once.
|
|
2614
|
-
if (trailing && lastArgs) {
|
|
2615
|
-
return invokeFunc(time);
|
|
2616
|
-
}
|
|
2617
|
-
lastArgs = lastThis = undefined;
|
|
2618
|
-
return result;
|
|
2619
|
-
}
|
|
2620
|
-
|
|
2621
|
-
function cancel() {
|
|
2622
|
-
if (timerId !== undefined) {
|
|
2623
|
-
clearTimeout(timerId);
|
|
2624
|
-
}
|
|
2625
|
-
lastInvokeTime = 0;
|
|
2626
|
-
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
2627
|
-
}
|
|
2628
|
-
|
|
2629
|
-
function flush() {
|
|
2630
|
-
return timerId === undefined ? result : trailingEdge(now());
|
|
2631
|
-
}
|
|
2632
|
-
|
|
2633
|
-
function debounced() {
|
|
2634
|
-
var time = now(),
|
|
2635
|
-
isInvoking = shouldInvoke(time);
|
|
2636
|
-
|
|
2637
|
-
lastArgs = arguments;
|
|
2638
|
-
lastThis = this;
|
|
2639
|
-
lastCallTime = time;
|
|
2640
|
-
|
|
2641
|
-
if (isInvoking) {
|
|
2642
|
-
if (timerId === undefined) {
|
|
2643
|
-
return leadingEdge(lastCallTime);
|
|
2644
|
-
}
|
|
2645
|
-
if (maxing) {
|
|
2646
|
-
// Handle invocations in a tight loop.
|
|
2647
|
-
clearTimeout(timerId);
|
|
2648
|
-
timerId = setTimeout(timerExpired, wait);
|
|
2649
|
-
return invokeFunc(lastCallTime);
|
|
2650
|
-
}
|
|
2651
|
-
}
|
|
2652
|
-
if (timerId === undefined) {
|
|
2653
|
-
timerId = setTimeout(timerExpired, wait);
|
|
2654
|
-
}
|
|
2655
|
-
return result;
|
|
2656
|
-
}
|
|
2657
|
-
debounced.cancel = cancel;
|
|
2658
|
-
debounced.flush = flush;
|
|
2659
|
-
return debounced;
|
|
2660
|
-
}
|
|
2661
|
-
|
|
2662
|
-
/**
|
|
2663
|
-
* Performs a deep comparison between two values to determine if they are
|
|
2664
|
-
* equivalent.
|
|
2665
|
-
*
|
|
2666
|
-
* **Note:** This method supports comparing arrays, array buffers, booleans,
|
|
2667
|
-
* date objects, error objects, maps, numbers, `Object` objects, regexes,
|
|
2668
|
-
* sets, strings, symbols, and typed arrays. `Object` objects are compared
|
|
2669
|
-
* by their own, not inherited, enumerable properties. Functions and DOM
|
|
2670
|
-
* nodes are compared by strict equality, i.e. `===`.
|
|
2671
|
-
*
|
|
2672
|
-
* @static
|
|
2673
|
-
* @memberOf _
|
|
2674
|
-
* @since 0.1.0
|
|
2675
|
-
* @category Lang
|
|
2676
|
-
* @param {*} value The value to compare.
|
|
2677
|
-
* @param {*} other The other value to compare.
|
|
2678
|
-
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
2679
|
-
* @example
|
|
2680
|
-
*
|
|
2681
|
-
* var object = { 'a': 1 };
|
|
2682
|
-
* var other = { 'a': 1 };
|
|
2683
|
-
*
|
|
2684
|
-
* _.isEqual(object, other);
|
|
2685
|
-
* // => true
|
|
2686
|
-
*
|
|
2687
|
-
* object === other;
|
|
2688
|
-
* // => false
|
|
2689
|
-
*/
|
|
2690
|
-
function isEqual(value, other) {
|
|
2691
|
-
return baseIsEqual(value, other);
|
|
2692
|
-
}
|
|
2693
|
-
|
|
2694
|
-
/** Error message constants. */
|
|
2695
|
-
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
2696
|
-
|
|
2697
|
-
/**
|
|
2698
|
-
* Creates a throttled function that only invokes `func` at most once per
|
|
2699
|
-
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
|
2700
|
-
* method to cancel delayed `func` invocations and a `flush` method to
|
|
2701
|
-
* immediately invoke them. Provide `options` to indicate whether `func`
|
|
2702
|
-
* should be invoked on the leading and/or trailing edge of the `wait`
|
|
2703
|
-
* timeout. The `func` is invoked with the last arguments provided to the
|
|
2704
|
-
* throttled function. Subsequent calls to the throttled function return the
|
|
2705
|
-
* result of the last `func` invocation.
|
|
2706
|
-
*
|
|
2707
|
-
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
2708
|
-
* invoked on the trailing edge of the timeout only if the throttled function
|
|
2709
|
-
* is invoked more than once during the `wait` timeout.
|
|
2710
|
-
*
|
|
2711
|
-
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
2712
|
-
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
2713
|
-
*
|
|
2714
|
-
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
2715
|
-
* for details over the differences between `_.throttle` and `_.debounce`.
|
|
2716
|
-
*
|
|
2717
|
-
* @static
|
|
2718
|
-
* @memberOf _
|
|
2719
|
-
* @since 0.1.0
|
|
2720
|
-
* @category Function
|
|
2721
|
-
* @param {Function} func The function to throttle.
|
|
2722
|
-
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
|
|
2723
|
-
* @param {Object} [options={}] The options object.
|
|
2724
|
-
* @param {boolean} [options.leading=true]
|
|
2725
|
-
* Specify invoking on the leading edge of the timeout.
|
|
2726
|
-
* @param {boolean} [options.trailing=true]
|
|
2727
|
-
* Specify invoking on the trailing edge of the timeout.
|
|
2728
|
-
* @returns {Function} Returns the new throttled function.
|
|
2729
|
-
* @example
|
|
2730
|
-
*
|
|
2731
|
-
* // Avoid excessively updating the position while scrolling.
|
|
2732
|
-
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
|
|
2733
|
-
*
|
|
2734
|
-
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
|
|
2735
|
-
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
|
|
2736
|
-
* jQuery(element).on('click', throttled);
|
|
2737
|
-
*
|
|
2738
|
-
* // Cancel the trailing throttled invocation.
|
|
2739
|
-
* jQuery(window).on('popstate', throttled.cancel);
|
|
2740
|
-
*/
|
|
2741
|
-
function throttle(func, wait, options) {
|
|
2742
|
-
var leading = true,
|
|
2743
|
-
trailing = true;
|
|
2744
|
-
|
|
2745
|
-
if (typeof func != 'function') {
|
|
2746
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
2747
|
-
}
|
|
2748
|
-
if (isObject(options)) {
|
|
2749
|
-
leading = 'leading' in options ? !!options.leading : leading;
|
|
2750
|
-
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
2751
|
-
}
|
|
2752
|
-
return debounce(func, wait, {
|
|
2753
|
-
'leading': leading,
|
|
2754
|
-
'maxWait': wait,
|
|
2755
|
-
'trailing': trailing
|
|
2756
|
-
});
|
|
2757
|
-
}
|
|
2758
|
-
|
|
2759
355
|
function useThrottleFn(fn, wait, options) {
|
|
2760
356
|
if (isDev) {
|
|
2761
|
-
if (!isFunction
|
|
357
|
+
if (!isFunction(fn)) {
|
|
2762
358
|
console.error(
|
|
2763
359
|
`useThrottleFn expected parameter is a function, got ${typeof fn}`
|
|
2764
360
|
);
|
|
@@ -2802,7 +398,7 @@ function useThrottle(value, wait, options) {
|
|
|
2802
398
|
|
|
2803
399
|
function useDebounceFn(fn, wait, options) {
|
|
2804
400
|
if (isDev) {
|
|
2805
|
-
if (!isFunction
|
|
401
|
+
if (!isFunction(fn)) {
|
|
2806
402
|
console.error(
|
|
2807
403
|
`useDebounceFn expected parameter is a function, got ${typeof fn}`
|
|
2808
404
|
);
|
|
@@ -2936,7 +532,7 @@ function getTargetElement(target, defaultElement) {
|
|
|
2936
532
|
return defaultElement;
|
|
2937
533
|
}
|
|
2938
534
|
let targetElement;
|
|
2939
|
-
if (isFunction
|
|
535
|
+
if (isFunction(target)) {
|
|
2940
536
|
targetElement = target();
|
|
2941
537
|
} else if ("current" in target) {
|
|
2942
538
|
targetElement = target.current;
|
|
@@ -3671,189 +1267,6 @@ function useGeolocation(options = defaultOptions) {
|
|
|
3671
1267
|
};
|
|
3672
1268
|
}
|
|
3673
1269
|
|
|
3674
|
-
var screenfull$1 = {exports: {}};
|
|
3675
|
-
|
|
3676
|
-
/*!
|
|
3677
|
-
* screenfull
|
|
3678
|
-
* v5.0.0 - 2019-09-09
|
|
3679
|
-
* (c) Sindre Sorhus; MIT License
|
|
3680
|
-
*/
|
|
3681
|
-
|
|
3682
|
-
(function (module) {
|
|
3683
|
-
(function () {
|
|
3684
|
-
|
|
3685
|
-
var document = typeof window !== 'undefined' && typeof window.document !== 'undefined' ? window.document : {};
|
|
3686
|
-
var isCommonjs = module.exports;
|
|
3687
|
-
|
|
3688
|
-
var fn = (function () {
|
|
3689
|
-
var val;
|
|
3690
|
-
|
|
3691
|
-
var fnMap = [
|
|
3692
|
-
[
|
|
3693
|
-
'requestFullscreen',
|
|
3694
|
-
'exitFullscreen',
|
|
3695
|
-
'fullscreenElement',
|
|
3696
|
-
'fullscreenEnabled',
|
|
3697
|
-
'fullscreenchange',
|
|
3698
|
-
'fullscreenerror'
|
|
3699
|
-
],
|
|
3700
|
-
// New WebKit
|
|
3701
|
-
[
|
|
3702
|
-
'webkitRequestFullscreen',
|
|
3703
|
-
'webkitExitFullscreen',
|
|
3704
|
-
'webkitFullscreenElement',
|
|
3705
|
-
'webkitFullscreenEnabled',
|
|
3706
|
-
'webkitfullscreenchange',
|
|
3707
|
-
'webkitfullscreenerror'
|
|
3708
|
-
|
|
3709
|
-
],
|
|
3710
|
-
// Old WebKit
|
|
3711
|
-
[
|
|
3712
|
-
'webkitRequestFullScreen',
|
|
3713
|
-
'webkitCancelFullScreen',
|
|
3714
|
-
'webkitCurrentFullScreenElement',
|
|
3715
|
-
'webkitCancelFullScreen',
|
|
3716
|
-
'webkitfullscreenchange',
|
|
3717
|
-
'webkitfullscreenerror'
|
|
3718
|
-
|
|
3719
|
-
],
|
|
3720
|
-
[
|
|
3721
|
-
'mozRequestFullScreen',
|
|
3722
|
-
'mozCancelFullScreen',
|
|
3723
|
-
'mozFullScreenElement',
|
|
3724
|
-
'mozFullScreenEnabled',
|
|
3725
|
-
'mozfullscreenchange',
|
|
3726
|
-
'mozfullscreenerror'
|
|
3727
|
-
],
|
|
3728
|
-
[
|
|
3729
|
-
'msRequestFullscreen',
|
|
3730
|
-
'msExitFullscreen',
|
|
3731
|
-
'msFullscreenElement',
|
|
3732
|
-
'msFullscreenEnabled',
|
|
3733
|
-
'MSFullscreenChange',
|
|
3734
|
-
'MSFullscreenError'
|
|
3735
|
-
]
|
|
3736
|
-
];
|
|
3737
|
-
|
|
3738
|
-
var i = 0;
|
|
3739
|
-
var l = fnMap.length;
|
|
3740
|
-
var ret = {};
|
|
3741
|
-
|
|
3742
|
-
for (; i < l; i++) {
|
|
3743
|
-
val = fnMap[i];
|
|
3744
|
-
if (val && val[1] in document) {
|
|
3745
|
-
for (i = 0; i < val.length; i++) {
|
|
3746
|
-
ret[fnMap[0][i]] = val[i];
|
|
3747
|
-
}
|
|
3748
|
-
return ret;
|
|
3749
|
-
}
|
|
3750
|
-
}
|
|
3751
|
-
|
|
3752
|
-
return false;
|
|
3753
|
-
})();
|
|
3754
|
-
|
|
3755
|
-
var eventNameMap = {
|
|
3756
|
-
change: fn.fullscreenchange,
|
|
3757
|
-
error: fn.fullscreenerror
|
|
3758
|
-
};
|
|
3759
|
-
|
|
3760
|
-
var screenfull = {
|
|
3761
|
-
request: function (element) {
|
|
3762
|
-
return new Promise(function (resolve, reject) {
|
|
3763
|
-
var onFullScreenEntered = function () {
|
|
3764
|
-
this.off('change', onFullScreenEntered);
|
|
3765
|
-
resolve();
|
|
3766
|
-
}.bind(this);
|
|
3767
|
-
|
|
3768
|
-
this.on('change', onFullScreenEntered);
|
|
3769
|
-
|
|
3770
|
-
element = element || document.documentElement;
|
|
3771
|
-
|
|
3772
|
-
Promise.resolve(element[fn.requestFullscreen]()).catch(reject);
|
|
3773
|
-
}.bind(this));
|
|
3774
|
-
},
|
|
3775
|
-
exit: function () {
|
|
3776
|
-
return new Promise(function (resolve, reject) {
|
|
3777
|
-
if (!this.isFullscreen) {
|
|
3778
|
-
resolve();
|
|
3779
|
-
return;
|
|
3780
|
-
}
|
|
3781
|
-
|
|
3782
|
-
var onFullScreenExit = function () {
|
|
3783
|
-
this.off('change', onFullScreenExit);
|
|
3784
|
-
resolve();
|
|
3785
|
-
}.bind(this);
|
|
3786
|
-
|
|
3787
|
-
this.on('change', onFullScreenExit);
|
|
3788
|
-
|
|
3789
|
-
Promise.resolve(document[fn.exitFullscreen]()).catch(reject);
|
|
3790
|
-
}.bind(this));
|
|
3791
|
-
},
|
|
3792
|
-
toggle: function (element) {
|
|
3793
|
-
return this.isFullscreen ? this.exit() : this.request(element);
|
|
3794
|
-
},
|
|
3795
|
-
onchange: function (callback) {
|
|
3796
|
-
this.on('change', callback);
|
|
3797
|
-
},
|
|
3798
|
-
onerror: function (callback) {
|
|
3799
|
-
this.on('error', callback);
|
|
3800
|
-
},
|
|
3801
|
-
on: function (event, callback) {
|
|
3802
|
-
var eventName = eventNameMap[event];
|
|
3803
|
-
if (eventName) {
|
|
3804
|
-
document.addEventListener(eventName, callback, false);
|
|
3805
|
-
}
|
|
3806
|
-
},
|
|
3807
|
-
off: function (event, callback) {
|
|
3808
|
-
var eventName = eventNameMap[event];
|
|
3809
|
-
if (eventName) {
|
|
3810
|
-
document.removeEventListener(eventName, callback, false);
|
|
3811
|
-
}
|
|
3812
|
-
},
|
|
3813
|
-
raw: fn
|
|
3814
|
-
};
|
|
3815
|
-
|
|
3816
|
-
if (!fn) {
|
|
3817
|
-
if (isCommonjs) {
|
|
3818
|
-
module.exports = {isEnabled: false};
|
|
3819
|
-
} else {
|
|
3820
|
-
window.screenfull = {isEnabled: false};
|
|
3821
|
-
}
|
|
3822
|
-
|
|
3823
|
-
return;
|
|
3824
|
-
}
|
|
3825
|
-
|
|
3826
|
-
Object.defineProperties(screenfull, {
|
|
3827
|
-
isFullscreen: {
|
|
3828
|
-
get: function () {
|
|
3829
|
-
return Boolean(document[fn.fullscreenElement]);
|
|
3830
|
-
}
|
|
3831
|
-
},
|
|
3832
|
-
element: {
|
|
3833
|
-
enumerable: true,
|
|
3834
|
-
get: function () {
|
|
3835
|
-
return document[fn.fullscreenElement];
|
|
3836
|
-
}
|
|
3837
|
-
},
|
|
3838
|
-
isEnabled: {
|
|
3839
|
-
enumerable: true,
|
|
3840
|
-
get: function () {
|
|
3841
|
-
// Coerce to boolean in case of old WebKit
|
|
3842
|
-
return Boolean(document[fn.fullscreenEnabled]);
|
|
3843
|
-
}
|
|
3844
|
-
}
|
|
3845
|
-
});
|
|
3846
|
-
|
|
3847
|
-
if (isCommonjs) {
|
|
3848
|
-
module.exports = screenfull;
|
|
3849
|
-
} else {
|
|
3850
|
-
window.screenfull = screenfull;
|
|
3851
|
-
}
|
|
3852
|
-
})();
|
|
3853
|
-
} (screenfull$1));
|
|
3854
|
-
|
|
3855
|
-
var screenfull = screenfull$1.exports;
|
|
3856
|
-
|
|
3857
1270
|
function useFullscreen(target, options = defaultOptions) {
|
|
3858
1271
|
const { onExit, onEnter } = options;
|
|
3859
1272
|
const [state, setState] = useState(false);
|
|
@@ -5513,7 +2926,7 @@ function useCookie(key, options = defaultOptions, defaultValue) {
|
|
|
5513
2926
|
}, [defaultValue, key, options]);
|
|
5514
2927
|
const updateCookie = useCallback(
|
|
5515
2928
|
(newValue) => {
|
|
5516
|
-
const value = isFunction
|
|
2929
|
+
const value = isFunction(newValue) ? newValue(cookieValue) : newValue;
|
|
5517
2930
|
if (value === void 0) {
|
|
5518
2931
|
api.remove(key);
|
|
5519
2932
|
} else {
|