@gooddata/util 11.68.0-alpha.5 → 11.68.0-alpha.6
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/NOTICE +177 -0
- package/esm/_/_arrayAggregator.d.ts +42 -0
- package/esm/_/_arrayAggregator.d.ts.map +1 -0
- package/esm/_/_arrayAggregator.js +51 -0
- package/esm/_/_assignValue.d.ts.map +1 -1
- package/esm/_/_assignValue.js +2 -6
- package/esm/_/_baseAggregator.d.ts +13 -0
- package/esm/_/_baseAggregator.d.ts.map +1 -0
- package/esm/_/_baseAggregator.js +50 -0
- 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/_/_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/_/_createAggregator.d.ts +10 -0
- package/esm/_/_createAggregator.d.ts.map +1 -0
- package/esm/_/_createAggregator.js +50 -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 +11 -0
- package/esm/_/camelCase.d.ts.map +1 -0
- package/esm/_/camelCase.js +56 -0
- package/esm/_/deburr.d.ts +10 -0
- package/esm/_/deburr.d.ts.map +1 -0
- package/esm/_/deburr.js +242 -0
- package/esm/_/isArray.d.ts +61 -0
- package/esm/_/isArray.d.ts.map +1 -0
- package/esm/_/isArray.js +62 -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/_/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/_/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/_/types.d.ts +26 -0
- package/esm/_/types.d.ts.map +1 -1
- package/esm/_/uniq.d.ts +12 -0
- package/esm/_/uniq.d.ts.map +1 -0
- package/esm/_/uniq.js +47 -0
- package/esm/_/words.d.ts +9 -0
- package/esm/_/words.d.ts.map +1 -0
- package/esm/_/words.js +50 -0
- package/esm/index.d.ts +10 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +8 -0
- package/esm/util.d.ts +254 -0
- package/package.json +5 -4
|
@@ -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,23 @@
|
|
|
1
|
+
import type { _List, _ValueIteratee, _ValueIteratorTypeGuard } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates an array of elements split into two groups, the first of which contains elements `predicate`
|
|
4
|
+
* returns truthy for, the second of which contains elements `predicate` returns falsey for. The
|
|
5
|
+
* predicate is invoked with one argument: (value).
|
|
6
|
+
*
|
|
7
|
+
* @param collection - The collection to iterate over.
|
|
8
|
+
* @param predicate - The function invoked per iteration.
|
|
9
|
+
* @returns Returns the array of grouped elements.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function _partition<T, U extends T>(collection: _List<T> | null | undefined, predicate: _ValueIteratorTypeGuard<T, U>): [U[], Array<Exclude<T, U>>];
|
|
13
|
+
/**
|
|
14
|
+
* @see _partition
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare function _partition<T>(collection: _List<T> | null | undefined, predicate: _ValueIteratee<T>): [T[], T[]];
|
|
18
|
+
/**
|
|
19
|
+
* @see _partition
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare function _partition<T extends object>(collection: T | null | undefined, predicate: _ValueIteratee<T[keyof T]>): [Array<T[keyof T]>, Array<T[keyof T]>];
|
|
23
|
+
//# sourceMappingURL=partition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partition.d.ts","sourceRoot":"","sources":["../../src/_/partition.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAEjF;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,EACrC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EACvC,SAAS,EAAE,uBAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,GACzC,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/B;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EACxB,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EACvC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC,GAC7B,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;AACd;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EACvC,UAAU,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAChC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GACtC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -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 { _baseEach } from "./_baseEach.js";
|
|
33
|
+
import { _baseIteratee } from "./_baseIteratee.js";
|
|
34
|
+
export function _partition(collection, predicate) {
|
|
35
|
+
const truthy = [];
|
|
36
|
+
const falsy = [];
|
|
37
|
+
const test = _baseIteratee(predicate);
|
|
38
|
+
_baseEach(collection, (value) => {
|
|
39
|
+
(test(value) ? truthy : falsy).push(value);
|
|
40
|
+
});
|
|
41
|
+
return [truthy, falsy];
|
|
42
|
+
}
|
package/esm/_/pick.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { _PropertyPath } from "./set.js";
|
|
2
|
+
import type { _Many, _PartialObject } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Creates an object composed of the picked `object` properties, own or inherited. Paths may be given
|
|
5
|
+
* individually or in arrays and may be deep; a deep path recreates the containers along it in the result,
|
|
6
|
+
* while the picked value itself is kept by reference.
|
|
7
|
+
*
|
|
8
|
+
* @param object - The source object.
|
|
9
|
+
* @param props - The property paths to pick, given individually or in arrays.
|
|
10
|
+
* @returns Returns the new object.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function _pick<T extends object, U extends keyof T>(object: T, ...props: _Many<U>[]): Pick<T, U>;
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare function _pick<T>(object: T | null | undefined, ...props: _Many<_PropertyPath>[]): _PartialObject<T>;
|
|
18
|
+
//# sourceMappingURL=pick.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pick.d.ts","sourceRoot":"","sources":["../../src/_/pick.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAExD;;;;;;;;;GASG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACxG;;GAEG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,EAAE,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC"}
|
package/esm/_/pick.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
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 { _baseGet } from "./_baseGet.js";
|
|
33
|
+
import { _baseSet } from "./_baseSet.js";
|
|
34
|
+
import { _castPath } from "./_castPath.js";
|
|
35
|
+
import { _hasPath } from "./_hasPath.js";
|
|
36
|
+
export function _pick(object, ...props) {
|
|
37
|
+
const result = {};
|
|
38
|
+
if (object == null) {
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
for (const path of props.flat()) {
|
|
42
|
+
const keys = _castPath(path, object);
|
|
43
|
+
if (_hasPath(object, keys, (target, key) => key in target)) {
|
|
44
|
+
_baseSet(result, keys, _baseGet(object, keys));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { _List, _ListIteratee, _Many, _ObjectIteratee } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates an array of elements, sorted in ascending order by the results of running each element in a
|
|
4
|
+
* collection through each iteratee. This method performs a stable sort, that is, it preserves the original
|
|
5
|
+
* sort order of equal elements. The iteratees are invoked with one argument: (value).
|
|
6
|
+
*
|
|
7
|
+
* @param collection - The collection to iterate over.
|
|
8
|
+
* @param iteratees - The iteratees to sort by, specified individually or in arrays.
|
|
9
|
+
* @returns Returns the new sorted array.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function _sortBy<T>(collection: _List<T> | null | undefined, ...iteratees: _Many<_ListIteratee<T>>[]): T[];
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare function _sortBy<T extends object>(collection: T | null | undefined, ...iteratees: _Many<_ObjectIteratee<T>>[]): T[keyof T][];
|
|
17
|
+
//# sourceMappingURL=sortBy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sortBy.d.ts","sourceRoot":"","sources":["../../src/_/sortBy.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE/E;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,CAAC,EACrB,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EACvC,GAAG,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,GACxC,CAAC,EAAE,CAAC;AACP;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EACpC,UAAU,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAChC,GAAG,SAAS,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,GAC1C,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC"}
|
package/esm/_/sortBy.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
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 { _baseOrderBy } from "./_baseOrderBy.js";
|
|
33
|
+
import { _isIterateeCall } from "./_isIterateeCall.js";
|
|
34
|
+
export function _sortBy(collection, ...iteratees) {
|
|
35
|
+
if (collection == null) {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
// called as an iteratee, e.g. by `map`, the trailing index and collection are not iteratees
|
|
39
|
+
if (iteratees.length > 1 && _isIterateeCall(collection, iteratees[0], iteratees[1])) {
|
|
40
|
+
iteratees = [];
|
|
41
|
+
}
|
|
42
|
+
else if (iteratees.length > 2 && _isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
|
|
43
|
+
iteratees = [iteratees[0]];
|
|
44
|
+
}
|
|
45
|
+
return _baseOrderBy(collection, iteratees.flat());
|
|
46
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
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 _DebouncedFunc, type _DebouncedFuncLeading } from "./debounce.js";
|
|
32
|
+
/**
|
|
33
|
+
* Options of `_throttle`.
|
|
34
|
+
*
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
export type _ThrottleSettings = {
|
|
38
|
+
/** Invoke on the leading edge of the timeout. Defaults to `true`. */
|
|
39
|
+
leading?: boolean | undefined;
|
|
40
|
+
/** Invoke on the trailing edge of the timeout. Defaults to `true`. */
|
|
41
|
+
trailing?: boolean | undefined;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* {@link _ThrottleSettings} that keep `leading` switched on, which guarantees a result on every call.
|
|
45
|
+
*
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
export type _ThrottleSettingsLeading = (_ThrottleSettings & {
|
|
49
|
+
leading: true;
|
|
50
|
+
}) | Omit<_ThrottleSettings, "leading">;
|
|
51
|
+
/**
|
|
52
|
+
* Creates a throttled function that only invokes `func` at most once per every `wait` milliseconds. The
|
|
53
|
+
* throttled function comes with a `cancel` method to cancel delayed `func` invocations and a `flush` method
|
|
54
|
+
* to immediately invoke them. Provide `options` to indicate whether `func` should be invoked on the leading
|
|
55
|
+
* and/or trailing edge of the `wait` timeout. The `func` is invoked with the last arguments provided to the
|
|
56
|
+
* throttled function. Subsequent calls to the throttled function return the result of the last `func`
|
|
57
|
+
* invocation.
|
|
58
|
+
*
|
|
59
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked on the trailing edge of the
|
|
60
|
+
* timeout only if the throttled function is invoked more than once during the `wait` timeout.
|
|
61
|
+
*
|
|
62
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred until the next tick, similar to
|
|
63
|
+
* `setTimeout` with a timeout of `0`.
|
|
64
|
+
*
|
|
65
|
+
* @param func - The function to throttle.
|
|
66
|
+
* @param wait - The number of milliseconds to throttle invocations to. Defaults to `0`.
|
|
67
|
+
* @param options - The options object.
|
|
68
|
+
* @returns Returns the new throttled function.
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
export declare function _throttle<T extends (...args: any) => any>(func: T, wait?: number, options?: _ThrottleSettingsLeading): _DebouncedFuncLeading<T>;
|
|
72
|
+
/**
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
export declare function _throttle<T extends (...args: any) => any>(func: T, wait?: number, options?: _ThrottleSettings): _DebouncedFunc<T>;
|
|
76
|
+
//# sourceMappingURL=throttle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throttle.d.ts","sourceRoot":"","sources":["../../src/_/throttle.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,qBAAqB,EAAa,MAAM,eAAe,CAAC;AAG3F;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC5B,qEAAqE;IACrE,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,sEAAsE;IACtE,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAC9B,CAAC,iBAAiB,GAAG;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,CAAC,GACvC,IAAI,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,wBAAgB,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,EACrD,IAAI,EAAE,CAAC,EACP,IAAI,CAAC,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,wBAAwB,GACnC,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAC5B;;GAEG;AAEH,wBAAgB,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,EACrD,IAAI,EAAE,CAAC,EACP,IAAI,CAAC,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,iBAAiB,GAC5B,cAAc,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -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 { _debounce } from "./debounce.js";
|
|
33
|
+
import { _isObject } from "./isObject.js";
|
|
34
|
+
// oxlint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
|
+
export function _throttle(func, wait, options) {
|
|
36
|
+
if (typeof func !== "function") {
|
|
37
|
+
throw new TypeError("Expected a function");
|
|
38
|
+
}
|
|
39
|
+
const settings = _isObject(options) ? options : {};
|
|
40
|
+
const leading = "leading" in settings ? !!settings.leading : true;
|
|
41
|
+
const trailing = "trailing" in settings ? !!settings.trailing : true;
|
|
42
|
+
// a throttle is a debounce whose maximum wait equals the wait, so the function is invoked at least once per
|
|
43
|
+
// window while calls keep coming
|
|
44
|
+
return _debounce(func, wait, { leading, maxWait: wait, trailing });
|
|
45
|
+
}
|
package/esm/_/types.d.ts
CHANGED
|
@@ -67,4 +67,30 @@ export type _IterateeShorthand<T> = _PropertyName | [_PropertyName, any] | _Part
|
|
|
67
67
|
* @internal
|
|
68
68
|
*/
|
|
69
69
|
export type _ValueIteratee<T> = ((value: T) => _NotVoid) | _IterateeShorthand<T>;
|
|
70
|
+
/**
|
|
71
|
+
* A predicate that narrows the element type, so functions like `_partition` can type their result.
|
|
72
|
+
*
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
export type _ValueIteratorTypeGuard<T, S extends T> = (value: T) => value is S;
|
|
76
|
+
/**
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
export type _ListIterator<T, TResult> = (value: T, index: number, collection: _List<T>) => TResult;
|
|
80
|
+
/**
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
export type _ListIteratee<T> = _ListIterator<T, _NotVoid> | _IterateeShorthand<T>;
|
|
84
|
+
/**
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
export type _ObjectIterator<TObject, TResult> = (value: TObject[keyof TObject], key: string, collection: TObject) => TResult;
|
|
88
|
+
/**
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
export type _ObjectIteratee<TObject> = _ObjectIterator<TObject, _NotVoid> | _IterateeShorthand<TObject[keyof TObject]>;
|
|
92
|
+
/**
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
export type _PartialObject<T> = Partial<T>;
|
|
70
96
|
//# sourceMappingURL=types.d.ts.map
|
package/esm/_/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/_/types.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;GAEG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;AAEpC;;GAEG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC;AAExC;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;IACzB,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAC;AAE/B;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI;KAC5B,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;CACvD,CAAC;AAEF;;GAEG;AAEH,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,aAAa,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;AAE9F;;;;;GAKG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,QAAQ,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/_/types.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;GAEG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;AAEpC;;GAEG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC;AAExC;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;IACzB,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAC;AAE/B;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI;KAC5B,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;CACvD,CAAC;AAEF;;GAEG;AAEH,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,aAAa,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;AAE9F;;;;;GAKG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,QAAQ,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;AAEjF;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC;AAE/E;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,EAAE,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC;AAEnG;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;AAElF;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,OAAO,EAAE,OAAO,IAAI,CAC5C,KAAK,EAAE,OAAO,CAAC,MAAM,OAAO,CAAC,EAC7B,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,OAAO,KAClB,OAAO,CAAC;AAEb;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,OAAO,IAC7B,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,GAClC,kBAAkB,CAAC,OAAO,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC;AAEjD;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC"}
|
package/esm/_/uniq.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { _List } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a duplicate-free version of an array, using SameValueZero for equality comparisons, in which
|
|
4
|
+
* only the first occurrence of each element is kept. The order of result values is determined by the
|
|
5
|
+
* order they occur in the array.
|
|
6
|
+
*
|
|
7
|
+
* @param array - The array to inspect.
|
|
8
|
+
* @returns Returns the new duplicate free array.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare function _uniq<T>(array: _List<T> | null | undefined): T[];
|
|
12
|
+
//# sourceMappingURL=uniq.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uniq.d.ts","sourceRoot":"","sources":["../../src/_/uniq.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,CAAC,EAAE,CAMhE"}
|