@gooddata/util 11.68.0-alpha.8 → 11.68.0
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 +3 -3
- package/esm/_/_baseClone.d.ts +17 -4
- package/esm/_/_baseClone.d.ts.map +1 -1
- package/esm/_/_baseClone.js +55 -23
- package/esm/_/_baseDifference.d.ts +7 -4
- package/esm/_/_baseDifference.d.ts.map +1 -1
- package/esm/_/_baseDifference.js +18 -7
- package/esm/_/_baseExtremum.d.ts +15 -0
- package/esm/_/_baseExtremum.d.ts.map +1 -0
- package/esm/_/_baseExtremum.js +64 -0
- package/esm/_/_baseIntersection.d.ts +19 -0
- package/esm/_/_baseIntersection.d.ts.map +1 -0
- package/esm/_/_baseIntersection.js +91 -0
- package/esm/_/_baseMerge.d.ts +7 -3
- package/esm/_/_baseMerge.d.ts.map +1 -1
- package/esm/_/_baseMerge.js +20 -11
- package/esm/_/_baseSet.d.ts +3 -1
- package/esm/_/_baseSet.d.ts.map +1 -1
- package/esm/_/_baseSet.js +9 -3
- package/esm/_/_baseSlice.d.ts +45 -0
- package/esm/_/_baseSlice.d.ts.map +1 -0
- package/esm/_/_baseSlice.js +30 -0
- package/esm/_/_baseSum.d.ts +42 -0
- package/esm/_/_baseSum.d.ts.map +1 -0
- package/esm/_/_baseSum.js +21 -0
- package/esm/_/_cloneTypedArray.d.ts +1 -1
- package/esm/_/_cloneTypedArray.d.ts.map +1 -1
- package/esm/_/_cloneTypedArray.js +3 -2
- package/esm/_/_flattenArrayLikeObjects.d.ts +11 -0
- package/esm/_/_flattenArrayLikeObjects.d.ts.map +1 -0
- package/esm/_/_flattenArrayLikeObjects.js +55 -0
- package/esm/_/assignIn.d.ts +35 -0
- package/esm/_/assignIn.d.ts.map +1 -0
- package/esm/_/assignIn.js +50 -0
- package/esm/_/bindAll.d.ts +16 -0
- package/esm/_/bindAll.d.ts.map +1 -0
- package/esm/_/bindAll.js +88 -0
- package/esm/_/chunk.d.ts +15 -0
- package/esm/_/chunk.d.ts.map +1 -0
- package/esm/_/chunk.js +61 -0
- package/esm/_/clone.d.ts +12 -0
- package/esm/_/clone.d.ts.map +1 -0
- package/esm/_/clone.js +45 -0
- package/esm/_/cloneDeep.js +1 -1
- package/esm/_/cloneDeepWith.d.ts +18 -0
- package/esm/_/cloneDeepWith.d.ts.map +1 -0
- package/esm/_/cloneDeepWith.js +36 -0
- package/esm/_/constant.d.ts +39 -0
- package/esm/_/constant.d.ts.map +1 -0
- package/esm/_/constant.js +43 -0
- package/esm/_/defaults.d.ts +36 -0
- package/esm/_/defaults.d.ts.map +1 -0
- package/esm/_/defaults.js +51 -0
- package/esm/_/differenceWith.d.ts +27 -0
- package/esm/_/differenceWith.d.ts.map +1 -0
- package/esm/_/differenceWith.js +39 -0
- package/esm/_/dropRightWhile.d.ts +13 -0
- package/esm/_/dropRightWhile.d.ts.map +1 -0
- package/esm/_/dropRightWhile.js +54 -0
- package/esm/_/escapeRegExp.d.ts +12 -0
- package/esm/_/escapeRegExp.d.ts.map +1 -0
- package/esm/_/escapeRegExp.js +47 -0
- package/esm/_/findKey.d.ts +14 -0
- package/esm/_/findKey.d.ts.map +1 -0
- package/esm/_/findKey.js +58 -0
- package/esm/_/findLastIndex.d.ts +16 -0
- package/esm/_/findLastIndex.d.ts.map +1 -0
- package/esm/_/findLastIndex.js +67 -0
- package/esm/_/get.d.ts +78 -0
- package/esm/_/get.d.ts.map +1 -0
- package/esm/_/get.js +36 -0
- package/esm/_/inRange.d.ts +14 -0
- package/esm/_/inRange.d.ts.map +1 -0
- package/esm/_/inRange.js +51 -0
- package/esm/_/initial.d.ts +11 -0
- package/esm/_/initial.d.ts.map +1 -0
- package/esm/_/initial.js +44 -0
- package/esm/_/intersection.d.ts +13 -0
- package/esm/_/intersection.d.ts.map +1 -0
- package/esm/_/intersection.js +45 -0
- package/esm/_/intersectionBy.d.ts +32 -0
- package/esm/_/intersectionBy.d.ts.map +1 -0
- package/esm/_/intersectionBy.js +41 -0
- package/esm/_/intersectionWith.d.ts +28 -0
- package/esm/_/intersectionWith.d.ts.map +1 -0
- package/esm/_/intersectionWith.js +38 -0
- package/esm/_/invert.d.ts +14 -0
- package/esm/_/invert.d.ts.map +1 -0
- package/esm/_/invert.js +55 -0
- package/esm/_/isError.d.ts +11 -0
- package/esm/_/isError.d.ts.map +1 -0
- package/esm/_/isError.js +57 -0
- package/esm/_/keys.d.ts +11 -0
- package/esm/_/keys.d.ts.map +1 -0
- package/esm/_/keys.js +60 -0
- package/esm/_/mapValues.d.ts +63 -0
- package/esm/_/mapValues.d.ts.map +1 -0
- package/esm/_/mapValues.js +47 -0
- package/esm/_/max.d.ts +16 -0
- package/esm/_/max.d.ts.map +1 -0
- package/esm/_/max.js +37 -0
- package/esm/_/mergeWith.d.ts +34 -0
- package/esm/_/mergeWith.d.ts.map +1 -0
- package/esm/_/mergeWith.js +50 -0
- package/esm/_/min.d.ts +16 -0
- package/esm/_/min.d.ts.map +1 -0
- package/esm/_/min.js +37 -0
- package/esm/_/negate.d.ts +41 -0
- package/esm/_/negate.d.ts.map +1 -0
- package/esm/_/negate.js +48 -0
- package/esm/_/reduce.d.ts +37 -0
- package/esm/_/reduce.d.ts.map +1 -0
- package/esm/_/reduce.js +48 -0
- package/esm/_/sumBy.d.ts +14 -0
- package/esm/_/sumBy.d.ts.map +1 -0
- package/esm/_/sumBy.js +47 -0
- package/esm/_/tail.d.ts +15 -0
- package/esm/_/tail.d.ts.map +1 -0
- package/esm/_/tail.js +36 -0
- package/esm/_/times.d.ts +17 -0
- package/esm/_/times.d.ts.map +1 -0
- package/esm/_/times.js +57 -0
- package/esm/_/toFinite.d.ts +0 -30
- package/esm/_/toFinite.d.ts.map +1 -1
- package/esm/_/toFinite.js +2 -2
- package/esm/_/toInteger.d.ts +11 -0
- package/esm/_/toInteger.d.ts.map +1 -0
- package/esm/_/toInteger.js +46 -0
- package/esm/_/types.d.ts +47 -0
- package/esm/_/types.d.ts.map +1 -1
- package/esm/_/unescape.d.ts +13 -0
- package/esm/_/unescape.d.ts.map +1 -0
- package/esm/_/unescape.js +56 -0
- package/esm/_/union.d.ts.map +1 -1
- package/esm/_/union.js +2 -13
- package/esm/_/unionBy.d.ts +34 -0
- package/esm/_/unionBy.d.ts.map +1 -0
- package/esm/_/unionBy.js +42 -0
- package/esm/_/updateWith.d.ts +23 -0
- package/esm/_/updateWith.d.ts.map +1 -0
- package/esm/_/updateWith.js +41 -0
- package/esm/_/without.d.ts +15 -0
- package/esm/_/without.d.ts.map +1 -0
- package/esm/_/without.js +47 -0
- package/esm/index.d.ts +37 -3
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +36 -2
- package/esm/util.d.ts +857 -18
- package/package.json +3 -3
|
@@ -0,0 +1,36 @@
|
|
|
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 { _baseClone } from "./_baseClone.js";
|
|
33
|
+
export function _cloneDeepWith(value, customizer) {
|
|
34
|
+
const customize = typeof customizer === "function" ? customizer : undefined;
|
|
35
|
+
return _baseClone(value, true, customize);
|
|
36
|
+
}
|
|
@@ -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
|
+
* Creates a function that returns `value`, by reference, on every call, ignoring its arguments and `this`.
|
|
33
|
+
*
|
|
34
|
+
* @param value - The value to return from the new function.
|
|
35
|
+
* @returns Returns the new constant function.
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
export declare function _constant<T>(value: T): () => T;
|
|
39
|
+
//# sourceMappingURL=constant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../src/_/constant.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,CAI9C"}
|
|
@@ -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
|
+
* Creates a function that returns `value`, by reference, on every call, ignoring its arguments and `this`.
|
|
34
|
+
*
|
|
35
|
+
* @param value - The value to return from the new function.
|
|
36
|
+
* @returns Returns the new constant function.
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export function _constant(value) {
|
|
40
|
+
return function () {
|
|
41
|
+
return value;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Assigns own and inherited enumerable string keyed properties of source objects to the destination object
|
|
3
|
+
* for all destination properties that resolve to `undefined`. Source objects are applied from left to
|
|
4
|
+
* right, so once a property is set, additional values of the same property are ignored. A value inherited
|
|
5
|
+
* from `Object.prototype`, such as `toString`, counts as missing too. Sources are copied by plain
|
|
6
|
+
* assignment, a nullish destination becomes a new object and a primitive one is boxed.
|
|
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 _defaults<TObject, TSource>(object: TObject, source: TSource): NonNullable<TSource & TObject>;
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare function _defaults<TObject, TSource1, TSource2>(object: TObject, source1: TSource1, source2: TSource2): NonNullable<TSource2 & TSource1 & TObject>;
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export declare function _defaults<TObject, TSource1, TSource2, TSource3>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3): NonNullable<TSource3 & TSource2 & TSource1 & TObject>;
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export declare function _defaults<TObject, TSource1, TSource2, TSource3, TSource4>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4): NonNullable<TSource4 & TSource3 & TSource2 & TSource1 & TObject>;
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export declare function _defaults<TObject>(object: TObject): NonNullable<TObject>;
|
|
32
|
+
/**
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
export declare function _defaults(object: any, ...sources: any[]): any;
|
|
36
|
+
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/_/defaults.ts"],"names":[],"mappings":"AAyCA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC;AAC9G;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EACjD,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,QAAQ,GAClB,WAAW,CAAC,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC,CAAC;AAC9C;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAC3D,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,QAAQ,GAClB,WAAW,CAAC,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC,CAAC;AACzD;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EACrE,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,QAAQ,GAClB,WAAW,CAAC,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC,CAAC;AACpE;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;AAC1E;;GAEG;AAEH,wBAAgB,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC"}
|
|
@@ -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
|
+
import { _isIterateeCall } from "./_isIterateeCall.js";
|
|
33
|
+
import { _eq } from "./eq.js";
|
|
34
|
+
import { _keysIn } from "./keysIn.js";
|
|
35
|
+
const objectProto = Object.prototype;
|
|
36
|
+
export function _defaults(object, ...sources) {
|
|
37
|
+
const target = Object(object);
|
|
38
|
+
// when called as an iteratee, e.g. by `reduce`, only the value is a source, not the index and collection
|
|
39
|
+
const length = sources.length > 2 && _isIterateeCall(sources[0], sources[1], sources[2]) ? 1 : sources.length;
|
|
40
|
+
for (let index = 0; index < length; index++) {
|
|
41
|
+
const source = sources[index];
|
|
42
|
+
const from = Object(source);
|
|
43
|
+
for (const key of _keysIn(source)) {
|
|
44
|
+
const value = target[key];
|
|
45
|
+
if (value === undefined || (_eq(value, objectProto[key]) && !Object.hasOwn(target, key))) {
|
|
46
|
+
target[key] = from[key];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return target;
|
|
51
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { _Comparator2, _List } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* This method is like `_difference` except that it accepts `comparator` which is invoked to compare elements
|
|
4
|
+
* of `array` to `values`. The order and references of result values are determined by the first array. The
|
|
5
|
+
* comparator is invoked with two arguments: (arrVal, othVal). As in lodash, the last argument is taken as
|
|
6
|
+
* the comparator unless it is an array-like object, and `-0` is not normalised when a comparator is used.
|
|
7
|
+
*
|
|
8
|
+
* @param array - The array to inspect.
|
|
9
|
+
* @param values - The values to exclude.
|
|
10
|
+
* @param comparator - The comparator invoked per element.
|
|
11
|
+
* @returns Returns the new array of filtered values.
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare function _differenceWith<T1, T2>(array: _List<T1> | null | undefined, values: _List<T2>, comparator: _Comparator2<T1, T2>): T1[];
|
|
15
|
+
/**
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare function _differenceWith<T1, T2, T3>(array: _List<T1> | null | undefined, values1: _List<T2>, values2: _List<T3>, comparator: _Comparator2<T1, T2 | T3>): T1[];
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare function _differenceWith<T1, T2, T3, T4>(array: _List<T1> | null | undefined, values1: _List<T2>, values2: _List<T3>, ...values: (_List<T4> | _Comparator2<T1, T2 | T3 | T4>)[]): T1[];
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export declare function _differenceWith<T>(array: _List<T> | null | undefined, ...values: _List<T>[]): T[];
|
|
27
|
+
//# sourceMappingURL=differenceWith.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceWith.d.ts","sourceRoot":"","sources":["../../src/_/differenceWith.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEtD;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,EAAE,EAClC,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EACnC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,EACjB,UAAU,EAAE,YAAY,CAAC,EAAE,EAAE,EAAE,CAAC,GACjC,EAAE,EAAE,CAAC;AACR;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EACtC,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EACnC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,EAClB,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,EAClB,UAAU,EAAE,YAAY,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,GACtC,EAAE,EAAE,CAAC;AACR;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAC1C,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EACnC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,EAClB,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,EAClB,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,GAC1D,EAAE,EAAE,CAAC;AACR;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 { _baseDifference } from "./_baseDifference.js";
|
|
33
|
+
import { _isArrayLike } from "./isArrayLike.js";
|
|
34
|
+
import { _isObjectLike } from "./isObjectLike.js";
|
|
35
|
+
export function _differenceWith(array, ...values) {
|
|
36
|
+
const last = values[values.length - 1];
|
|
37
|
+
const comparator = _isObjectLike(last) && _isArrayLike(last) ? undefined : last;
|
|
38
|
+
return _baseDifference(array, values, undefined, comparator);
|
|
39
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { _List, _ListIteratee } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a slice of `array` excluding elements dropped from the end. Elements are dropped until
|
|
4
|
+
* `predicate` returns falsey. The predicate is invoked with three arguments: (value, index, array), and may
|
|
5
|
+
* be an iteratee shorthand; it defaults to the identity. The result is a new dense array.
|
|
6
|
+
*
|
|
7
|
+
* @param array - The array to query.
|
|
8
|
+
* @param predicate - The function invoked per iteration.
|
|
9
|
+
* @returns Returns the slice of `array`.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function _dropRightWhile<T>(array: _List<T> | null | undefined, predicate?: _ListIteratee<T>): T[];
|
|
13
|
+
//# sourceMappingURL=dropRightWhile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropRightWhile.d.ts","sourceRoot":"","sources":["../../src/_/dropRightWhile.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEvD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EAAE,SAAS,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAaxG"}
|
|
@@ -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 { _baseIteratee } from "./_baseIteratee.js";
|
|
33
|
+
import { _baseSlice } from "./_baseSlice.js";
|
|
34
|
+
/**
|
|
35
|
+
* Creates a slice of `array` excluding elements dropped from the end. Elements are dropped until
|
|
36
|
+
* `predicate` returns falsey. The predicate is invoked with three arguments: (value, index, array), and may
|
|
37
|
+
* be an iteratee shorthand; it defaults to the identity. The result is a new dense array.
|
|
38
|
+
*
|
|
39
|
+
* @param array - The array to query.
|
|
40
|
+
* @param predicate - The function invoked per iteration.
|
|
41
|
+
* @returns Returns the slice of `array`.
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
export function _dropRightWhile(array, predicate) {
|
|
45
|
+
if (!array?.length) {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
const test = _baseIteratee(predicate);
|
|
49
|
+
let index = array.length - 1;
|
|
50
|
+
while (index >= 0 && test(array[index], index, array)) {
|
|
51
|
+
index--;
|
|
52
|
+
}
|
|
53
|
+
return _baseSlice(array, 0, index + 1);
|
|
54
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escapes the `RegExp` special characters `^`, `$`, `\`, `.`, `*`, `+`, `?`, `(`, `)`, `[`, `]`, `{`, `}`
|
|
3
|
+
* and `|` in `string`, so the result matches the input literally when used in a pattern.
|
|
4
|
+
*
|
|
5
|
+
* **Note:** Unlike the `escapeRegExp` in `stringUtils`, `/` is not escaped, matching lodash.
|
|
6
|
+
*
|
|
7
|
+
* @param string - The string to escape.
|
|
8
|
+
* @returns Returns the escaped string.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare function _escapeRegExp(string?: string): string;
|
|
12
|
+
//# sourceMappingURL=escapeRegExp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escapeRegExp.d.ts","sourceRoot":"","sources":["../../src/_/escapeRegExp.ts"],"names":[],"mappings":"AAsCA;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
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 { _toString } from "./toString.js";
|
|
33
|
+
/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */
|
|
34
|
+
const RE_REGEXP_CHAR = /[\\^$.*+?()[\]{}|]/g;
|
|
35
|
+
/**
|
|
36
|
+
* Escapes the `RegExp` special characters `^`, `$`, `\`, `.`, `*`, `+`, `?`, `(`, `)`, `[`, `]`, `{`, `}`
|
|
37
|
+
* and `|` in `string`, so the result matches the input literally when used in a pattern.
|
|
38
|
+
*
|
|
39
|
+
* **Note:** Unlike the `escapeRegExp` in `stringUtils`, `/` is not escaped, matching lodash.
|
|
40
|
+
*
|
|
41
|
+
* @param string - The string to escape.
|
|
42
|
+
* @returns Returns the escaped string.
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
export function _escapeRegExp(string) {
|
|
46
|
+
return _toString(string).replace(RE_REGEXP_CHAR, "\\$&");
|
|
47
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { _ObjectIteratee } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* This method is like `_find` except that it returns the key of the first element `predicate` returns
|
|
4
|
+
* truthy for instead of the element itself. Own enumerable string keys are inspected in order, array-likes
|
|
5
|
+
* and strings by index; the predicate is invoked with three arguments: (value, key, object), may be an
|
|
6
|
+
* iteratee shorthand and defaults to the identity.
|
|
7
|
+
*
|
|
8
|
+
* @param object - The object to inspect.
|
|
9
|
+
* @param predicate - The function invoked per iteration.
|
|
10
|
+
* @returns Returns the key of the matched element, else `undefined`.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function _findKey<T>(object: T | null | undefined, predicate?: _ObjectIteratee<T>): string | undefined;
|
|
14
|
+
//# sourceMappingURL=findKey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findKey.d.ts","sourceRoot":"","sources":["../../src/_/findKey.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAIlD;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EACtB,MAAM,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAC5B,SAAS,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,GAC/B,MAAM,GAAG,SAAS,CAgBpB"}
|
package/esm/_/findKey.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 { _baseIteratee } from "./_baseIteratee.js";
|
|
33
|
+
import { _keys } from "./keys.js";
|
|
34
|
+
/**
|
|
35
|
+
* This method is like `_find` except that it returns the key of the first element `predicate` returns
|
|
36
|
+
* truthy for instead of the element itself. Own enumerable string keys are inspected in order, array-likes
|
|
37
|
+
* and strings by index; the predicate is invoked with three arguments: (value, key, object), may be an
|
|
38
|
+
* iteratee shorthand and defaults to the identity.
|
|
39
|
+
*
|
|
40
|
+
* @param object - The object to inspect.
|
|
41
|
+
* @param predicate - The function invoked per iteration.
|
|
42
|
+
* @returns Returns the key of the matched element, else `undefined`.
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
export function _findKey(object, predicate) {
|
|
46
|
+
// as in lodash, falsy objects are not inspected at all
|
|
47
|
+
if (!object) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
const test = _baseIteratee(predicate);
|
|
51
|
+
const iterable = Object(object);
|
|
52
|
+
for (const key of _keys(object)) {
|
|
53
|
+
if (test(iterable[key], key, iterable)) {
|
|
54
|
+
return key;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { _List, _ListIterateeCustom } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* This method is like `_findIndex` except that it iterates over elements of `array` from right to left,
|
|
4
|
+
* returning the index of the first element `predicate` returns truthy for, else `-1`. The predicate is
|
|
5
|
+
* invoked with three arguments: (value, index, array), may be an iteratee shorthand and defaults to the
|
|
6
|
+
* identity. The search starts at `fromIndex`, which is coerced to an integer the way lodash does it, counted
|
|
7
|
+
* from the end when negative and clamped into the array.
|
|
8
|
+
*
|
|
9
|
+
* @param array - The array to inspect.
|
|
10
|
+
* @param predicate - The function invoked per iteration.
|
|
11
|
+
* @param fromIndex - The index to search from. Defaults to the last index.
|
|
12
|
+
* @returns Returns the index of the found element, else `-1`.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare function _findLastIndex<T>(array: _List<T> | null | undefined, predicate?: _ListIterateeCustom<T, boolean>, fromIndex?: number): number;
|
|
16
|
+
//# sourceMappingURL=findLastIndex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findLastIndex.d.ts","sourceRoot":"","sources":["../../src/_/findLastIndex.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAE7D;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC5B,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EAClC,SAAS,CAAC,EAAE,mBAAmB,CAAC,CAAC,EAAE,OAAO,CAAC,EAC3C,SAAS,CAAC,EAAE,MAAM,GACnB,MAAM,CA0BR"}
|
|
@@ -0,0 +1,67 @@
|
|
|
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 { _toInteger } from "./toInteger.js";
|
|
34
|
+
/**
|
|
35
|
+
* This method is like `_findIndex` except that it iterates over elements of `array` from right to left,
|
|
36
|
+
* returning the index of the first element `predicate` returns truthy for, else `-1`. The predicate is
|
|
37
|
+
* invoked with three arguments: (value, index, array), may be an iteratee shorthand and defaults to the
|
|
38
|
+
* identity. The search starts at `fromIndex`, which is coerced to an integer the way lodash does it, counted
|
|
39
|
+
* from the end when negative and clamped into the array.
|
|
40
|
+
*
|
|
41
|
+
* @param array - The array to inspect.
|
|
42
|
+
* @param predicate - The function invoked per iteration.
|
|
43
|
+
* @param fromIndex - The index to search from. Defaults to the last index.
|
|
44
|
+
* @returns Returns the index of the found element, else `-1`.
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export function _findLastIndex(array, predicate, fromIndex) {
|
|
48
|
+
if (!array?.length) {
|
|
49
|
+
return -1;
|
|
50
|
+
}
|
|
51
|
+
const length = array.length;
|
|
52
|
+
let start = length - 1;
|
|
53
|
+
if (fromIndex !== undefined) {
|
|
54
|
+
const from = _toInteger(fromIndex);
|
|
55
|
+
// as in lodash, the sign is read from the raw argument
|
|
56
|
+
start = fromIndex < 0 ? Math.max(length + from, 0) : Math.min(from, length - 1);
|
|
57
|
+
}
|
|
58
|
+
const test = _baseIteratee(predicate);
|
|
59
|
+
// counting down from one past the start keeps a `-0` start from being returned as is, as in lodash
|
|
60
|
+
let index = start + 1;
|
|
61
|
+
while (index--) {
|
|
62
|
+
if (test(array[index], index, array)) {
|
|
63
|
+
return index;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return -1;
|
|
67
|
+
}
|