@gooddata/util 11.68.0-alpha.2 → 11.68.0-alpha.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/esm/_/_assignValue.d.ts +12 -0
- package/esm/_/_assignValue.d.ts.map +1 -0
- package/esm/_/_assignValue.js +53 -0
- package/esm/_/_baseClone.d.ts +15 -0
- package/esm/_/_baseClone.d.ts.map +1 -0
- package/esm/_/_baseClone.js +224 -0
- package/esm/_/_baseEach.d.ts +11 -0
- package/esm/_/_baseEach.d.ts.map +1 -0
- package/esm/_/_baseEach.js +62 -0
- package/esm/_/_baseGet.d.ts +10 -0
- package/esm/_/_baseGet.d.ts.map +1 -0
- package/esm/_/_baseGet.js +50 -0
- package/esm/_/_baseGetTag.d.ts +9 -0
- package/esm/_/_baseGetTag.d.ts.map +1 -0
- package/esm/_/_baseGetTag.js +48 -0
- package/esm/_/_baseIsEqual.d.ts +34 -0
- package/esm/_/_baseIsEqual.d.ts.map +1 -0
- package/esm/_/_baseIsEqual.js +278 -0
- package/esm/_/_baseIsMatch.d.ts +13 -0
- package/esm/_/_baseIsMatch.d.ts.map +1 -0
- package/esm/_/_baseIsMatch.js +67 -0
- package/esm/_/_baseIteratee.d.ts +15 -0
- package/esm/_/_baseIteratee.d.ts.map +1 -0
- package/esm/_/_baseIteratee.js +65 -0
- package/esm/_/_baseKeys.d.ts +12 -0
- package/esm/_/_baseKeys.d.ts.map +1 -0
- package/esm/_/_baseKeys.js +46 -0
- package/esm/_/_baseMatches.d.ts +10 -0
- package/esm/_/_baseMatches.d.ts.map +1 -0
- package/esm/_/_baseMatches.js +50 -0
- package/esm/_/_baseMatchesProperty.d.ts +11 -0
- package/esm/_/_baseMatchesProperty.d.ts.map +1 -0
- package/esm/_/_baseMatchesProperty.js +59 -0
- package/esm/_/_baseSet.d.ts +11 -0
- package/esm/_/_baseSet.d.ts.map +1 -0
- package/esm/_/_baseSet.js +68 -0
- package/esm/_/_baseUniq.d.ts +43 -0
- package/esm/_/_baseUniq.d.ts.map +1 -0
- package/esm/_/_baseUniq.js +57 -0
- package/esm/_/_baseUnset.d.ts +13 -0
- package/esm/_/_baseUnset.d.ts.map +1 -0
- package/esm/_/_baseUnset.js +62 -0
- package/esm/_/_castPath.d.ts +10 -0
- package/esm/_/_castPath.d.ts.map +1 -0
- package/esm/_/_castPath.js +48 -0
- package/esm/_/_getAllKeys.d.ts +9 -0
- package/esm/_/_getAllKeys.d.ts.map +1 -0
- package/esm/_/_getAllKeys.js +43 -0
- package/esm/_/_getAllKeysIn.d.ts +12 -0
- package/esm/_/_getAllKeysIn.d.ts.map +1 -0
- package/esm/_/_getAllKeysIn.js +59 -0
- package/esm/_/_getMatchData.d.ts +16 -0
- package/esm/_/_getMatchData.d.ts.map +1 -0
- package/esm/_/_getMatchData.js +46 -0
- package/esm/_/_getRawTag.d.ts +43 -0
- package/esm/_/_getRawTag.d.ts.map +1 -0
- package/esm/_/_getRawTag.js +65 -0
- package/esm/_/_hasPath.d.ts +13 -0
- package/esm/_/_hasPath.d.ts.map +1 -0
- package/esm/_/_hasPath.js +70 -0
- package/esm/_/_isIndex.d.ts +11 -0
- package/esm/_/_isIndex.d.ts.map +1 -0
- package/esm/_/_isIndex.js +51 -0
- package/esm/_/_isIterateeCall.d.ts +13 -0
- package/esm/_/_isIterateeCall.d.ts.map +1 -0
- package/esm/_/_isIterateeCall.js +55 -0
- package/esm/_/_isKey.d.ts +12 -0
- package/esm/_/_isKey.d.ts.map +1 -0
- package/esm/_/_isKey.js +58 -0
- package/esm/_/_isPrototype.d.ts +39 -0
- package/esm/_/_isPrototype.d.ts.map +1 -0
- package/esm/_/_isPrototype.js +43 -0
- package/esm/_/_isStrictComparable.d.ts +9 -0
- package/esm/_/_isStrictComparable.d.ts.map +1 -0
- package/esm/_/_isStrictComparable.js +42 -0
- package/esm/_/_matchesStrictComparable.d.ts +41 -0
- package/esm/_/_matchesStrictComparable.d.ts.map +1 -0
- package/esm/_/_matchesStrictComparable.js +50 -0
- package/esm/_/_stringToPath.d.ts +10 -0
- package/esm/_/_stringToPath.d.ts.map +1 -0
- package/esm/_/_stringToPath.js +64 -0
- package/esm/_/_toKey.d.ts +9 -0
- package/esm/_/_toKey.d.ts.map +1 -0
- package/esm/_/_toKey.js +46 -0
- package/esm/_/cloneDeep.d.ts +14 -0
- package/esm/_/cloneDeep.d.ts.map +1 -0
- package/esm/_/cloneDeep.js +47 -0
- package/esm/_/compact.d.ts +46 -0
- package/esm/_/compact.d.ts.map +1 -0
- package/esm/_/compact.js +23 -0
- package/esm/_/debounce.d.ts +70 -0
- package/esm/_/debounce.d.ts.map +1 -0
- package/esm/_/debounce.js +136 -0
- package/esm/_/eq.d.ts +41 -0
- package/esm/_/eq.d.ts.map +1 -0
- package/esm/_/eq.js +43 -0
- package/esm/_/groupBy.d.ts +19 -0
- package/esm/_/groupBy.d.ts.map +1 -0
- package/esm/_/groupBy.js +49 -0
- package/esm/_/isArguments.d.ts +9 -0
- package/esm/_/isArguments.d.ts.map +1 -0
- package/esm/_/isArguments.js +45 -0
- package/esm/_/isArrayLike.d.ts +25 -0
- package/esm/_/isArrayLike.d.ts.map +1 -0
- package/esm/_/isArrayLike.js +35 -0
- package/esm/_/isEmpty.d.ts +49 -0
- package/esm/_/isEmpty.d.ts.map +1 -0
- package/esm/_/isEmpty.js +57 -0
- package/esm/_/isEqual.d.ts +15 -0
- package/esm/_/isEqual.d.ts.map +1 -0
- package/esm/_/isEqual.js +48 -0
- package/esm/_/isLength.d.ts +41 -0
- package/esm/_/isLength.d.ts.map +1 -0
- package/esm/_/isLength.js +43 -0
- package/esm/_/isObject.d.ts +40 -0
- package/esm/_/isObject.d.ts.map +1 -0
- package/esm/_/isObject.js +42 -0
- package/esm/_/isObjectLike.d.ts +40 -0
- package/esm/_/isObjectLike.d.ts.map +1 -0
- package/esm/_/isObjectLike.js +42 -0
- package/esm/_/isPlainObject.d.ts +10 -0
- package/esm/_/isPlainObject.d.ts.map +1 -0
- package/esm/_/isPlainObject.js +58 -0
- package/esm/_/isSymbol.d.ts +9 -0
- package/esm/_/isSymbol.d.ts.map +1 -0
- package/esm/_/isSymbol.js +45 -0
- package/esm/_/isTypedArray.d.ts +43 -0
- package/esm/_/isTypedArray.d.ts.map +1 -0
- package/esm/_/isTypedArray.js +45 -0
- package/esm/_/omit.d.ts +31 -0
- package/esm/_/omit.d.ts.map +1 -0
- package/esm/_/omit.js +76 -0
- package/esm/_/range.d.ts +24 -0
- package/esm/_/range.d.ts.map +1 -0
- package/esm/_/range.js +56 -0
- package/esm/_/set.d.ts +25 -0
- package/esm/_/set.d.ts.map +1 -0
- package/esm/_/set.js +35 -0
- package/esm/_/toFinite.d.ts +40 -0
- package/esm/_/toFinite.d.ts.map +1 -0
- package/esm/_/toFinite.js +50 -0
- package/esm/_/types.d.ts +70 -0
- package/esm/_/types.d.ts.map +1 -0
- package/esm/_/types.js +2 -0
- package/esm/_/uniqBy.d.ts +13 -0
- package/esm/_/uniqBy.d.ts.map +1 -0
- package/esm/_/uniqBy.js +49 -0
- package/esm/index.d.ts +11 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +11 -0
- package/esm/util.d.ts +337 -0
- package/package.json +3 -3
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/*!
|
|
3
|
+
* Portions of this file are derived from Lodash.
|
|
4
|
+
* https://github.com/lodash/lodash
|
|
5
|
+
*
|
|
6
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
7
|
+
*
|
|
8
|
+
* Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
9
|
+
* DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
10
|
+
*
|
|
11
|
+
* Modifications Copyright (c) 2026 GoodData Corporation
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
14
|
+
* a copy of this software and associated documentation files (the
|
|
15
|
+
* "Software"), to deal in the Software without restriction, including
|
|
16
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
17
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
18
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
19
|
+
* the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be
|
|
22
|
+
* included in all copies or substantial portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
26
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
27
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
28
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
29
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
30
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
import { _castPath } from "./_castPath.js";
|
|
33
|
+
import { _isIndex } from "./_isIndex.js";
|
|
34
|
+
import { _toKey } from "./_toKey.js";
|
|
35
|
+
import { _isArguments } from "./isArguments.js";
|
|
36
|
+
import { _isLength } from "./isLength.js";
|
|
37
|
+
/**
|
|
38
|
+
* Checks if `path` exists on `object`, testing each segment with `hasFunc`. A missing last segment
|
|
39
|
+
* still counts as present when it is a valid index of a sparse array or an arguments object, since
|
|
40
|
+
* a hole is a slot that exists.
|
|
41
|
+
*
|
|
42
|
+
* @param object - The object to query.
|
|
43
|
+
* @param path - The path to check.
|
|
44
|
+
* @param hasFunc - The function to check a single key on an object.
|
|
45
|
+
* @returns Returns `true` if `path` exists, else `false`.
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
export function _hasPath(object, path, hasFunc) {
|
|
49
|
+
const keys = _castPath(path, object);
|
|
50
|
+
let current = object;
|
|
51
|
+
let index = -1;
|
|
52
|
+
let result = false;
|
|
53
|
+
let key = "";
|
|
54
|
+
while (++index < keys.length) {
|
|
55
|
+
key = _toKey(keys[index]);
|
|
56
|
+
result = current != null && hasFunc(Object(current), key);
|
|
57
|
+
if (!result) {
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
current = current[key];
|
|
61
|
+
}
|
|
62
|
+
if (result || ++index !== keys.length) {
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
const length = current == null ? 0 : current.length;
|
|
66
|
+
return (!!length &&
|
|
67
|
+
_isLength(length) &&
|
|
68
|
+
_isIndex(key, length) &&
|
|
69
|
+
(Array.isArray(current) || _isArguments(current)));
|
|
70
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if `value` is a valid array-like index: a non-negative integer, or a string spelling one without
|
|
3
|
+
* leading zeros, below `length`.
|
|
4
|
+
*
|
|
5
|
+
* @param value - The value to check.
|
|
6
|
+
* @param length - The upper bound of a valid index, `Number.MAX_SAFE_INTEGER` when not given.
|
|
7
|
+
* @returns Returns `true` if `value` is a valid index, else `false`.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare function _isIndex(value: unknown, length?: number | null): boolean;
|
|
11
|
+
//# sourceMappingURL=_isIndex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_isIndex.d.ts","sourceRoot":"","sources":["../../src/_/_isIndex.ts"],"names":[],"mappings":"AAoCA;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAWxE"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/*!
|
|
3
|
+
* Portions of this file are derived from Lodash.
|
|
4
|
+
* https://github.com/lodash/lodash
|
|
5
|
+
*
|
|
6
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
7
|
+
*
|
|
8
|
+
* Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
9
|
+
* DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
10
|
+
*
|
|
11
|
+
* Modifications Copyright (c) 2026 GoodData Corporation
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
14
|
+
* a copy of this software and associated documentation files (the
|
|
15
|
+
* "Software"), to deal in the Software without restriction, including
|
|
16
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
17
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
18
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
19
|
+
* the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be
|
|
22
|
+
* included in all copies or substantial portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
26
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
27
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
28
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
29
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
30
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
/** Used to detect unsigned integer values. */
|
|
33
|
+
const RE_IS_UINT = /^(?:0|[1-9]\d*)$/;
|
|
34
|
+
/**
|
|
35
|
+
* Checks if `value` is a valid array-like index: a non-negative integer, or a string spelling one without
|
|
36
|
+
* leading zeros, below `length`.
|
|
37
|
+
*
|
|
38
|
+
* @param value - The value to check.
|
|
39
|
+
* @param length - The upper bound of a valid index, `Number.MAX_SAFE_INTEGER` when not given.
|
|
40
|
+
* @returns Returns `true` if `value` is a valid index, else `false`.
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
export function _isIndex(value, length) {
|
|
44
|
+
const type = typeof value;
|
|
45
|
+
const max = length ?? Number.MAX_SAFE_INTEGER;
|
|
46
|
+
if (!max || (type !== "number" && (type === "symbol" || !RE_IS_UINT.test(String(value))))) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
const index = Number(value);
|
|
50
|
+
return index > -1 && index % 1 === 0 && index < max;
|
|
51
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the given arguments are from an iteratee call, that is `(value, index, collection)` where
|
|
3
|
+
* `collection[index]` is `value`. Functions with optional numeric arguments use it to behave when
|
|
4
|
+
* passed directly as a callback, for example `[2, 3].map(range)`.
|
|
5
|
+
*
|
|
6
|
+
* @param value - The potential iteratee value argument.
|
|
7
|
+
* @param index - The potential iteratee index or key argument.
|
|
8
|
+
* @param object - The potential iteratee object argument.
|
|
9
|
+
* @returns Returns `true` if the arguments are from an iteratee call, else `false`.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function _isIterateeCall(value: unknown, index: unknown, object: unknown): boolean;
|
|
13
|
+
//# sourceMappingURL=_isIterateeCall.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_isIterateeCall.d.ts","sourceRoot":"","sources":["../../src/_/_isIterateeCall.ts"],"names":[],"mappings":"AAsCA;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAWxF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/*!
|
|
3
|
+
* Portions of this file are derived from Lodash.
|
|
4
|
+
* https://github.com/lodash/lodash
|
|
5
|
+
*
|
|
6
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
7
|
+
*
|
|
8
|
+
* Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
9
|
+
* DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
10
|
+
*
|
|
11
|
+
* Modifications Copyright (c) 2026 GoodData Corporation
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
14
|
+
* a copy of this software and associated documentation files (the
|
|
15
|
+
* "Software"), to deal in the Software without restriction, including
|
|
16
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
17
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
18
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
19
|
+
* the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be
|
|
22
|
+
* included in all copies or substantial portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
26
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
27
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
28
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
29
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
30
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
import { _isIndex } from "./_isIndex.js";
|
|
33
|
+
import { _eq } from "./eq.js";
|
|
34
|
+
import { _isArrayLike } from "./isArrayLike.js";
|
|
35
|
+
import { _isObject } from "./isObject.js";
|
|
36
|
+
/**
|
|
37
|
+
* Checks if the given arguments are from an iteratee call, that is `(value, index, collection)` where
|
|
38
|
+
* `collection[index]` is `value`. Functions with optional numeric arguments use it to behave when
|
|
39
|
+
* passed directly as a callback, for example `[2, 3].map(range)`.
|
|
40
|
+
*
|
|
41
|
+
* @param value - The potential iteratee value argument.
|
|
42
|
+
* @param index - The potential iteratee index or key argument.
|
|
43
|
+
* @param object - The potential iteratee object argument.
|
|
44
|
+
* @returns Returns `true` if the arguments are from an iteratee call, else `false`.
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export function _isIterateeCall(value, index, object) {
|
|
48
|
+
if (!_isObject(object)) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
const isKeyOf = typeof index === "number"
|
|
52
|
+
? _isArrayLike(object) && _isIndex(index, object.length)
|
|
53
|
+
: typeof index === "string" && index in object;
|
|
54
|
+
return isKeyOf && _eq(object[index], value);
|
|
55
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if `value` is a property name and not a property path. Anything that is not a string is a
|
|
3
|
+
* name; a string is a name unless it contains dots or bracket segments, except when `object` already
|
|
4
|
+
* has it as a key.
|
|
5
|
+
*
|
|
6
|
+
* @param value - The value to check.
|
|
7
|
+
* @param object - The object to query keys on.
|
|
8
|
+
* @returns Returns `true` if `value` is a property name, else `false`.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare function _isKey(value: unknown, object?: object): boolean;
|
|
12
|
+
//# sourceMappingURL=_isKey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_isKey.d.ts","sourceRoot":"","sources":["../../src/_/_isKey.ts"],"names":[],"mappings":"AAuCA;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAkB/D"}
|
package/esm/_/_isKey.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/*!
|
|
3
|
+
* Portions of this file are derived from Lodash.
|
|
4
|
+
* https://github.com/lodash/lodash
|
|
5
|
+
*
|
|
6
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
7
|
+
*
|
|
8
|
+
* Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
9
|
+
* DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
10
|
+
*
|
|
11
|
+
* Modifications Copyright (c) 2026 GoodData Corporation
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
14
|
+
* a copy of this software and associated documentation files (the
|
|
15
|
+
* "Software"), to deal in the Software without restriction, including
|
|
16
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
17
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
18
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
19
|
+
* the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be
|
|
22
|
+
* included in all copies or substantial portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
26
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
27
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
28
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
29
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
30
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
import { _isSymbol } from "./isSymbol.js";
|
|
33
|
+
/** Used to match property names within property paths. */
|
|
34
|
+
const RE_IS_DEEP_PROP = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
|
|
35
|
+
const RE_IS_PLAIN_PROP = /^\w*$/;
|
|
36
|
+
/**
|
|
37
|
+
* Checks if `value` is a property name and not a property path. Anything that is not a string is a
|
|
38
|
+
* name; a string is a name unless it contains dots or bracket segments, except when `object` already
|
|
39
|
+
* has it as a key.
|
|
40
|
+
*
|
|
41
|
+
* @param value - The value to check.
|
|
42
|
+
* @param object - The object to query keys on.
|
|
43
|
+
* @returns Returns `true` if `value` is a property name, else `false`.
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
export function _isKey(value, object) {
|
|
47
|
+
if (Array.isArray(value)) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
const type = typeof value;
|
|
51
|
+
if (type === "number" || type === "symbol" || type === "boolean" || value == null || _isSymbol(value)) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
const name = String(value);
|
|
55
|
+
return (RE_IS_PLAIN_PROP.test(name) ||
|
|
56
|
+
!RE_IS_DEEP_PROP.test(name) ||
|
|
57
|
+
(object != null && name in Object(object)));
|
|
58
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Portions of this file are derived from Lodash.
|
|
3
|
+
* https://github.com/lodash/lodash
|
|
4
|
+
*
|
|
5
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
6
|
+
*
|
|
7
|
+
* Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
8
|
+
* DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
9
|
+
*
|
|
10
|
+
* Modifications Copyright (c) 2026 GoodData Corporation
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
13
|
+
* a copy of this software and associated documentation files (the
|
|
14
|
+
* "Software"), to deal in the Software without restriction, including
|
|
15
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
16
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
17
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
18
|
+
* the following conditions:
|
|
19
|
+
*
|
|
20
|
+
* The above copyright notice and this permission notice shall be
|
|
21
|
+
* included in all copies or substantial portions of the Software.
|
|
22
|
+
*
|
|
23
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
24
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
25
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
26
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
27
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
28
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
29
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Checks if `value` is likely a prototype object.
|
|
33
|
+
*
|
|
34
|
+
* @param value - The value to check.
|
|
35
|
+
* @returns Returns `true` if `value` is a prototype, else `false`.
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
export declare function _isPrototype(value: unknown): boolean;
|
|
39
|
+
//# sourceMappingURL=_isPrototype.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_isPrototype.d.ts","sourceRoot":"","sources":["../../src/_/_isPrototype.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAKpD"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/*!
|
|
3
|
+
* Portions of this file are derived from Lodash.
|
|
4
|
+
* https://github.com/lodash/lodash
|
|
5
|
+
*
|
|
6
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
7
|
+
*
|
|
8
|
+
* Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
9
|
+
* DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
10
|
+
*
|
|
11
|
+
* Modifications Copyright (c) 2026 GoodData Corporation
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
14
|
+
* a copy of this software and associated documentation files (the
|
|
15
|
+
* "Software"), to deal in the Software without restriction, including
|
|
16
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
17
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
18
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
19
|
+
* the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be
|
|
22
|
+
* included in all copies or substantial portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
26
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
27
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
28
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
29
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
30
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* Checks if `value` is likely a prototype object.
|
|
34
|
+
*
|
|
35
|
+
* @param value - The value to check.
|
|
36
|
+
* @returns Returns `true` if `value` is a prototype, else `false`.
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export function _isPrototype(value) {
|
|
40
|
+
const Ctor = value?.constructor;
|
|
41
|
+
const proto = (typeof Ctor === "function" && Ctor.prototype) || Object.prototype;
|
|
42
|
+
return value === proto;
|
|
43
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`: any primitive except `NaN`.
|
|
3
|
+
*
|
|
4
|
+
* @param value - The value to check.
|
|
5
|
+
* @returns Returns `true` if `value` is suitable for strict equality comparisons, else `false`.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare function _isStrictComparable(value: unknown): boolean;
|
|
9
|
+
//# sourceMappingURL=_isStrictComparable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_isStrictComparable.d.ts","sourceRoot":"","sources":["../../src/_/_isStrictComparable.ts"],"names":[],"mappings":"AAmCA;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE3D"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/*!
|
|
3
|
+
* Portions of this file are derived from Lodash.
|
|
4
|
+
* https://github.com/lodash/lodash
|
|
5
|
+
*
|
|
6
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
7
|
+
*
|
|
8
|
+
* Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
9
|
+
* DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
10
|
+
*
|
|
11
|
+
* Modifications Copyright (c) 2026 GoodData Corporation
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
14
|
+
* a copy of this software and associated documentation files (the
|
|
15
|
+
* "Software"), to deal in the Software without restriction, including
|
|
16
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
17
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
18
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
19
|
+
* the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be
|
|
22
|
+
* included in all copies or substantial portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
26
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
27
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
28
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
29
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
30
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
import { _isObject } from "./isObject.js";
|
|
33
|
+
/**
|
|
34
|
+
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`: any primitive except `NaN`.
|
|
35
|
+
*
|
|
36
|
+
* @param value - The value to check.
|
|
37
|
+
* @returns Returns `true` if `value` is suitable for strict equality comparisons, else `false`.
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
export function _isStrictComparable(value) {
|
|
41
|
+
return value === value && !_isObject(value);
|
|
42
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Portions of this file are derived from Lodash.
|
|
3
|
+
* https://github.com/lodash/lodash
|
|
4
|
+
*
|
|
5
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
6
|
+
*
|
|
7
|
+
* Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
8
|
+
* DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
9
|
+
*
|
|
10
|
+
* Modifications Copyright (c) 2026 GoodData Corporation
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
13
|
+
* a copy of this software and associated documentation files (the
|
|
14
|
+
* "Software"), to deal in the Software without restriction, including
|
|
15
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
16
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
17
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
18
|
+
* the following conditions:
|
|
19
|
+
*
|
|
20
|
+
* The above copyright notice and this permission notice shall be
|
|
21
|
+
* included in all copies or substantial portions of the Software.
|
|
22
|
+
*
|
|
23
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
24
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
25
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
26
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
27
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
28
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
29
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* A specialized version of `matchesProperty` for source values suitable for strict equality
|
|
33
|
+
* comparisons, i.e. `===`.
|
|
34
|
+
*
|
|
35
|
+
* @param key - The key of the property to get.
|
|
36
|
+
* @param srcValue - The value to match.
|
|
37
|
+
* @returns Returns the new spec function.
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
export declare function _matchesStrictComparable(key: PropertyKey, srcValue: unknown): (object: unknown) => boolean;
|
|
41
|
+
//# sourceMappingURL=_matchesStrictComparable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_matchesStrictComparable.d.ts","sourceRoot":"","sources":["../../src/_/_matchesStrictComparable.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAW1G"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/*!
|
|
3
|
+
* Portions of this file are derived from Lodash.
|
|
4
|
+
* https://github.com/lodash/lodash
|
|
5
|
+
*
|
|
6
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
7
|
+
*
|
|
8
|
+
* Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
9
|
+
* DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
10
|
+
*
|
|
11
|
+
* Modifications Copyright (c) 2026 GoodData Corporation
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
14
|
+
* a copy of this software and associated documentation files (the
|
|
15
|
+
* "Software"), to deal in the Software without restriction, including
|
|
16
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
17
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
18
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
19
|
+
* the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be
|
|
22
|
+
* included in all copies or substantial portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
26
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
27
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
28
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
29
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
30
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* A specialized version of `matchesProperty` for source values suitable for strict equality
|
|
34
|
+
* comparisons, i.e. `===`.
|
|
35
|
+
*
|
|
36
|
+
* @param key - The key of the property to get.
|
|
37
|
+
* @param srcValue - The value to match.
|
|
38
|
+
* @returns Returns the new spec function.
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
export function _matchesStrictComparable(key, srcValue) {
|
|
42
|
+
return (object) => {
|
|
43
|
+
if (object == null) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
const target = Object(object);
|
|
47
|
+
// an `undefined` source value only matches a key that actually exists
|
|
48
|
+
return target[key] === srcValue && (srcValue !== undefined || key in target);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts `string` to a property path array. Results are cached by input string, so callers must not
|
|
3
|
+
* mutate the returned array.
|
|
4
|
+
*
|
|
5
|
+
* @param string - The string to convert.
|
|
6
|
+
* @returns Returns the property path array.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare function _stringToPath(string: string): string[];
|
|
10
|
+
//# sourceMappingURL=_stringToPath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_stringToPath.d.ts","sourceRoot":"","sources":["../../src/_/_stringToPath.ts"],"names":[],"mappings":"AA6CA;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAwBtD"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/*!
|
|
3
|
+
* Portions of this file are derived from Lodash.
|
|
4
|
+
* https://github.com/lodash/lodash
|
|
5
|
+
*
|
|
6
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
7
|
+
*
|
|
8
|
+
* Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
9
|
+
* DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
10
|
+
*
|
|
11
|
+
* Modifications Copyright (c) 2026 GoodData Corporation
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
14
|
+
* a copy of this software and associated documentation files (the
|
|
15
|
+
* "Software"), to deal in the Software without restriction, including
|
|
16
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
17
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
18
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
19
|
+
* the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be
|
|
22
|
+
* included in all copies or substantial portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
26
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
27
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
28
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
29
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
30
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
/** Used to match property names within property paths. */
|
|
33
|
+
const RE_PROP_NAME = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
34
|
+
/** Used to match backslashes in property paths. */
|
|
35
|
+
const RE_ESCAPE_CHAR = /\\(\\)?/g;
|
|
36
|
+
/** Used as the maximum cache size; the cache is emptied when it fills up, as lodash's `memoizeCapped` does. */
|
|
37
|
+
const MAX_CACHE_SIZE = 500;
|
|
38
|
+
const cache = new Map();
|
|
39
|
+
/**
|
|
40
|
+
* Converts `string` to a property path array. Results are cached by input string, so callers must not
|
|
41
|
+
* mutate the returned array.
|
|
42
|
+
*
|
|
43
|
+
* @param string - The string to convert.
|
|
44
|
+
* @returns Returns the property path array.
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export function _stringToPath(string) {
|
|
48
|
+
const cached = cache.get(string);
|
|
49
|
+
if (cached) {
|
|
50
|
+
return cached;
|
|
51
|
+
}
|
|
52
|
+
const result = [];
|
|
53
|
+
if (string.charCodeAt(0) === 46 /* . */) {
|
|
54
|
+
result.push("");
|
|
55
|
+
}
|
|
56
|
+
for (const [match, number, quote, subString] of string.matchAll(RE_PROP_NAME)) {
|
|
57
|
+
result.push(quote ? subString.replace(RE_ESCAPE_CHAR, "$1") : (number ?? match));
|
|
58
|
+
}
|
|
59
|
+
if (cache.size === MAX_CACHE_SIZE) {
|
|
60
|
+
cache.clear();
|
|
61
|
+
}
|
|
62
|
+
cache.set(string, result);
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts `value` to a string key if it's not a string or symbol. The sign of `-0` is preserved.
|
|
3
|
+
*
|
|
4
|
+
* @param value - The value to inspect.
|
|
5
|
+
* @returns Returns the key.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare function _toKey(value: unknown): string | symbol;
|
|
9
|
+
//# sourceMappingURL=_toKey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_toKey.d.ts","sourceRoot":"","sources":["../../src/_/_toKey.ts"],"names":[],"mappings":"AAmCA;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAQtD"}
|