@e1011/es-kit 1.0.1 → 1.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/hooks/esm/node_modules/core-js/internals/document-all.js +1 -0
- package/dist/hooks/esm/node_modules/core-js/internals/document-all.js.map +1 -1
- package/dist/hooks/esm/node_modules/core-js/internals/shared.js +2 -2
- package/dist/hooks/esm/node_modules/core-js/internals/shared.js.map +1 -1
- package/dist/hooks/esm/node_modules/lodash-es/_Symbol.js +9 -0
- package/dist/hooks/esm/node_modules/lodash-es/_Symbol.js.map +1 -0
- package/dist/hooks/esm/node_modules/lodash-es/_baseGetTag.js +29 -0
- package/dist/hooks/esm/node_modules/lodash-es/_baseGetTag.js.map +1 -0
- package/dist/hooks/esm/node_modules/lodash-es/_baseTrim.js +20 -0
- package/dist/hooks/esm/node_modules/lodash-es/_baseTrim.js.map +1 -0
- package/dist/hooks/esm/node_modules/lodash-es/_freeGlobal.js +7 -0
- package/dist/hooks/esm/node_modules/lodash-es/_freeGlobal.js.map +1 -0
- package/dist/hooks/esm/node_modules/lodash-es/_getRawTag.js +47 -0
- package/dist/hooks/esm/node_modules/lodash-es/_getRawTag.js.map +1 -0
- package/dist/hooks/esm/node_modules/lodash-es/_objectToString.js +23 -0
- package/dist/hooks/esm/node_modules/lodash-es/_objectToString.js.map +1 -0
- package/dist/hooks/esm/node_modules/lodash-es/_root.js +12 -0
- package/dist/hooks/esm/node_modules/lodash-es/_root.js.map +1 -0
- package/dist/hooks/esm/node_modules/lodash-es/_trimmedEndIndex.js +20 -0
- package/dist/hooks/esm/node_modules/lodash-es/_trimmedEndIndex.js.map +1 -0
- package/dist/hooks/esm/node_modules/lodash-es/debounce.js +192 -0
- package/dist/hooks/esm/node_modules/lodash-es/debounce.js.map +1 -0
- package/dist/hooks/esm/node_modules/lodash-es/isObject.js +32 -0
- package/dist/hooks/esm/node_modules/lodash-es/isObject.js.map +1 -0
- package/dist/hooks/esm/node_modules/lodash-es/isObjectLike.js +30 -0
- package/dist/hooks/esm/node_modules/lodash-es/isObjectLike.js.map +1 -0
- package/dist/hooks/esm/node_modules/lodash-es/isSymbol.js +30 -0
- package/dist/hooks/esm/node_modules/lodash-es/isSymbol.js.map +1 -0
- package/dist/hooks/esm/node_modules/lodash-es/now.js +26 -0
- package/dist/hooks/esm/node_modules/lodash-es/now.js.map +1 -0
- package/dist/hooks/esm/node_modules/lodash-es/toNumber.js +65 -0
- package/dist/hooks/esm/node_modules/lodash-es/toNumber.js.map +1 -0
- package/dist/hooks/esm/src/core/hooks/index.js +1 -0
- package/dist/hooks/esm/src/core/hooks/index.js.map +1 -1
- package/dist/hooks/esm/src/core/hooks/useResize.js +66 -0
- package/dist/hooks/esm/src/core/hooks/useResize.js.map +1 -0
- package/dist/hooks/node_modules/core-js/internals/document-all.js +1 -0
- package/dist/hooks/node_modules/core-js/internals/document-all.js.map +1 -1
- package/dist/hooks/node_modules/core-js/internals/shared.js +2 -2
- package/dist/hooks/node_modules/core-js/internals/shared.js.map +1 -1
- package/dist/hooks/node_modules/lodash-es/_Symbol.js +11 -0
- package/dist/hooks/node_modules/lodash-es/_Symbol.js.map +1 -0
- package/dist/hooks/node_modules/lodash-es/_baseGetTag.js +31 -0
- package/dist/hooks/node_modules/lodash-es/_baseGetTag.js.map +1 -0
- package/dist/hooks/node_modules/lodash-es/_baseTrim.js +22 -0
- package/dist/hooks/node_modules/lodash-es/_baseTrim.js.map +1 -0
- package/dist/hooks/node_modules/lodash-es/_freeGlobal.js +9 -0
- package/dist/hooks/node_modules/lodash-es/_freeGlobal.js.map +1 -0
- package/dist/hooks/node_modules/lodash-es/_getRawTag.js +49 -0
- package/dist/hooks/node_modules/lodash-es/_getRawTag.js.map +1 -0
- package/dist/hooks/node_modules/lodash-es/_objectToString.js +25 -0
- package/dist/hooks/node_modules/lodash-es/_objectToString.js.map +1 -0
- package/dist/hooks/node_modules/lodash-es/_root.js +14 -0
- package/dist/hooks/node_modules/lodash-es/_root.js.map +1 -0
- package/dist/hooks/node_modules/lodash-es/_trimmedEndIndex.js +22 -0
- package/dist/hooks/node_modules/lodash-es/_trimmedEndIndex.js.map +1 -0
- package/dist/hooks/node_modules/lodash-es/debounce.js +194 -0
- package/dist/hooks/node_modules/lodash-es/debounce.js.map +1 -0
- package/dist/hooks/node_modules/lodash-es/isObject.js +34 -0
- package/dist/hooks/node_modules/lodash-es/isObject.js.map +1 -0
- package/dist/hooks/node_modules/lodash-es/isObjectLike.js +32 -0
- package/dist/hooks/node_modules/lodash-es/isObjectLike.js.map +1 -0
- package/dist/hooks/node_modules/lodash-es/isSymbol.js +32 -0
- package/dist/hooks/node_modules/lodash-es/isSymbol.js.map +1 -0
- package/dist/hooks/node_modules/lodash-es/now.js +28 -0
- package/dist/hooks/node_modules/lodash-es/now.js.map +1 -0
- package/dist/hooks/node_modules/lodash-es/toNumber.js +67 -0
- package/dist/hooks/node_modules/lodash-es/toNumber.js.map +1 -0
- package/dist/hooks/src/core/hooks/index.js +2 -0
- package/dist/hooks/src/core/hooks/index.js.map +1 -1
- package/dist/hooks/src/core/hooks/useResize.js +70 -0
- package/dist/hooks/src/core/hooks/useResize.js.map +1 -0
- package/dist/lib/cjs/_virtual/is-pure.js +8 -0
- package/dist/lib/cjs/_virtual/is-pure.js.map +1 -0
- package/dist/lib/cjs/_virtual/path.js +8 -0
- package/dist/lib/cjs/_virtual/path.js.map +1 -0
- package/dist/lib/cjs/node_modules/core-js/internals/document-all.js +1 -0
- package/dist/lib/cjs/node_modules/core-js/internals/document-all.js.map +1 -1
- package/dist/lib/cjs/node_modules/core-js/internals/is-pure.js +9 -0
- package/dist/lib/cjs/node_modules/core-js/internals/is-pure.js.map +1 -0
- package/dist/lib/cjs/node_modules/core-js/internals/path.js +11 -0
- package/dist/lib/cjs/node_modules/core-js/internals/path.js.map +1 -0
- package/dist/lib/cjs/node_modules/core-js/internals/shared.js +2 -2
- package/dist/lib/cjs/node_modules/core-js/internals/shared.js.map +1 -1
- package/dist/lib/cjs/node_modules/core-js/modules/es.number.constructor.js +32 -18
- package/dist/lib/cjs/node_modules/core-js/modules/es.number.constructor.js.map +1 -1
- package/dist/lib/cjs/node_modules/lodash-es/_Symbol.js +11 -0
- package/dist/lib/cjs/node_modules/lodash-es/_Symbol.js.map +1 -0
- package/dist/lib/cjs/node_modules/lodash-es/_baseGetTag.js +31 -0
- package/dist/lib/cjs/node_modules/lodash-es/_baseGetTag.js.map +1 -0
- package/dist/lib/cjs/node_modules/lodash-es/_baseTrim.js +22 -0
- package/dist/lib/cjs/node_modules/lodash-es/_baseTrim.js.map +1 -0
- package/dist/lib/cjs/node_modules/lodash-es/_freeGlobal.js +9 -0
- package/dist/lib/cjs/node_modules/lodash-es/_freeGlobal.js.map +1 -0
- package/dist/lib/cjs/node_modules/lodash-es/_getRawTag.js +49 -0
- package/dist/lib/cjs/node_modules/lodash-es/_getRawTag.js.map +1 -0
- package/dist/lib/cjs/node_modules/lodash-es/_objectToString.js +25 -0
- package/dist/lib/cjs/node_modules/lodash-es/_objectToString.js.map +1 -0
- package/dist/lib/cjs/node_modules/lodash-es/_root.js +14 -0
- package/dist/lib/cjs/node_modules/lodash-es/_root.js.map +1 -0
- package/dist/lib/cjs/node_modules/lodash-es/_trimmedEndIndex.js +22 -0
- package/dist/lib/cjs/node_modules/lodash-es/_trimmedEndIndex.js.map +1 -0
- package/dist/lib/cjs/node_modules/lodash-es/debounce.js +194 -0
- package/dist/lib/cjs/node_modules/lodash-es/debounce.js.map +1 -0
- package/dist/lib/cjs/node_modules/lodash-es/isObject.js +34 -0
- package/dist/lib/cjs/node_modules/lodash-es/isObject.js.map +1 -0
- package/dist/lib/cjs/node_modules/lodash-es/isObjectLike.js +32 -0
- package/dist/lib/cjs/node_modules/lodash-es/isObjectLike.js.map +1 -0
- package/dist/lib/cjs/node_modules/lodash-es/isSymbol.js +32 -0
- package/dist/lib/cjs/node_modules/lodash-es/isSymbol.js.map +1 -0
- package/dist/lib/cjs/node_modules/lodash-es/now.js +28 -0
- package/dist/lib/cjs/node_modules/lodash-es/now.js.map +1 -0
- package/dist/lib/cjs/node_modules/lodash-es/toNumber.js +67 -0
- package/dist/lib/cjs/node_modules/lodash-es/toNumber.js.map +1 -0
- package/dist/lib/cjs/src/core/hooks/useResize.js +70 -0
- package/dist/lib/cjs/src/core/hooks/useResize.js.map +1 -0
- package/dist/lib/cjs/src/core/ui/components/container/Container.js +2 -2
- package/dist/lib/cjs/src/core/ui/components/container/Container.js.map +1 -1
- package/dist/lib/cjs/src/core/ui/components/container/Flex.js +3 -3
- package/dist/lib/cjs/src/core/ui/components/container/Placeholder.js +1 -1
- package/dist/lib/cjs/src/core/ui/components/dividers/DividerLine.js +1 -1
- package/dist/lib/cjs/src/core/ui/components/dividers/DividerLine.js.map +1 -1
- package/dist/lib/cjs/src/core/ui/components/field/Field.js +5 -5
- package/dist/lib/cjs/src/core/ui/components/field/Field.js.map +1 -1
- package/dist/lib/cjs/src/index.js +2 -0
- package/dist/lib/cjs/src/index.js.map +1 -1
- package/dist/lib/esm/_virtual/is-pure.js +3 -0
- package/dist/lib/esm/_virtual/is-pure.js.map +1 -0
- package/dist/lib/esm/_virtual/path.js +3 -0
- package/dist/lib/esm/_virtual/path.js.map +1 -0
- package/dist/lib/esm/node_modules/core-js/internals/document-all.js +1 -0
- package/dist/lib/esm/node_modules/core-js/internals/document-all.js.map +1 -1
- package/dist/lib/esm/node_modules/core-js/internals/is-pure.js +4 -0
- package/dist/lib/esm/node_modules/core-js/internals/is-pure.js.map +1 -0
- package/dist/lib/esm/node_modules/core-js/internals/path.js +6 -0
- package/dist/lib/esm/node_modules/core-js/internals/path.js.map +1 -0
- package/dist/lib/esm/node_modules/core-js/internals/shared.js +2 -2
- package/dist/lib/esm/node_modules/core-js/internals/shared.js.map +1 -1
- package/dist/lib/esm/node_modules/core-js/modules/es.number.constructor.js +32 -18
- package/dist/lib/esm/node_modules/core-js/modules/es.number.constructor.js.map +1 -1
- package/dist/lib/esm/node_modules/lodash-es/_Symbol.js +9 -0
- package/dist/lib/esm/node_modules/lodash-es/_Symbol.js.map +1 -0
- package/dist/lib/esm/node_modules/lodash-es/_baseGetTag.js +29 -0
- package/dist/lib/esm/node_modules/lodash-es/_baseGetTag.js.map +1 -0
- package/dist/lib/esm/node_modules/lodash-es/_baseTrim.js +20 -0
- package/dist/lib/esm/node_modules/lodash-es/_baseTrim.js.map +1 -0
- package/dist/lib/esm/node_modules/lodash-es/_freeGlobal.js +7 -0
- package/dist/lib/esm/node_modules/lodash-es/_freeGlobal.js.map +1 -0
- package/dist/lib/esm/node_modules/lodash-es/_getRawTag.js +47 -0
- package/dist/lib/esm/node_modules/lodash-es/_getRawTag.js.map +1 -0
- package/dist/lib/esm/node_modules/lodash-es/_objectToString.js +23 -0
- package/dist/lib/esm/node_modules/lodash-es/_objectToString.js.map +1 -0
- package/dist/lib/esm/node_modules/lodash-es/_root.js +12 -0
- package/dist/lib/esm/node_modules/lodash-es/_root.js.map +1 -0
- package/dist/lib/esm/node_modules/lodash-es/_trimmedEndIndex.js +20 -0
- package/dist/lib/esm/node_modules/lodash-es/_trimmedEndIndex.js.map +1 -0
- package/dist/lib/esm/node_modules/lodash-es/debounce.js +192 -0
- package/dist/lib/esm/node_modules/lodash-es/debounce.js.map +1 -0
- package/dist/lib/esm/node_modules/lodash-es/isObject.js +32 -0
- package/dist/lib/esm/node_modules/lodash-es/isObject.js.map +1 -0
- package/dist/lib/esm/node_modules/lodash-es/isObjectLike.js +30 -0
- package/dist/lib/esm/node_modules/lodash-es/isObjectLike.js.map +1 -0
- package/dist/lib/esm/node_modules/lodash-es/isSymbol.js +30 -0
- package/dist/lib/esm/node_modules/lodash-es/isSymbol.js.map +1 -0
- package/dist/lib/esm/node_modules/lodash-es/now.js +26 -0
- package/dist/lib/esm/node_modules/lodash-es/now.js.map +1 -0
- package/dist/lib/esm/node_modules/lodash-es/toNumber.js +65 -0
- package/dist/lib/esm/node_modules/lodash-es/toNumber.js.map +1 -0
- package/dist/lib/esm/src/core/hooks/useResize.js +66 -0
- package/dist/lib/esm/src/core/hooks/useResize.js.map +1 -0
- package/dist/lib/esm/src/core/ui/components/container/Container.js +2 -2
- package/dist/lib/esm/src/core/ui/components/container/Container.js.map +1 -1
- package/dist/lib/esm/src/core/ui/components/container/Flex.js +3 -3
- package/dist/lib/esm/src/core/ui/components/container/Placeholder.js +1 -1
- package/dist/lib/esm/src/core/ui/components/dividers/DividerLine.js +1 -1
- package/dist/lib/esm/src/core/ui/components/dividers/DividerLine.js.map +1 -1
- package/dist/lib/esm/src/core/ui/components/field/Field.js +5 -5
- package/dist/lib/esm/src/core/ui/components/field/Field.js.map +1 -1
- package/dist/lib/esm/src/index.js +1 -0
- package/dist/lib/esm/src/index.js.map +1 -1
- package/dist/lib/src/core/hooks/index.js +1 -0
- package/dist/lib/src/core/hooks/index.js.map +1 -1
- package/dist/types/src/core/hooks/index.d.ts +1 -0
- package/dist/types/src/core/hooks/index.d.ts.map +1 -1
- package/dist/types/src/core/ui/components/container/Flex.d.ts +2 -2
- package/dist/ui/esm/node_modules/core-js/internals/document-all.js +1 -0
- package/dist/ui/esm/node_modules/core-js/internals/document-all.js.map +1 -1
- package/dist/ui/esm/node_modules/core-js/internals/shared.js +2 -2
- package/dist/ui/esm/node_modules/core-js/internals/shared.js.map +1 -1
- package/dist/ui/esm/src/core/ui/components/container/Container.js +2 -2
- package/dist/ui/esm/src/core/ui/components/container/Container.js.map +1 -1
- package/dist/ui/esm/src/core/ui/components/container/Flex.js +3 -3
- package/dist/ui/esm/src/core/ui/components/container/Placeholder.js +1 -1
- package/dist/ui/esm/src/core/ui/components/dividers/DividerLine.js +1 -1
- package/dist/ui/esm/src/core/ui/components/dividers/DividerLine.js.map +1 -1
- package/dist/ui/esm/src/core/ui/components/field/Field.js +5 -5
- package/dist/ui/esm/src/core/ui/components/field/Field.js.map +1 -1
- package/dist/ui/node_modules/core-js/internals/document-all.js +1 -0
- package/dist/ui/node_modules/core-js/internals/document-all.js.map +1 -1
- package/dist/ui/node_modules/core-js/internals/shared.js +2 -2
- package/dist/ui/node_modules/core-js/internals/shared.js.map +1 -1
- package/dist/ui/src/core/ui/components/container/Container.js +2 -2
- package/dist/ui/src/core/ui/components/container/Container.js.map +1 -1
- package/dist/ui/src/core/ui/components/container/Flex.js +3 -3
- package/dist/ui/src/core/ui/components/container/Placeholder.js +1 -1
- package/dist/ui/src/core/ui/components/dividers/DividerLine.js +1 -1
- package/dist/ui/src/core/ui/components/dividers/DividerLine.js.map +1 -1
- package/dist/ui/src/core/ui/components/field/Field.js +5 -5
- package/dist/ui/src/core/ui/components/field/Field.js.map +1 -1
- package/dist/utils/_virtual/is-pure.js +8 -0
- package/dist/utils/_virtual/is-pure.js.map +1 -0
- package/dist/utils/_virtual/path.js +8 -0
- package/dist/utils/_virtual/path.js.map +1 -0
- package/dist/utils/esm/_virtual/is-pure.js +3 -0
- package/dist/utils/esm/_virtual/is-pure.js.map +1 -0
- package/dist/utils/esm/_virtual/path.js +3 -0
- package/dist/utils/esm/_virtual/path.js.map +1 -0
- package/dist/utils/esm/node_modules/core-js/internals/document-all.js +1 -0
- package/dist/utils/esm/node_modules/core-js/internals/document-all.js.map +1 -1
- package/dist/utils/esm/node_modules/core-js/internals/is-pure.js +4 -0
- package/dist/utils/esm/node_modules/core-js/internals/is-pure.js.map +1 -0
- package/dist/utils/esm/node_modules/core-js/internals/path.js +6 -0
- package/dist/utils/esm/node_modules/core-js/internals/path.js.map +1 -0
- package/dist/utils/esm/node_modules/core-js/internals/shared.js +2 -2
- package/dist/utils/esm/node_modules/core-js/internals/shared.js.map +1 -1
- package/dist/utils/esm/node_modules/core-js/modules/es.number.constructor.js +32 -18
- package/dist/utils/esm/node_modules/core-js/modules/es.number.constructor.js.map +1 -1
- package/dist/utils/node_modules/core-js/internals/document-all.js +1 -0
- package/dist/utils/node_modules/core-js/internals/document-all.js.map +1 -1
- package/dist/utils/node_modules/core-js/internals/is-pure.js +9 -0
- package/dist/utils/node_modules/core-js/internals/is-pure.js.map +1 -0
- package/dist/utils/node_modules/core-js/internals/path.js +11 -0
- package/dist/utils/node_modules/core-js/internals/path.js.map +1 -0
- package/dist/utils/node_modules/core-js/internals/shared.js +2 -2
- package/dist/utils/node_modules/core-js/internals/shared.js.map +1 -1
- package/dist/utils/node_modules/core-js/modules/es.number.constructor.js +32 -18
- package/dist/utils/node_modules/core-js/modules/es.number.constructor.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import baseTrim from './_baseTrim.js';
|
|
2
|
+
import isObject from './isObject.js';
|
|
3
|
+
import isSymbol from './isSymbol.js';
|
|
4
|
+
|
|
5
|
+
/** Used as references for various `Number` constants. */
|
|
6
|
+
var NAN = 0 / 0;
|
|
7
|
+
|
|
8
|
+
/** Used to detect bad signed hexadecimal string values. */
|
|
9
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
10
|
+
|
|
11
|
+
/** Used to detect binary string values. */
|
|
12
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
13
|
+
|
|
14
|
+
/** Used to detect octal string values. */
|
|
15
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
16
|
+
|
|
17
|
+
/** Built-in method references without a dependency on `root`. */
|
|
18
|
+
var freeParseInt = parseInt;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Converts `value` to a number.
|
|
22
|
+
*
|
|
23
|
+
* @static
|
|
24
|
+
* @memberOf _
|
|
25
|
+
* @since 4.0.0
|
|
26
|
+
* @category Lang
|
|
27
|
+
* @param {*} value The value to process.
|
|
28
|
+
* @returns {number} Returns the number.
|
|
29
|
+
* @example
|
|
30
|
+
*
|
|
31
|
+
* _.toNumber(3.2);
|
|
32
|
+
* // => 3.2
|
|
33
|
+
*
|
|
34
|
+
* _.toNumber(Number.MIN_VALUE);
|
|
35
|
+
* // => 5e-324
|
|
36
|
+
*
|
|
37
|
+
* _.toNumber(Infinity);
|
|
38
|
+
* // => Infinity
|
|
39
|
+
*
|
|
40
|
+
* _.toNumber('3.2');
|
|
41
|
+
* // => 3.2
|
|
42
|
+
*/
|
|
43
|
+
function toNumber(value) {
|
|
44
|
+
if (typeof value == 'number') {
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
if (isSymbol(value)) {
|
|
48
|
+
return NAN;
|
|
49
|
+
}
|
|
50
|
+
if (isObject(value)) {
|
|
51
|
+
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
52
|
+
value = isObject(other) ? (other + '') : other;
|
|
53
|
+
}
|
|
54
|
+
if (typeof value != 'string') {
|
|
55
|
+
return value === 0 ? value : +value;
|
|
56
|
+
}
|
|
57
|
+
value = baseTrim(value);
|
|
58
|
+
var isBinary = reIsBinary.test(value);
|
|
59
|
+
return (isBinary || reIsOctal.test(value))
|
|
60
|
+
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
61
|
+
: (reIsBadHex.test(value) ? NAN : +value);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { toNumber as default };
|
|
65
|
+
//# sourceMappingURL=toNumber.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toNumber.js","sources":["../../../../../node_modules/lodash-es/toNumber.js"],"sourcesContent":["import baseTrim from './_baseTrim.js';\nimport isObject from './isObject.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nexport default toNumber;\n"],"names":[],"mappings":";;;;AAIA;AACA,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;AAChB;AACA;AACA,IAAI,UAAU,GAAG,oBAAoB,CAAC;AACtC;AACA;AACA,IAAI,UAAU,GAAG,YAAY,CAAC;AAC9B;AACA;AACA,IAAI,SAAS,GAAG,aAAa,CAAC;AAC9B;AACA;AACA,IAAI,YAAY,GAAG,QAAQ,CAAC;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,QAAQ,CAAC,KAAK,EAAE;AACzB,EAAE,IAAI,OAAO,KAAK,IAAI,QAAQ,EAAE;AAChC,IAAI,OAAO,KAAK,CAAC;AACjB,GAAG;AACH,EAAE,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;AACvB,IAAI,OAAO,GAAG,CAAC;AACf,GAAG;AACH,EAAE,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;AACvB,IAAI,IAAI,KAAK,GAAG,OAAO,KAAK,CAAC,OAAO,IAAI,UAAU,GAAG,KAAK,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC;AAC7E,IAAI,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE,IAAI,KAAK,CAAC;AACnD,GAAG;AACH,EAAE,IAAI,OAAO,KAAK,IAAI,QAAQ,EAAE;AAChC,IAAI,OAAO,KAAK,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC;AACxC,GAAG;AACH,EAAE,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC1B,EAAE,IAAI,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACxC,EAAE,OAAO,CAAC,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;AAC3C,MAAM,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,GAAG,CAAC,GAAG,CAAC,CAAC;AACpD,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;AAC9C;;;;"}
|
|
@@ -2,4 +2,5 @@ export { useApi } from './useApi.js';
|
|
|
2
2
|
export { useToggle } from './useToggle.js';
|
|
3
3
|
export { createSafeT, setUseTranslation, useTranslations } from './useTranslations.js';
|
|
4
4
|
export { useOutsideClick } from './useOutsideClick.js';
|
|
5
|
+
export { useResize } from './useResize.js';
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { useState, useRef, useMemo, useEffect } from 'react';
|
|
3
|
+
import debounce from '../../../node_modules/lodash-es/debounce.js';
|
|
4
|
+
|
|
5
|
+
var useResize = function useResize() {
|
|
6
|
+
var debounceDelay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 250;
|
|
7
|
+
var _useState = useState({
|
|
8
|
+
width: undefined,
|
|
9
|
+
height: undefined
|
|
10
|
+
}),
|
|
11
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
12
|
+
containerSize = _useState2[0],
|
|
13
|
+
setContainerSize = _useState2[1];
|
|
14
|
+
var lastResizeWidthRef = useRef({
|
|
15
|
+
width: 0,
|
|
16
|
+
height: 0
|
|
17
|
+
});
|
|
18
|
+
var containerRef = useRef();
|
|
19
|
+
|
|
20
|
+
// const [unobserver, setUnobserver] = useState<Unobserver>(DefaultUnobserver)
|
|
21
|
+
var unobserverRef = useRef();
|
|
22
|
+
var debouncedResizeWrapper = useMemo(function () {
|
|
23
|
+
return debounce(function (entries) {
|
|
24
|
+
var _lastResizeWidthRef$c, _lastResizeWidthRef$c2, _containerRef$current, _containerRef$current2;
|
|
25
|
+
var newResizeWidth = entries[0].contentRect.width;
|
|
26
|
+
var newResizeHeight = entries[0].contentRect.height;
|
|
27
|
+
if (((_lastResizeWidthRef$c = lastResizeWidthRef.current) === null || _lastResizeWidthRef$c === void 0 ? void 0 : _lastResizeWidthRef$c.width) === newResizeWidth && ((_lastResizeWidthRef$c2 = lastResizeWidthRef.current) === null || _lastResizeWidthRef$c2 === void 0 ? void 0 : _lastResizeWidthRef$c2.height) === newResizeHeight) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
lastResizeWidthRef.current = {
|
|
31
|
+
width: newResizeWidth,
|
|
32
|
+
height: newResizeHeight
|
|
33
|
+
};
|
|
34
|
+
setContainerSize({
|
|
35
|
+
width: containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.clientWidth,
|
|
36
|
+
height: containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.clientHeight
|
|
37
|
+
});
|
|
38
|
+
}, debounceDelay);
|
|
39
|
+
}, [containerRef, debounceDelay]);
|
|
40
|
+
useEffect(function () {
|
|
41
|
+
var resizeObserver;
|
|
42
|
+
var containerElement;
|
|
43
|
+
if (containerRef !== null && containerRef !== void 0 && containerRef.current) {
|
|
44
|
+
var _containerRef$current3, _containerRef$current4;
|
|
45
|
+
containerElement = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current;
|
|
46
|
+
resizeObserver = new ResizeObserver(debouncedResizeWrapper);
|
|
47
|
+
resizeObserver.observe(containerElement);
|
|
48
|
+
setContainerSize({
|
|
49
|
+
width: containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.clientWidth,
|
|
50
|
+
height: containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.clientHeight
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
var unobserver = function unobserver() {
|
|
54
|
+
var _resizeObserver, _resizeObserver$unobs;
|
|
55
|
+
(_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : (_resizeObserver$unobs = _resizeObserver.unobserve) === null || _resizeObserver$unobs === void 0 ? void 0 : _resizeObserver$unobs.call(_resizeObserver, containerElement);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// setUnobserver(unobserver)
|
|
59
|
+
unobserverRef.current = unobserver;
|
|
60
|
+
return unobserver;
|
|
61
|
+
}, [debouncedResizeWrapper, containerRef]);
|
|
62
|
+
return [containerRef, containerSize, unobserverRef.current];
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export { useResize };
|
|
66
|
+
//# sourceMappingURL=useResize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResize.js","sources":["../../../../../../src/core/hooks/useResize.ts"],"sourcesContent":["import { MutableRefObject, useEffect, useMemo, useState, useRef } from 'react'\nimport debounce from 'lodash-es/debounce'\n\ntype WrapperSize = {width: undefined | number; height: undefined | number}\n\n// const DefaultUnobserver = () => null\n\ntype Unobserver = () => (null | void)\n\nexport const useResize = (debounceDelay = 250): [\n MutableRefObject<HTMLElement | null | undefined>, WrapperSize, Unobserver | undefined] => {\n const [containerSize, setContainerSize]\n = useState<WrapperSize>({ width: undefined, height: undefined })\n\n const lastResizeWidthRef = useRef<WrapperSize>({ width: 0, height: 0 })\n const containerRef: MutableRefObject<HTMLElement | undefined | null> = useRef<HTMLElement | undefined | null>()\n\n // const [unobserver, setUnobserver] = useState<Unobserver>(DefaultUnobserver)\n const unobserverRef = useRef<Unobserver>()\n\n const debouncedResizeWrapper = useMemo(() => debounce((entries) => {\n const newResizeWidth = entries[0].contentRect.width\n const newResizeHeight = entries[0].contentRect.height\n\n if (lastResizeWidthRef.current?.width === newResizeWidth\n && lastResizeWidthRef.current?.height === newResizeHeight) {\n return\n }\n lastResizeWidthRef.current = { width: newResizeWidth, height: newResizeHeight }\n\n setContainerSize({\n width: containerRef?.current?.clientWidth,\n height: containerRef?.current?.clientHeight,\n })\n }, debounceDelay), [containerRef, debounceDelay])\n\n useEffect(() => {\n let resizeObserver: ResizeObserver\n let containerElement: HTMLElement\n\n if (containerRef?.current) {\n containerElement = containerRef?.current\n resizeObserver = new ResizeObserver(debouncedResizeWrapper)\n resizeObserver.observe(containerElement as Element)\n\n setContainerSize({\n width: containerRef?.current?.clientWidth,\n height: containerRef?.current?.clientHeight,\n })\n }\n const unobserver = () => {\n resizeObserver?.unobserve?.(containerElement as Element)\n }\n\n // setUnobserver(unobserver)\n unobserverRef.current = unobserver\n\n return unobserver\n }, [debouncedResizeWrapper, containerRef])\n\n return [containerRef, containerSize, unobserverRef.current]\n}\n"],"names":["useResize","debounceDelay","useState","width","undefined","height","containerSize","setContainerSize","lastResizeWidthRef","useRef","containerRef","unobserverRef","debouncedResizeWrapper","useMemo","debounce","entries","newResizeWidth","contentRect","newResizeHeight","current","clientWidth","clientHeight","useEffect","resizeObserver","containerElement","ResizeObserver","observe","unobserver","unobserve"],"mappings":"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"}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var documentAll = typeof document == 'object' && document.all;
|
|
6
6
|
|
|
7
7
|
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
|
8
|
+
// eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
|
|
8
9
|
var IS_HTMLDDA = typeof documentAll == 'undefined' && documentAll !== undefined;
|
|
9
10
|
|
|
10
11
|
var documentAll_1 = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-all.js","sources":["../../../../../node_modules/core-js/internals/document-all.js"],"sourcesContent":["var documentAll = typeof document == 'object' && document.all;\n\n// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot\nvar IS_HTMLDDA = typeof documentAll == 'undefined' && documentAll !== undefined;\n\nmodule.exports = {\n all: documentAll,\n IS_HTMLDDA: IS_HTMLDDA\n};\n"],"names":[],"mappings":";;;;AAAA,IAAI,WAAW,GAAG,OAAO,QAAQ,IAAI,QAAQ,IAAI,QAAQ,CAAC,GAAG,CAAC;AAC9D;AACA;AACA,IAAI,UAAU,GAAG,OAAO,WAAW,IAAI,WAAW,IAAI,WAAW,KAAK,SAAS,CAAC;AAChF;AACA,IAAA,aAAc,GAAG;AACjB,EAAE,GAAG,EAAE,WAAW;AAClB,EAAE,UAAU,EAAE,UAAU;AACxB;;;;;"}
|
|
1
|
+
{"version":3,"file":"document-all.js","sources":["../../../../../node_modules/core-js/internals/document-all.js"],"sourcesContent":["var documentAll = typeof document == 'object' && document.all;\n\n// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot\n// eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing\nvar IS_HTMLDDA = typeof documentAll == 'undefined' && documentAll !== undefined;\n\nmodule.exports = {\n all: documentAll,\n IS_HTMLDDA: IS_HTMLDDA\n};\n"],"names":[],"mappings":";;;;AAAA,IAAI,WAAW,GAAG,OAAO,QAAQ,IAAI,QAAQ,IAAI,QAAQ,CAAC,GAAG,CAAC;AAC9D;AACA;AACA;AACA,IAAI,UAAU,GAAG,OAAO,WAAW,IAAI,WAAW,IAAI,WAAW,KAAK,SAAS,CAAC;AAChF;AACA,IAAA,aAAc,GAAG;AACjB,EAAE,GAAG,EAAE,WAAW;AAClB,EAAE,UAAU,EAAE,UAAU;AACxB;;;;;"}
|
|
@@ -9,10 +9,10 @@ var shared = _commonjsHelpers.createCommonjsModule(function (module) {
|
|
|
9
9
|
(module.exports = function (key, value) {
|
|
10
10
|
return sharedStore["default"][key] || (sharedStore["default"][key] = value !== undefined ? value : {});
|
|
11
11
|
})('versions', []).push({
|
|
12
|
-
version: '3.
|
|
12
|
+
version: '3.27.1',
|
|
13
13
|
mode: 'global',
|
|
14
14
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
15
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
15
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.27.1/LICENSE',
|
|
16
16
|
source: 'https://github.com/zloirock/core-js'
|
|
17
17
|
});
|
|
18
18
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sources":["../../../../../node_modules/core-js/internals/shared.js"],"sourcesContent":["var IS_PURE = require('../internals/is-pure');\nvar store = require('../internals/shared-store');\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: '3.
|
|
1
|
+
{"version":3,"file":"shared.js","sources":["../../../../../node_modules/core-js/internals/shared.js"],"sourcesContent":["var IS_PURE = require('../internals/is-pure');\nvar store = require('../internals/shared-store');\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: '3.27.1',\n mode: IS_PURE ? 'pure' : 'global',\n copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',\n license: 'https://github.com/zloirock/core-js/blob/v3.27.1/LICENSE',\n source: 'https://github.com/zloirock/core-js'\n});\n"],"names":["store"],"mappings":";;;;;;;;AAGA,CAAC,cAAc,GAAG,UAAU,GAAG,EAAE,KAAK,EAAE;AACxC,EAAE,OAAOA,sBAAK,CAAC,GAAG,CAAC,KAAKA,sBAAK,CAAC,GAAG,CAAC,GAAG,KAAK,KAAK,SAAS,GAAG,KAAK,GAAG,EAAE,CAAC,CAAC;AACvE,CAAC,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC;AACxB,EAAE,OAAO,EAAE,QAAQ;AACnB,EAAE,IAAI,EAAqB,QAAQ;AACnC,EAAE,SAAS,EAAE,2CAA2C;AACxD,EAAE,OAAO,EAAE,0DAA0D;AACrE,EAAE,MAAM,EAAE,qCAAqC;AAC/C,CAAC,CAAC,CAAA;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_Symbol.js","sources":["../../../../node_modules/lodash-es/_Symbol.js"],"sourcesContent":["import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n"],"names":["root"],"mappings":";;;;AAEA;AACA,IAAI,MAAM,GAAGA,KAAI,CAAC,MAAM,CAAC;AACzB;AACA,eAAe,MAAM;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _Symbol = require('./_Symbol.js');
|
|
4
|
+
var _getRawTag = require('./_getRawTag.js');
|
|
5
|
+
var _objectToString = require('./_objectToString.js');
|
|
6
|
+
|
|
7
|
+
/** `Object#toString` result references. */
|
|
8
|
+
var nullTag = '[object Null]',
|
|
9
|
+
undefinedTag = '[object Undefined]';
|
|
10
|
+
|
|
11
|
+
/** Built-in value references. */
|
|
12
|
+
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
16
|
+
*
|
|
17
|
+
* @private
|
|
18
|
+
* @param {*} value The value to query.
|
|
19
|
+
* @returns {string} Returns the `toStringTag`.
|
|
20
|
+
*/
|
|
21
|
+
function baseGetTag(value) {
|
|
22
|
+
if (value == null) {
|
|
23
|
+
return value === undefined ? undefinedTag : nullTag;
|
|
24
|
+
}
|
|
25
|
+
return (symToStringTag && symToStringTag in Object(value))
|
|
26
|
+
? _getRawTag(value)
|
|
27
|
+
: _objectToString(value);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = baseGetTag;
|
|
31
|
+
//# sourceMappingURL=_baseGetTag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_baseGetTag.js","sources":["../../../../node_modules/lodash-es/_baseGetTag.js"],"sourcesContent":["import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n"],"names":["Symbol","getRawTag","objectToString"],"mappings":";;;;;;AAIA;AACA,IAAI,OAAO,GAAG,eAAe;AAC7B,IAAI,YAAY,GAAG,oBAAoB,CAAC;AACxC;AACA;AACA,IAAI,cAAc,GAAGA,OAAM,GAAGA,OAAM,CAAC,WAAW,GAAG,SAAS,CAAC;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,UAAU,CAAC,KAAK,EAAE;AAC3B,EAAE,IAAI,KAAK,IAAI,IAAI,EAAE;AACrB,IAAI,OAAO,KAAK,KAAK,SAAS,GAAG,YAAY,GAAG,OAAO,CAAC;AACxD,GAAG;AACH,EAAE,OAAO,CAAC,cAAc,IAAI,cAAc,IAAI,MAAM,CAAC,KAAK,CAAC;AAC3D,MAAMC,UAAS,CAAC,KAAK,CAAC;AACtB,MAAMC,eAAc,CAAC,KAAK,CAAC,CAAC;AAC5B;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _trimmedEndIndex = require('./_trimmedEndIndex.js');
|
|
4
|
+
|
|
5
|
+
/** Used to match leading whitespace. */
|
|
6
|
+
var reTrimStart = /^\s+/;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The base implementation of `_.trim`.
|
|
10
|
+
*
|
|
11
|
+
* @private
|
|
12
|
+
* @param {string} string The string to trim.
|
|
13
|
+
* @returns {string} Returns the trimmed string.
|
|
14
|
+
*/
|
|
15
|
+
function baseTrim(string) {
|
|
16
|
+
return string
|
|
17
|
+
? string.slice(0, _trimmedEndIndex(string) + 1).replace(reTrimStart, '')
|
|
18
|
+
: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = baseTrim;
|
|
22
|
+
//# sourceMappingURL=_baseTrim.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_baseTrim.js","sources":["../../../../node_modules/lodash-es/_baseTrim.js"],"sourcesContent":["import trimmedEndIndex from './_trimmedEndIndex.js';\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nexport default baseTrim;\n"],"names":["trimmedEndIndex"],"mappings":";;;;AAEA;AACA,IAAI,WAAW,GAAG,MAAM,CAAC;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,QAAQ,CAAC,MAAM,EAAE;AAC1B,EAAE,OAAO,MAAM;AACf,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC,EAAEA,gBAAe,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;AAC3E,MAAM,MAAM,CAAC;AACb;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/** Detect free variable `global` from Node.js. */
|
|
4
|
+
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
|
5
|
+
|
|
6
|
+
var freeGlobal$1 = freeGlobal;
|
|
7
|
+
|
|
8
|
+
module.exports = freeGlobal$1;
|
|
9
|
+
//# sourceMappingURL=_freeGlobal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_freeGlobal.js","sources":["../../../../node_modules/lodash-es/_freeGlobal.js"],"sourcesContent":["/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n"],"names":[],"mappings":";;AAAA;AACA,IAAI,UAAU,GAAG,OAAO,MAAM,IAAI,QAAQ,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC;AAC3F;AACA,mBAAe,UAAU;;;;"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _Symbol = require('./_Symbol.js');
|
|
4
|
+
|
|
5
|
+
/** Used for built-in method references. */
|
|
6
|
+
var objectProto = Object.prototype;
|
|
7
|
+
|
|
8
|
+
/** Used to check objects for own properties. */
|
|
9
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Used to resolve the
|
|
13
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
14
|
+
* of values.
|
|
15
|
+
*/
|
|
16
|
+
var nativeObjectToString = objectProto.toString;
|
|
17
|
+
|
|
18
|
+
/** Built-in value references. */
|
|
19
|
+
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
23
|
+
*
|
|
24
|
+
* @private
|
|
25
|
+
* @param {*} value The value to query.
|
|
26
|
+
* @returns {string} Returns the raw `toStringTag`.
|
|
27
|
+
*/
|
|
28
|
+
function getRawTag(value) {
|
|
29
|
+
var isOwn = hasOwnProperty.call(value, symToStringTag),
|
|
30
|
+
tag = value[symToStringTag];
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
value[symToStringTag] = undefined;
|
|
34
|
+
var unmasked = true;
|
|
35
|
+
} catch (e) {}
|
|
36
|
+
|
|
37
|
+
var result = nativeObjectToString.call(value);
|
|
38
|
+
if (unmasked) {
|
|
39
|
+
if (isOwn) {
|
|
40
|
+
value[symToStringTag] = tag;
|
|
41
|
+
} else {
|
|
42
|
+
delete value[symToStringTag];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
module.exports = getRawTag;
|
|
49
|
+
//# sourceMappingURL=_getRawTag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_getRawTag.js","sources":["../../../../node_modules/lodash-es/_getRawTag.js"],"sourcesContent":["import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n"],"names":["Symbol"],"mappings":";;;;AAEA;AACA,IAAI,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC;AACnC;AACA;AACA,IAAI,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,oBAAoB,GAAG,WAAW,CAAC,QAAQ,CAAC;AAChD;AACA;AACA,IAAI,cAAc,GAAGA,OAAM,GAAGA,OAAM,CAAC,WAAW,GAAG,SAAS,CAAC;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,SAAS,CAAC,KAAK,EAAE;AAC1B,EAAE,IAAI,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,cAAc,CAAC;AACxD,MAAM,GAAG,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;AAClC;AACA,EAAE,IAAI;AACN,IAAI,KAAK,CAAC,cAAc,CAAC,GAAG,SAAS,CAAC;AACtC,IAAI,IAAI,QAAQ,GAAG,IAAI,CAAC;AACxB,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE;AAChB;AACA,EAAE,IAAI,MAAM,GAAG,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAChD,EAAE,IAAI,QAAQ,EAAE;AAChB,IAAI,IAAI,KAAK,EAAE;AACf,MAAM,KAAK,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC;AAClC,KAAK,MAAM;AACX,MAAM,OAAO,KAAK,CAAC,cAAc,CAAC,CAAC;AACnC,KAAK;AACL,GAAG;AACH,EAAE,OAAO,MAAM,CAAC;AAChB;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/** Used for built-in method references. */
|
|
4
|
+
var objectProto = Object.prototype;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Used to resolve the
|
|
8
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
9
|
+
* of values.
|
|
10
|
+
*/
|
|
11
|
+
var nativeObjectToString = objectProto.toString;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
|
15
|
+
*
|
|
16
|
+
* @private
|
|
17
|
+
* @param {*} value The value to convert.
|
|
18
|
+
* @returns {string} Returns the converted string.
|
|
19
|
+
*/
|
|
20
|
+
function objectToString(value) {
|
|
21
|
+
return nativeObjectToString.call(value);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = objectToString;
|
|
25
|
+
//# sourceMappingURL=_objectToString.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_objectToString.js","sources":["../../../../node_modules/lodash-es/_objectToString.js"],"sourcesContent":["/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n"],"names":[],"mappings":";;AAAA;AACA,IAAI,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,oBAAoB,GAAG,WAAW,CAAC,QAAQ,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,cAAc,CAAC,KAAK,EAAE;AAC/B,EAAE,OAAO,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC1C;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _freeGlobal = require('./_freeGlobal.js');
|
|
4
|
+
|
|
5
|
+
/** Detect free variable `self`. */
|
|
6
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
7
|
+
|
|
8
|
+
/** Used as a reference to the global object. */
|
|
9
|
+
var root = _freeGlobal || freeSelf || Function('return this')();
|
|
10
|
+
|
|
11
|
+
var root$1 = root;
|
|
12
|
+
|
|
13
|
+
module.exports = root$1;
|
|
14
|
+
//# sourceMappingURL=_root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_root.js","sources":["../../../../node_modules/lodash-es/_root.js"],"sourcesContent":["import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n"],"names":["freeGlobal"],"mappings":";;;;AAEA;AACA,IAAI,QAAQ,GAAG,OAAO,IAAI,IAAI,QAAQ,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,IAAI,IAAI,CAAC;AACjF;AACA;AACA,IAAI,IAAI,GAAGA,WAAU,IAAI,QAAQ,IAAI,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;AAC/D;AACA,aAAe,IAAI;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/** Used to match a single whitespace character. */
|
|
4
|
+
var reWhitespace = /\s/;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
8
|
+
* character of `string`.
|
|
9
|
+
*
|
|
10
|
+
* @private
|
|
11
|
+
* @param {string} string The string to inspect.
|
|
12
|
+
* @returns {number} Returns the index of the last non-whitespace character.
|
|
13
|
+
*/
|
|
14
|
+
function trimmedEndIndex(string) {
|
|
15
|
+
var index = string.length;
|
|
16
|
+
|
|
17
|
+
while (index-- && reWhitespace.test(string.charAt(index))) {}
|
|
18
|
+
return index;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = trimmedEndIndex;
|
|
22
|
+
//# sourceMappingURL=_trimmedEndIndex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_trimmedEndIndex.js","sources":["../../../../node_modules/lodash-es/_trimmedEndIndex.js"],"sourcesContent":["/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nexport default trimmedEndIndex;\n"],"names":[],"mappings":";;AAAA;AACA,IAAI,YAAY,GAAG,IAAI,CAAC;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,eAAe,CAAC,MAAM,EAAE;AACjC,EAAE,IAAI,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;AAC5B;AACA,EAAE,OAAO,KAAK,EAAE,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE;AAC/D,EAAE,OAAO,KAAK,CAAC;AACf;;;;"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var isObject = require('./isObject.js');
|
|
4
|
+
var now = require('./now.js');
|
|
5
|
+
var toNumber = require('./toNumber.js');
|
|
6
|
+
|
|
7
|
+
/** Error message constants. */
|
|
8
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
9
|
+
|
|
10
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
11
|
+
var nativeMax = Math.max,
|
|
12
|
+
nativeMin = Math.min;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
16
|
+
* milliseconds have elapsed since the last time the debounced function was
|
|
17
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
18
|
+
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
19
|
+
* Provide `options` to indicate whether `func` should be invoked on the
|
|
20
|
+
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
21
|
+
* with the last arguments provided to the debounced function. Subsequent
|
|
22
|
+
* calls to the debounced function return the result of the last `func`
|
|
23
|
+
* invocation.
|
|
24
|
+
*
|
|
25
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
26
|
+
* invoked on the trailing edge of the timeout only if the debounced function
|
|
27
|
+
* is invoked more than once during the `wait` timeout.
|
|
28
|
+
*
|
|
29
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
30
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
31
|
+
*
|
|
32
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
33
|
+
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
34
|
+
*
|
|
35
|
+
* @static
|
|
36
|
+
* @memberOf _
|
|
37
|
+
* @since 0.1.0
|
|
38
|
+
* @category Function
|
|
39
|
+
* @param {Function} func The function to debounce.
|
|
40
|
+
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
41
|
+
* @param {Object} [options={}] The options object.
|
|
42
|
+
* @param {boolean} [options.leading=false]
|
|
43
|
+
* Specify invoking on the leading edge of the timeout.
|
|
44
|
+
* @param {number} [options.maxWait]
|
|
45
|
+
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
46
|
+
* @param {boolean} [options.trailing=true]
|
|
47
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
48
|
+
* @returns {Function} Returns the new debounced function.
|
|
49
|
+
* @example
|
|
50
|
+
*
|
|
51
|
+
* // Avoid costly calculations while the window size is in flux.
|
|
52
|
+
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
53
|
+
*
|
|
54
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
55
|
+
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
56
|
+
* 'leading': true,
|
|
57
|
+
* 'trailing': false
|
|
58
|
+
* }));
|
|
59
|
+
*
|
|
60
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
61
|
+
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
62
|
+
* var source = new EventSource('/stream');
|
|
63
|
+
* jQuery(source).on('message', debounced);
|
|
64
|
+
*
|
|
65
|
+
* // Cancel the trailing debounced invocation.
|
|
66
|
+
* jQuery(window).on('popstate', debounced.cancel);
|
|
67
|
+
*/
|
|
68
|
+
function debounce(func, wait, options) {
|
|
69
|
+
var lastArgs,
|
|
70
|
+
lastThis,
|
|
71
|
+
maxWait,
|
|
72
|
+
result,
|
|
73
|
+
timerId,
|
|
74
|
+
lastCallTime,
|
|
75
|
+
lastInvokeTime = 0,
|
|
76
|
+
leading = false,
|
|
77
|
+
maxing = false,
|
|
78
|
+
trailing = true;
|
|
79
|
+
|
|
80
|
+
if (typeof func != 'function') {
|
|
81
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
82
|
+
}
|
|
83
|
+
wait = toNumber(wait) || 0;
|
|
84
|
+
if (isObject(options)) {
|
|
85
|
+
leading = !!options.leading;
|
|
86
|
+
maxing = 'maxWait' in options;
|
|
87
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
88
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function invokeFunc(time) {
|
|
92
|
+
var args = lastArgs,
|
|
93
|
+
thisArg = lastThis;
|
|
94
|
+
|
|
95
|
+
lastArgs = lastThis = undefined;
|
|
96
|
+
lastInvokeTime = time;
|
|
97
|
+
result = func.apply(thisArg, args);
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function leadingEdge(time) {
|
|
102
|
+
// Reset any `maxWait` timer.
|
|
103
|
+
lastInvokeTime = time;
|
|
104
|
+
// Start the timer for the trailing edge.
|
|
105
|
+
timerId = setTimeout(timerExpired, wait);
|
|
106
|
+
// Invoke the leading edge.
|
|
107
|
+
return leading ? invokeFunc(time) : result;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function remainingWait(time) {
|
|
111
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
112
|
+
timeSinceLastInvoke = time - lastInvokeTime,
|
|
113
|
+
timeWaiting = wait - timeSinceLastCall;
|
|
114
|
+
|
|
115
|
+
return maxing
|
|
116
|
+
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
117
|
+
: timeWaiting;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function shouldInvoke(time) {
|
|
121
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
122
|
+
timeSinceLastInvoke = time - lastInvokeTime;
|
|
123
|
+
|
|
124
|
+
// Either this is the first call, activity has stopped and we're at the
|
|
125
|
+
// trailing edge, the system time has gone backwards and we're treating
|
|
126
|
+
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
127
|
+
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
128
|
+
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function timerExpired() {
|
|
132
|
+
var time = now();
|
|
133
|
+
if (shouldInvoke(time)) {
|
|
134
|
+
return trailingEdge(time);
|
|
135
|
+
}
|
|
136
|
+
// Restart the timer.
|
|
137
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function trailingEdge(time) {
|
|
141
|
+
timerId = undefined;
|
|
142
|
+
|
|
143
|
+
// Only invoke if we have `lastArgs` which means `func` has been
|
|
144
|
+
// debounced at least once.
|
|
145
|
+
if (trailing && lastArgs) {
|
|
146
|
+
return invokeFunc(time);
|
|
147
|
+
}
|
|
148
|
+
lastArgs = lastThis = undefined;
|
|
149
|
+
return result;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function cancel() {
|
|
153
|
+
if (timerId !== undefined) {
|
|
154
|
+
clearTimeout(timerId);
|
|
155
|
+
}
|
|
156
|
+
lastInvokeTime = 0;
|
|
157
|
+
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function flush() {
|
|
161
|
+
return timerId === undefined ? result : trailingEdge(now());
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function debounced() {
|
|
165
|
+
var time = now(),
|
|
166
|
+
isInvoking = shouldInvoke(time);
|
|
167
|
+
|
|
168
|
+
lastArgs = arguments;
|
|
169
|
+
lastThis = this;
|
|
170
|
+
lastCallTime = time;
|
|
171
|
+
|
|
172
|
+
if (isInvoking) {
|
|
173
|
+
if (timerId === undefined) {
|
|
174
|
+
return leadingEdge(lastCallTime);
|
|
175
|
+
}
|
|
176
|
+
if (maxing) {
|
|
177
|
+
// Handle invocations in a tight loop.
|
|
178
|
+
clearTimeout(timerId);
|
|
179
|
+
timerId = setTimeout(timerExpired, wait);
|
|
180
|
+
return invokeFunc(lastCallTime);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (timerId === undefined) {
|
|
184
|
+
timerId = setTimeout(timerExpired, wait);
|
|
185
|
+
}
|
|
186
|
+
return result;
|
|
187
|
+
}
|
|
188
|
+
debounced.cancel = cancel;
|
|
189
|
+
debounced.flush = flush;
|
|
190
|
+
return debounced;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
module.exports = debounce;
|
|
194
|
+
//# sourceMappingURL=debounce.js.map
|