@gooddata/util 11.68.0-alpha.5 → 11.68.0-alpha.7
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/LICENSE +1 -1
- package/NOTICE +177 -0
- package/esm/_/_assignValue.d.ts.map +1 -1
- package/esm/_/_assignValue.js +2 -6
- package/esm/_/_baseAssignValue.d.ts +41 -0
- package/esm/_/_baseAssignValue.d.ts.map +1 -0
- package/esm/_/_baseAssignValue.js +48 -0
- package/esm/_/_baseClone.d.ts.map +1 -1
- package/esm/_/_baseClone.js +3 -30
- package/esm/_/_baseMerge.d.ts +15 -0
- package/esm/_/_baseMerge.d.ts.map +1 -0
- package/esm/_/_baseMerge.js +137 -0
- package/esm/_/_baseOrderBy.d.ts +11 -0
- package/esm/_/_baseOrderBy.d.ts.map +1 -0
- package/esm/_/_baseOrderBy.js +70 -0
- package/esm/_/_basePickBy.d.ts +14 -0
- package/esm/_/_basePickBy.d.ts.map +1 -0
- package/esm/_/_basePickBy.js +57 -0
- package/esm/_/_cloneArrayBuffer.d.ts +39 -0
- package/esm/_/_cloneArrayBuffer.d.ts.map +1 -0
- package/esm/_/_cloneArrayBuffer.js +45 -0
- package/esm/_/_cloneTypedArray.d.ts +10 -0
- package/esm/_/_cloneTypedArray.d.ts.map +1 -0
- package/esm/_/_cloneTypedArray.js +49 -0
- package/esm/_/_compareAscending.d.ts +12 -0
- package/esm/_/_compareAscending.d.ts.map +1 -0
- package/esm/_/_compareAscending.js +78 -0
- package/esm/_/_createCompounder.d.ts +11 -0
- package/esm/_/_createCompounder.d.ts.map +1 -0
- package/esm/_/_createCompounder.js +47 -0
- package/esm/_/_initCloneObject.d.ts +10 -0
- package/esm/_/_initCloneObject.d.ts.map +1 -0
- package/esm/_/_initCloneObject.js +48 -0
- package/esm/_/_unicode.d.ts +27 -0
- package/esm/_/_unicode.d.ts.map +1 -0
- package/esm/_/_unicode.js +120 -0
- package/esm/_/camelCase.d.ts +10 -0
- package/esm/_/camelCase.d.ts.map +1 -0
- package/esm/_/camelCase.js +45 -0
- package/esm/_/capitalize.d.ts +9 -0
- package/esm/_/capitalize.d.ts.map +1 -0
- package/esm/_/capitalize.js +43 -0
- package/esm/_/deburr.d.ts +10 -0
- package/esm/_/deburr.d.ts.map +1 -0
- package/esm/_/deburr.js +243 -0
- package/esm/_/difference.d.ts +14 -0
- package/esm/_/difference.d.ts.map +1 -0
- package/esm/_/difference.js +67 -0
- package/esm/_/escape.d.ts +13 -0
- package/esm/_/escape.d.ts.map +1 -0
- package/esm/_/escape.js +56 -0
- package/esm/_/has.d.ts +23 -0
- package/esm/_/has.d.ts.map +1 -0
- package/esm/_/has.js +35 -0
- package/esm/_/isArray.d.ts +61 -0
- package/esm/_/isArray.d.ts.map +1 -0
- package/esm/_/isArray.js +62 -0
- package/esm/_/isPlainObject.d.ts +1 -1
- package/esm/_/isPlainObject.d.ts.map +1 -1
- package/esm/_/kebabCase.d.ts +9 -0
- package/esm/_/kebabCase.d.ts.map +1 -0
- package/esm/_/kebabCase.js +40 -0
- package/esm/_/keyBy.d.ts +17 -0
- package/esm/_/keyBy.d.ts.map +1 -0
- package/esm/_/keyBy.js +43 -0
- package/esm/_/keysIn.d.ts +10 -0
- package/esm/_/keysIn.d.ts.map +1 -0
- package/esm/_/keysIn.js +54 -0
- package/esm/_/memoize.d.ts +89 -0
- package/esm/_/memoize.d.ts.map +1 -0
- package/esm/_/memoize.js +36 -0
- package/esm/_/merge.d.ts +32 -0
- package/esm/_/merge.d.ts.map +1 -0
- package/esm/_/merge.js +45 -0
- package/esm/_/omit.d.ts +1 -5
- package/esm/_/omit.d.ts.map +1 -1
- package/esm/_/omitBy.d.ts +21 -0
- package/esm/_/omitBy.d.ts.map +1 -0
- package/esm/_/omitBy.js +37 -0
- package/esm/_/partial.d.ts +87 -0
- package/esm/_/partial.d.ts.map +1 -0
- package/esm/_/partial.js +30 -0
- package/esm/_/partition.d.ts +23 -0
- package/esm/_/partition.d.ts.map +1 -0
- package/esm/_/partition.js +42 -0
- package/esm/_/pick.d.ts +18 -0
- package/esm/_/pick.d.ts.map +1 -0
- package/esm/_/pick.js +48 -0
- package/esm/_/pickBy.d.ts +21 -0
- package/esm/_/pickBy.d.ts.map +1 -0
- package/esm/_/pickBy.js +36 -0
- package/esm/_/sortBy.d.ts +17 -0
- package/esm/_/sortBy.d.ts.map +1 -0
- package/esm/_/sortBy.js +46 -0
- package/esm/_/throttle.d.ts +76 -0
- package/esm/_/throttle.d.ts.map +1 -0
- package/esm/_/throttle.js +45 -0
- package/esm/_/toString.d.ts +11 -0
- package/esm/_/toString.d.ts.map +1 -0
- package/esm/_/toString.js +57 -0
- package/esm/_/types.d.ts +64 -0
- package/esm/_/types.d.ts.map +1 -1
- package/esm/_/union.d.ts +11 -0
- package/esm/_/union.d.ts.map +1 -0
- package/esm/_/union.js +55 -0
- package/esm/_/uniq.d.ts +12 -0
- package/esm/_/uniq.d.ts.map +1 -0
- package/esm/_/uniq.js +47 -0
- package/esm/_/uniqWith.d.ts +14 -0
- package/esm/_/uniqWith.d.ts.map +1 -0
- package/esm/_/uniqWith.js +59 -0
- package/esm/_/upperFirst.d.ts +10 -0
- package/esm/_/upperFirst.d.ts.map +1 -0
- package/esm/_/upperFirst.js +46 -0
- package/esm/_/words.d.ts +9 -0
- package/esm/_/words.d.ts.map +1 -0
- package/esm/_/words.js +50 -0
- package/esm/_/zip.d.ts +28 -0
- package/esm/_/zip.d.ts.map +1 -0
- package/esm/_/zip.js +38 -0
- package/esm/index.d.ts +23 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +21 -0
- package/esm/util.d.ts +549 -0
- package/package.json +5 -4
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts `string` to kebab case: the words of the string, lower-cased and joined with hyphens.
|
|
3
|
+
*
|
|
4
|
+
* @param string - The string to convert.
|
|
5
|
+
* @returns Returns the kebab cased string.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare const _kebabCase: (string?: string) => string;
|
|
9
|
+
//# sourceMappingURL=kebabCase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kebabCase.d.ts","sourceRoot":"","sources":["../../src/_/kebabCase.ts"],"names":[],"mappings":"AAmCA;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,MAE7C,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 { _createCompounder } from "./_createCompounder.js";
|
|
33
|
+
/**
|
|
34
|
+
* Converts `string` to kebab case: the words of the string, lower-cased and joined with hyphens.
|
|
35
|
+
*
|
|
36
|
+
* @param string - The string to convert.
|
|
37
|
+
* @returns Returns the kebab cased string.
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
export const _kebabCase = _createCompounder((result, word, index) => result + (index ? "-" : "") + word.toLowerCase());
|
package/esm/_/keyBy.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { _Dictionary, _List, _PropertyName, _ValueIterateeCustom } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates an object composed of keys generated from the results of running each element of `collection`
|
|
4
|
+
* thru `iteratee`. The corresponding value of each key is the last element responsible for generating the
|
|
5
|
+
* key. The iteratee is invoked with one argument: (value).
|
|
6
|
+
*
|
|
7
|
+
* @param collection - The collection to iterate over.
|
|
8
|
+
* @param iteratee - The iteratee to transform keys.
|
|
9
|
+
* @returns Returns the composed aggregate object.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function _keyBy<T>(collection: _List<T> | null | undefined, iteratee?: _ValueIterateeCustom<T, _PropertyName>): _Dictionary<T>;
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare function _keyBy<T extends object>(collection: T | null | undefined, iteratee?: _ValueIterateeCustom<T[keyof T], _PropertyName>): _Dictionary<T[keyof T]>;
|
|
17
|
+
//# sourceMappingURL=keyBy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyBy.d.ts","sourceRoot":"","sources":["../../src/_/keyBy.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE1F;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,CAAC,EACpB,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EACvC,QAAQ,CAAC,EAAE,oBAAoB,CAAC,CAAC,EAAE,aAAa,CAAC,GAClD,WAAW,CAAC,CAAC,CAAC,CAAC;AAClB;;GAEG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,EACnC,UAAU,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAChC,QAAQ,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,aAAa,CAAC,GAC3D,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC"}
|
package/esm/_/keyBy.js
ADDED
|
@@ -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
|
+
import { _baseAssignValue } from "./_baseAssignValue.js";
|
|
33
|
+
import { _baseEach } from "./_baseEach.js";
|
|
34
|
+
import { _baseIteratee } from "./_baseIteratee.js";
|
|
35
|
+
export function _keyBy(collection, iteratee) {
|
|
36
|
+
const result = {};
|
|
37
|
+
const toKey = _baseIteratee(iteratee);
|
|
38
|
+
_baseEach(collection, (value) => {
|
|
39
|
+
// defines a `__proto__` key as an own property instead of changing the prototype
|
|
40
|
+
_baseAssignValue(result, toKey(value), value);
|
|
41
|
+
});
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an array of the own and inherited enumerable string keys of `object`. Arrays, arguments objects
|
|
3
|
+
* and typed arrays list every index first, holes included, followed by their other keys.
|
|
4
|
+
*
|
|
5
|
+
* @param object - The object to query.
|
|
6
|
+
* @returns Returns the array of property names.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare function _keysIn(object: unknown): string[];
|
|
10
|
+
//# sourceMappingURL=keysIn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keysIn.d.ts","sourceRoot":"","sources":["../../src/_/keysIn.ts"],"names":[],"mappings":"AAqCA;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,CAajD"}
|
package/esm/_/keysIn.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
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 { _isArguments } from "./isArguments.js";
|
|
34
|
+
import { _isTypedArray } from "./isTypedArray.js";
|
|
35
|
+
/**
|
|
36
|
+
* Creates an array of the own and inherited enumerable string keys of `object`. Arrays, arguments objects
|
|
37
|
+
* and typed arrays list every index first, holes included, followed by their other keys.
|
|
38
|
+
*
|
|
39
|
+
* @param object - The object to query.
|
|
40
|
+
* @returns Returns the array of property names.
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
export function _keysIn(object) {
|
|
44
|
+
const value = Object(object);
|
|
45
|
+
const indexed = Array.isArray(value) || _isArguments(value) || _isTypedArray(value);
|
|
46
|
+
const length = indexed ? value.length : 0;
|
|
47
|
+
const result = Array.from({ length }, (_, index) => String(index));
|
|
48
|
+
for (const key in value) {
|
|
49
|
+
if (!(indexed && (key === "length" || _isIndex(key, length)))) {
|
|
50
|
+
result.push(key);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
* The cache a memoized function keeps its results in. Keys are compared by SameValueZero, as a `Map`
|
|
33
|
+
* does, so `NaN` equals `NaN` and objects compare by reference.
|
|
34
|
+
*
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
export type _MapCache = {
|
|
38
|
+
/** Removes `key` and its value from the cache; returns whether the entry was removed. */
|
|
39
|
+
delete(key: unknown): boolean;
|
|
40
|
+
/** Gets the cached value for `key`. */
|
|
41
|
+
get(key: unknown): unknown;
|
|
42
|
+
/** Checks if a cached value for `key` exists. */
|
|
43
|
+
has(key: unknown): boolean;
|
|
44
|
+
/** Sets `value` to `key` of the cache; a cache that returns itself here lets `set` be chained. */
|
|
45
|
+
set(key: unknown, value: unknown): unknown;
|
|
46
|
+
/** Removes all entries from the cache. */
|
|
47
|
+
clear?: (() => void) | undefined;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
export type _MapCacheConstructor = new () => _MapCache;
|
|
53
|
+
/**
|
|
54
|
+
* What `_memoize` adds to the function it returns.
|
|
55
|
+
*
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
export type _MemoizedFunction = {
|
|
59
|
+
/** The cache of results, exposed so callers can inspect or edit it. */
|
|
60
|
+
cache: _MapCache;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* The shape of `_memoize`: the memoizing function itself plus the `Cache` constructor every memoized
|
|
64
|
+
* function starts with.
|
|
65
|
+
*
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
export type _Memoize = {
|
|
69
|
+
<T extends (...args: any) => any>(func: T, resolver?: (this: ThisParameterType<T>, ...args: Parameters<T>) => unknown): T & _MemoizedFunction;
|
|
70
|
+
/** The constructor of the cache every memoized function starts with; a native `Map` unless replaced. */
|
|
71
|
+
Cache: _MapCacheConstructor;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Creates a function that memoizes the result of `func`. If `resolver` is provided, it determines the
|
|
75
|
+
* cache key for storing the result based on the arguments provided to the memoized function. By
|
|
76
|
+
* default, the first argument provided to the memoized function is used as the map cache key. The
|
|
77
|
+
* `func` is invoked with the `this` binding of the memoized function.
|
|
78
|
+
*
|
|
79
|
+
* **Note:** The cache is exposed as the `cache` property on the memoized function. Its creation may be
|
|
80
|
+
* customized by replacing the `_memoize.Cache` constructor with one whose instances implement the
|
|
81
|
+
* `Map` method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
82
|
+
*
|
|
83
|
+
* @param func - The function to have its output memoized.
|
|
84
|
+
* @param resolver - The function to resolve the cache key.
|
|
85
|
+
* @returns Returns the new memoized function.
|
|
86
|
+
* @internal
|
|
87
|
+
*/
|
|
88
|
+
export declare const _memoize: _Memoize;
|
|
89
|
+
//# sourceMappingURL=memoize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memoize.d.ts","sourceRoot":"","sources":["../../src/_/memoize.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG;IACpB,yFAAyF;IACzF,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC;IAC9B,uCAAuC;IACvC,GAAG,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC;IAC3B,iDAAiD;IACjD,GAAG,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC;IAC3B,kGAAkG;IAClG,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC;IAC3C,0CAA0C;IAC1C,KAAK,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;CACpC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,UAAU,SAAS,CAAC;AAEvD;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC5B,uEAAuE;IACvE,KAAK,EAAE,SAAS,CAAC;CACpB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG;IAEnB,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,EAC5B,IAAI,EAAE,CAAC,EACP,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,OAAO,GAC3E,CAAC,GAAG,iBAAiB,CAAC;IACzB,wGAAwG;IACxG,KAAK,EAAE,oBAAoB,CAAC;CAC/B,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,QAAQ,EAAE,QA+BtB,CAAC"}
|
package/esm/_/memoize.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/**
|
|
3
|
+
* Creates a function that memoizes the result of `func`. If `resolver` is provided, it determines the
|
|
4
|
+
* cache key for storing the result based on the arguments provided to the memoized function. By
|
|
5
|
+
* default, the first argument provided to the memoized function is used as the map cache key. The
|
|
6
|
+
* `func` is invoked with the `this` binding of the memoized function.
|
|
7
|
+
*
|
|
8
|
+
* **Note:** The cache is exposed as the `cache` property on the memoized function. Its creation may be
|
|
9
|
+
* customized by replacing the `_memoize.Cache` constructor with one whose instances implement the
|
|
10
|
+
* `Map` method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
11
|
+
*
|
|
12
|
+
* @param func - The function to have its output memoized.
|
|
13
|
+
* @param resolver - The function to resolve the cache key.
|
|
14
|
+
* @returns Returns the new memoized function.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export const _memoize = Object.assign(
|
|
18
|
+
// oxlint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
+
function memoize(func, resolver) {
|
|
20
|
+
if (typeof func !== "function" || (resolver != null && typeof resolver !== "function")) {
|
|
21
|
+
throw new TypeError("Expected a function");
|
|
22
|
+
}
|
|
23
|
+
const memoized = function (...args) {
|
|
24
|
+
const key = resolver ? resolver.apply(this, args) : args[0];
|
|
25
|
+
const cache = memoized.cache;
|
|
26
|
+
if (cache.has(key)) {
|
|
27
|
+
return cache.get(key);
|
|
28
|
+
}
|
|
29
|
+
const result = func.apply(this, args);
|
|
30
|
+
// a cache whose `set` does not return itself keeps the existing instance
|
|
31
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
memoized.cache = new _memoize.Cache();
|
|
35
|
+
return memoized;
|
|
36
|
+
}, { Cache: Map });
|
package/esm/_/merge.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursively merges own and inherited enumerable string keyed properties of source objects into the
|
|
3
|
+
* destination object. Source properties that resolve to `undefined` are skipped if a destination value
|
|
4
|
+
* exists. Array and plain object properties are merged recursively. Other objects and value types are
|
|
5
|
+
* overridden by assignment. Source objects are applied from left to right. Subsequent sources overwrite
|
|
6
|
+
* property assignments of previous sources.
|
|
7
|
+
*
|
|
8
|
+
* **Note:** This method mutates `object`.
|
|
9
|
+
*
|
|
10
|
+
* @param object - The destination object.
|
|
11
|
+
* @param sources - The source objects.
|
|
12
|
+
* @returns Returns `object`.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare function _merge<TObject, TSource>(object: TObject, source: TSource): TObject & TSource;
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare function _merge<TObject, TSource1, TSource2>(object: TObject, source1: TSource1, source2: TSource2): TObject & TSource1 & TSource2;
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export declare function _merge<TObject, TSource1, TSource2, TSource3>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3): TObject & TSource1 & TSource2 & TSource3;
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export declare function _merge<TObject, TSource1, TSource2, TSource3, TSource4>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4): TObject & TSource1 & TSource2 & TSource3 & TSource4;
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export declare function _merge(object: any, ...otherArgs: any[]): any;
|
|
32
|
+
//# sourceMappingURL=merge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/_/merge.ts"],"names":[],"mappings":"AAsCA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAC9F;;GAEG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAC9C,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,QAAQ,GAClB,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AACjC;;GAEG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EACxD,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,QAAQ,GAClB,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAC5C;;GAEG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAClE,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,QAAQ,GAClB,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AACvD;;GAEG;AAEH,wBAAgB,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,SAAS,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC"}
|
package/esm/_/merge.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
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 { _baseMerge } from "./_baseMerge.js";
|
|
33
|
+
import { _isIterateeCall } from "./_isIterateeCall.js";
|
|
34
|
+
export function _merge(object, ...sources) {
|
|
35
|
+
const target = Object(object);
|
|
36
|
+
// when called as an iteratee, e.g. by `reduce`, only the value is a source, not the index and collection
|
|
37
|
+
const length = sources.length > 2 && _isIterateeCall(sources[0], sources[1], sources[2]) ? 1 : sources.length;
|
|
38
|
+
for (let index = 0; index < length; index++) {
|
|
39
|
+
const source = sources[index];
|
|
40
|
+
if (source) {
|
|
41
|
+
_baseMerge(target, Object(source), new Map());
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return target;
|
|
45
|
+
}
|
package/esm/_/omit.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import type { _Many, _PropertyName } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
export type _PartialObject<T> = Partial<T>;
|
|
1
|
+
import type { _Many, _PartialObject, _PropertyName } from "./types.js";
|
|
6
2
|
/**
|
|
7
3
|
* The opposite of `pick`; this method creates an object composed of the own and inherited enumerable
|
|
8
4
|
* property paths of `object` that are not omitted.
|
package/esm/_/omit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omit.d.ts","sourceRoot":"","sources":["../../src/_/omit.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"omit.d.ts","sourceRoot":"","sources":["../../src/_/omit.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAIvE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,aAAa,EAAE,EAC7D,MAAM,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAC5B,GAAG,KAAK,EAAE,CAAC,GACZ,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACxC;;;GAGG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EACrD,MAAM,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAC5B,GAAG,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAC1B,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACd;;;GAGG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,EAClC,MAAM,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAC5B,GAAG,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,GACtC,cAAc,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { _Dictionary, _NumericDictionary, _PartialObject, _ValueKeyIteratee } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The opposite of `pickBy`; this method creates an object composed of the own and inherited enumerable
|
|
4
|
+
* string and symbol keyed properties of `object` that `predicate` doesn't return truthy for. The predicate
|
|
5
|
+
* is invoked with two arguments: (value, key). Picked values are kept by reference.
|
|
6
|
+
*
|
|
7
|
+
* @param object - The source object.
|
|
8
|
+
* @param predicate - The function invoked per property, or an iteratee shorthand. Defaults to identity.
|
|
9
|
+
* @returns Returns the new object.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function _omitBy<T>(object: _Dictionary<T> | null | undefined, predicate?: _ValueKeyIteratee<T>): _Dictionary<T>;
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare function _omitBy<T>(object: _NumericDictionary<T> | null | undefined, predicate?: _ValueKeyIteratee<T>): _NumericDictionary<T>;
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare function _omitBy<T extends object>(object: T | null | undefined, predicate: _ValueKeyIteratee<T[keyof T]>): _PartialObject<T>;
|
|
21
|
+
//# sourceMappingURL=omitBy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"omitBy.d.ts","sourceRoot":"","sources":["../../src/_/omitBy.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAErG;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,CAAC,EACrB,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EACzC,SAAS,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,GACjC,WAAW,CAAC,CAAC,CAAC,CAAC;AAClB;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,EACrB,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EAChD,SAAS,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,GACjC,kBAAkB,CAAC,CAAC,CAAC,CAAC;AACzB;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EACpC,MAAM,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAC5B,SAAS,EAAE,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GACzC,cAAc,CAAC,CAAC,CAAC,CAAC"}
|
package/esm/_/omitBy.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
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 { _baseIteratee } from "./_baseIteratee.js";
|
|
33
|
+
import { _basePickBy } from "./_basePickBy.js";
|
|
34
|
+
export function _omitBy(object, predicate) {
|
|
35
|
+
const matches = _baseIteratee(predicate);
|
|
36
|
+
return _basePickBy(object, (value, key) => !matches(value, key));
|
|
37
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
import type { _Function1, _Function2, _Function3, _Function4 } from "./types.js";
|
|
32
|
+
declare const placeholderBrand: unique symbol;
|
|
33
|
+
/**
|
|
34
|
+
* The type of `_partial.placeholder`, which stands in for lodash's `_` placeholder.
|
|
35
|
+
*
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
export type _Placeholder = {
|
|
39
|
+
readonly [placeholderBrand]: true;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* The call signatures of `_partial`: each applied parameter is dropped from the resulting function, a
|
|
43
|
+
* placeholder keeps its parameter in place.
|
|
44
|
+
*
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export type _Partial = {
|
|
48
|
+
<T1, T2, R>(func: _Function2<T1, T2, R>, plc1: _Placeholder, arg2: T2): _Function1<T1, R>;
|
|
49
|
+
<T1, T2, T3, R>(func: _Function3<T1, T2, T3, R>, plc1: _Placeholder, arg2: T2): _Function2<T1, T3, R>;
|
|
50
|
+
<T1, T2, T3, R>(func: _Function3<T1, T2, T3, R>, plc1: _Placeholder, plc2: _Placeholder, arg3: T3): _Function2<T1, T2, R>;
|
|
51
|
+
<T1, T2, T3, R>(func: _Function3<T1, T2, T3, R>, arg1: T1, plc2: _Placeholder, arg3: T3): _Function1<T2, R>;
|
|
52
|
+
<T1, T2, T3, R>(func: _Function3<T1, T2, T3, R>, plc1: _Placeholder, arg2: T2, arg3: T3): _Function1<T1, R>;
|
|
53
|
+
<T1, T2, T3, T4, R>(func: _Function4<T1, T2, T3, T4, R>, plc1: _Placeholder, arg2: T2): _Function3<T1, T3, T4, R>;
|
|
54
|
+
<T1, T2, T3, T4, R>(func: _Function4<T1, T2, T3, T4, R>, plc1: _Placeholder, plc2: _Placeholder, arg3: T3): _Function3<T1, T2, T4, R>;
|
|
55
|
+
<T1, T2, T3, T4, R>(func: _Function4<T1, T2, T3, T4, R>, arg1: T1, plc2: _Placeholder, arg3: T3): _Function2<T2, T4, R>;
|
|
56
|
+
<T1, T2, T3, T4, R>(func: _Function4<T1, T2, T3, T4, R>, plc1: _Placeholder, arg2: T2, arg3: T3): _Function2<T1, T4, R>;
|
|
57
|
+
<T1, T2, T3, T4, R>(func: _Function4<T1, T2, T3, T4, R>, plc1: _Placeholder, plc2: _Placeholder, plc3: _Placeholder, arg4: T4): _Function3<T1, T2, T3, R>;
|
|
58
|
+
<T1, T2, T3, T4, R>(func: _Function4<T1, T2, T3, T4, R>, arg1: T1, plc2: _Placeholder, plc3: _Placeholder, arg4: T4): _Function2<T2, T3, R>;
|
|
59
|
+
<T1, T2, T3, T4, R>(func: _Function4<T1, T2, T3, T4, R>, plc1: _Placeholder, arg2: T2, plc3: _Placeholder, arg4: T4): _Function2<T1, T3, R>;
|
|
60
|
+
<T1, T2, T3, T4, R>(func: _Function4<T1, T2, T3, T4, R>, arg1: T1, arg2: T2, plc3: _Placeholder, arg4: T4): _Function1<T3, R>;
|
|
61
|
+
<T1, T2, T3, T4, R>(func: _Function4<T1, T2, T3, T4, R>, plc1: _Placeholder, plc2: _Placeholder, arg3: T3, arg4: T4): _Function2<T1, T2, R>;
|
|
62
|
+
<T1, T2, T3, T4, R>(func: _Function4<T1, T2, T3, T4, R>, arg1: T1, plc2: _Placeholder, arg3: T3, arg4: T4): _Function1<T2, R>;
|
|
63
|
+
<T1, T2, T3, T4, R>(func: _Function4<T1, T2, T3, T4, R>, plc1: _Placeholder, arg2: T2, arg3: T3, arg4: T4): _Function1<T1, R>;
|
|
64
|
+
<TS extends any[], R>(func: (...ts: TS) => R): (...ts: TS) => R;
|
|
65
|
+
<TS extends any[], T1, R>(func: (t1: T1, ...ts: TS) => R, arg1: T1): (...ts: TS) => R;
|
|
66
|
+
<TS extends any[], T1, T2, R>(func: (t1: T1, t2: T2, ...ts: TS) => R, t1: T1, t2: T2): (...ts: TS) => R;
|
|
67
|
+
<TS extends any[], T1, T2, T3, R>(func: (t1: T1, t2: T2, t3: T3, ...ts: TS) => R, t1: T1, t2: T2, t3: T3): (...ts: TS) => R;
|
|
68
|
+
<TS extends any[], T1, T2, T3, T4, R>(func: (t1: T1, t2: T2, t3: T3, t4: T4, ...ts: TS) => R, t1: T1, t2: T2, t3: T3, t4: T4): (...ts: TS) => R;
|
|
69
|
+
/** Marks a parameter of the function that is left open; `_partial.placeholder` is its only value. */
|
|
70
|
+
placeholder: _Placeholder;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Creates a function that invokes `func` with `partials` prepended to the arguments it receives. This method
|
|
74
|
+
* is like `bind` except it does **not** alter the `this` binding. The `_partial.placeholder` value may be
|
|
75
|
+
* used as a placeholder for partially applied arguments: each placeholder takes the next argument of the
|
|
76
|
+
* call, the remaining call arguments are appended. Calling the result with `new` constructs `func`.
|
|
77
|
+
*
|
|
78
|
+
* **Note:** This method doesn't set the "length" property of partially applied functions.
|
|
79
|
+
*
|
|
80
|
+
* @param func - The function to partially apply arguments to.
|
|
81
|
+
* @param partials - The arguments to be partially applied.
|
|
82
|
+
* @returns Returns the new partially applied function.
|
|
83
|
+
* @internal
|
|
84
|
+
*/
|
|
85
|
+
export declare const _partial: _Partial;
|
|
86
|
+
export {};
|
|
87
|
+
//# sourceMappingURL=partial.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partial.d.ts","sourceRoot":"","sources":["../../src/_/partial.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEjF,OAAO,CAAC,MAAM,gBAAgB,EAAE,OAAO,MAAM,CAAC;AAE9C;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG;IAAE,QAAQ,CAAC,CAAC,gBAAgB,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG;IACnB,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,C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,GAAG,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IAExG,CAAC,EAAE,SAAS,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAC5B,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,CAAC,EAC9C,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,GACP,CAAC,GAAG,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IAEpB,CAAC,EAAE,SAAS,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAChC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,CAAC,EACtD,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,GACP,CAAC,GAAG,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IACpB,qGAAqG;IACrG,WAAW,EAAE,YAAY,CAAC;CAC7B,CAAC;AAIF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,QAAQ,EAAE,QAuBtB,CAAC"}
|
package/esm/_/partial.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/**
|
|
3
|
+
* Creates a function that invokes `func` with `partials` prepended to the arguments it receives. This method
|
|
4
|
+
* is like `bind` except it does **not** alter the `this` binding. The `_partial.placeholder` value may be
|
|
5
|
+
* used as a placeholder for partially applied arguments: each placeholder takes the next argument of the
|
|
6
|
+
* call, the remaining call arguments are appended. Calling the result with `new` constructs `func`.
|
|
7
|
+
*
|
|
8
|
+
* **Note:** This method doesn't set the "length" property of partially applied functions.
|
|
9
|
+
*
|
|
10
|
+
* @param func - The function to partially apply arguments to.
|
|
11
|
+
* @param partials - The arguments to be partially applied.
|
|
12
|
+
* @returns Returns the new partially applied function.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export const _partial = Object.assign(function partial(func, ...partials) {
|
|
16
|
+
if (typeof func !== "function") {
|
|
17
|
+
throw new TypeError("Expected a function");
|
|
18
|
+
}
|
|
19
|
+
// placeholders are resolved when the function is created, as lodash does
|
|
20
|
+
const holders = partials.map((value) => value === _partial.placeholder);
|
|
21
|
+
return function wrapper(...args) {
|
|
22
|
+
let index = 0;
|
|
23
|
+
const composed = partials.map((value, position) => (holders[position] ? args[index++] : value));
|
|
24
|
+
composed.push(...args.slice(index));
|
|
25
|
+
if (new.target) {
|
|
26
|
+
return Reflect.construct(func, composed);
|
|
27
|
+
}
|
|
28
|
+
return func.apply(this, composed);
|
|
29
|
+
};
|
|
30
|
+
}, { placeholder: {} });
|