@gooddata/util 11.68.0-alpha.8 → 11.68.0-alpha.9
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 +2 -2
- 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
package/NOTICE
CHANGED
|
@@ -3,11 +3,11 @@ Copyright (c) 2017-2026 GoodData Corporation
|
|
|
3
3
|
This product includes a number of subcomponents with separate copyright notices and license terms below. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license. This GoodData project does not necessarily use all the open source software referred to below and may also only use portions of a given package. With respect to the open source software listed in this document, if you (i) have any questions, (ii) wish to receive source code for packages under licenses that require their source code to be made available (such as the GNU Lesser Public License), or (iii) discover any errors or omissions in the licensing information provided, please contact us at legal@gooddata.com. Please identify in source code requests: (i) the packages for which you are requesting corresponding source, (ii) the GoodData product (including any available version) with which the package was provided; and (iii) an email address (if available) or postal address at which GoodData may contact you.
|
|
4
4
|
|
|
5
5
|
--------------------------------------------------------------------------------
|
|
6
|
-
Attribution Notice for @gooddata/util (11.68.0-alpha.
|
|
6
|
+
Attribution Notice for @gooddata/util (11.68.0-alpha.9)
|
|
7
7
|
Package License: MIT
|
|
8
8
|
Own License File: LICENSE
|
|
9
9
|
Date generated: 2026-11-10
|
|
10
|
-
Revision ID:
|
|
10
|
+
Revision ID: 84da343e85211db46f29811651dc10b32662b222
|
|
11
11
|
|
|
12
12
|
This notice lists the components that @gooddata/util depends on, directly or through other
|
|
13
13
|
packages, with the license and copyright information reported for each of them.
|
package/esm/_/_baseClone.d.ts
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
|
+
import type { _CloneDeepWithCustomizer } from "./types.js";
|
|
1
2
|
/** Tracks each traversed object and its clone, so cycles and shared references are reproduced. */
|
|
2
3
|
type _Stack = Map<object, unknown>;
|
|
4
|
+
/** The key and container of a nested value, handed to the customizer. */
|
|
5
|
+
type _Parent = {
|
|
6
|
+
key: unknown;
|
|
7
|
+
object: object;
|
|
8
|
+
};
|
|
3
9
|
/**
|
|
4
|
-
* The base implementation of `_cloneDeep` which tracks traversed objects.
|
|
10
|
+
* The base implementation of `_clone`, `_cloneDeep` and `_cloneDeepWith` which tracks traversed objects. A
|
|
11
|
+
* shallow clone copies array elements and own enumerable keys by reference and shares the buffer of typed
|
|
12
|
+
* arrays and data views; `Map` and `Set` entries are still shallow-cloned one level, as in lodash. A
|
|
13
|
+
* `customizer` is invoked for every value before it is cloned, with the value alone at the top level and
|
|
14
|
+
* with (value, key, object, stack) below; a result other than `undefined` is used as is.
|
|
5
15
|
*
|
|
6
16
|
* @param value - The value to clone.
|
|
17
|
+
* @param deep - Whether to recursively clone nested values.
|
|
18
|
+
* @param customizer - The function to customize cloning.
|
|
7
19
|
* @param stack - Tracks traversed objects and their clone counterparts.
|
|
8
|
-
* @param
|
|
9
|
-
* kept by reference while an uncloneable top-level value becomes an empty
|
|
20
|
+
* @param parent - The key and container of `value` when it sits inside another value being cloned;
|
|
21
|
+
* uncloneable nested values are kept by reference while an uncloneable top-level value becomes an empty
|
|
22
|
+
* object.
|
|
10
23
|
* @returns Returns the cloned value.
|
|
11
24
|
* @internal
|
|
12
25
|
*/
|
|
13
|
-
export declare function _baseClone(value: unknown, stack?: _Stack,
|
|
26
|
+
export declare function _baseClone(value: unknown, deep: boolean, customizer?: _CloneDeepWithCustomizer<unknown>, stack?: _Stack, parent?: _Parent): unknown;
|
|
14
27
|
export {};
|
|
15
28
|
//# sourceMappingURL=_baseClone.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_baseClone.d.ts","sourceRoot":"","sources":["../../src/_/_baseClone.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_baseClone.d.ts","sourceRoot":"","sources":["../../src/_/_baseClone.ts"],"names":[],"mappings":"AA0CA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAkC3D,kGAAkG;AAClG,KAAK,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEnC,yEAAyE;AACzE,KAAK,OAAO,GAAG;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAMhD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CACtB,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,OAAO,EACb,UAAU,CAAC,EAAE,wBAAwB,CAAC,OAAO,CAAC,EAC9C,KAAK,GAAE,MAAkB,EACzB,MAAM,CAAC,EAAE,OAAO,GACjB,OAAO,CAiGT"}
|
package/esm/_/_baseClone.js
CHANGED
|
@@ -45,7 +45,6 @@ const BOOL_TAG = "[object Boolean]";
|
|
|
45
45
|
const DATA_VIEW_TAG = "[object DataView]";
|
|
46
46
|
const DATE_TAG = "[object Date]";
|
|
47
47
|
const FUNC_TAG = "[object Function]";
|
|
48
|
-
const GEN_TAG = "[object GeneratorFunction]";
|
|
49
48
|
const MAP_TAG = "[object Map]";
|
|
50
49
|
const NUMBER_TAG = "[object Number]";
|
|
51
50
|
const OBJECT_TAG = "[object Object]";
|
|
@@ -69,37 +68,63 @@ const CLONEABLE_TAGS = new Set([
|
|
|
69
68
|
/** Used to match `RegExp` flags from their coerced string values. */
|
|
70
69
|
const RE_FLAGS = /\w*$/;
|
|
71
70
|
/**
|
|
72
|
-
* The base implementation of `_cloneDeep` which tracks traversed objects.
|
|
71
|
+
* The base implementation of `_clone`, `_cloneDeep` and `_cloneDeepWith` which tracks traversed objects. A
|
|
72
|
+
* shallow clone copies array elements and own enumerable keys by reference and shares the buffer of typed
|
|
73
|
+
* arrays and data views; `Map` and `Set` entries are still shallow-cloned one level, as in lodash. A
|
|
74
|
+
* `customizer` is invoked for every value before it is cloned, with the value alone at the top level and
|
|
75
|
+
* with (value, key, object, stack) below; a result other than `undefined` is used as is.
|
|
73
76
|
*
|
|
74
77
|
* @param value - The value to clone.
|
|
78
|
+
* @param deep - Whether to recursively clone nested values.
|
|
79
|
+
* @param customizer - The function to customize cloning.
|
|
75
80
|
* @param stack - Tracks traversed objects and their clone counterparts.
|
|
76
|
-
* @param
|
|
77
|
-
* kept by reference while an uncloneable top-level value becomes an empty
|
|
81
|
+
* @param parent - The key and container of `value` when it sits inside another value being cloned;
|
|
82
|
+
* uncloneable nested values are kept by reference while an uncloneable top-level value becomes an empty
|
|
83
|
+
* object.
|
|
78
84
|
* @returns Returns the cloned value.
|
|
79
85
|
* @internal
|
|
80
86
|
*/
|
|
81
|
-
export function _baseClone(value, stack = new Map(),
|
|
87
|
+
export function _baseClone(value, deep, customizer, stack = new Map(), parent) {
|
|
88
|
+
if (customizer) {
|
|
89
|
+
// symbol keys are passed as they are, although the lodash typing only names string and number keys;
|
|
90
|
+
// the top-level call passes the value alone, which the lodash typing does not express
|
|
91
|
+
const customized = parent
|
|
92
|
+
? customizer(value, parent.key, parent.object, stack)
|
|
93
|
+
: customizer(value);
|
|
94
|
+
if (customized !== undefined) {
|
|
95
|
+
return customized;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
82
98
|
if (!_isObject(value)) {
|
|
83
99
|
return value;
|
|
84
100
|
}
|
|
101
|
+
const nested = parent !== undefined;
|
|
85
102
|
const isArr = Array.isArray(value);
|
|
103
|
+
const source = value;
|
|
86
104
|
let result;
|
|
87
105
|
if (isArr) {
|
|
88
106
|
result = _initCloneArray(value);
|
|
107
|
+
if (!deep) {
|
|
108
|
+
// holes become explicit `undefined` entries, extra properties are not copied
|
|
109
|
+
for (let index = 0; index < value.length; index++) {
|
|
110
|
+
result[index] = source[index];
|
|
111
|
+
}
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
89
114
|
}
|
|
90
115
|
else {
|
|
91
116
|
const tag = _baseGetTag(value);
|
|
92
|
-
if (tag === OBJECT_TAG || tag === ARGS_TAG) {
|
|
93
|
-
result = _initCloneObject(value);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
117
|
+
if (tag === OBJECT_TAG || tag === ARGS_TAG || (tag === FUNC_TAG && !nested)) {
|
|
118
|
+
result = tag === FUNC_TAG ? {} : _initCloneObject(value);
|
|
119
|
+
if (!deep) {
|
|
120
|
+
for (const key of _getAllKeys(value)) {
|
|
121
|
+
_assignValue(result, key, source[key]);
|
|
122
|
+
}
|
|
123
|
+
return result;
|
|
98
124
|
}
|
|
99
|
-
result = {};
|
|
100
125
|
}
|
|
101
126
|
else if (_isTypedArray(value) || CLONEABLE_TAGS.has(tag)) {
|
|
102
|
-
result = _initCloneByTag(value, tag);
|
|
127
|
+
result = _initCloneByTag(value, tag, deep);
|
|
103
128
|
}
|
|
104
129
|
else {
|
|
105
130
|
return nested ? value : {};
|
|
@@ -113,26 +138,31 @@ export function _baseClone(value, stack = new Map(), nested = false) {
|
|
|
113
138
|
if (value instanceof Set) {
|
|
114
139
|
const target = result;
|
|
115
140
|
value.forEach((subValue) => {
|
|
116
|
-
target.add(_baseClone(subValue, stack,
|
|
141
|
+
target.add(_baseClone(subValue, deep, customizer, stack, { key: subValue, object: value }));
|
|
117
142
|
});
|
|
118
143
|
}
|
|
119
144
|
else if (value instanceof Map) {
|
|
120
145
|
const target = result;
|
|
121
146
|
// keys are kept by reference, only values are cloned
|
|
122
147
|
value.forEach((subValue, key) => {
|
|
123
|
-
target.set(key, _baseClone(subValue, stack,
|
|
148
|
+
target.set(key, _baseClone(subValue, deep, customizer, stack, { key, object: value }));
|
|
124
149
|
});
|
|
125
150
|
}
|
|
126
|
-
const source = value;
|
|
127
151
|
if (isArr) {
|
|
128
152
|
// holes are visited too and become explicit `undefined` entries in the clone
|
|
129
153
|
for (let index = 0; index < value.length; index++) {
|
|
130
|
-
|
|
154
|
+
const cloned = _baseClone(source[index], deep, customizer, stack, {
|
|
155
|
+
key: index,
|
|
156
|
+
object: value,
|
|
157
|
+
});
|
|
158
|
+
_assignValue(result, index, cloned);
|
|
131
159
|
}
|
|
132
160
|
}
|
|
133
161
|
else {
|
|
134
|
-
|
|
135
|
-
|
|
162
|
+
// with a customizer the index keys of a typed array are visited too, so elements can be customized
|
|
163
|
+
for (const key of customizer ? _getAllKeys(value) : _ownKeys(value)) {
|
|
164
|
+
const cloned = _baseClone(source[key], deep, customizer, stack, { key, object: value });
|
|
165
|
+
_assignValue(result, key, cloned);
|
|
136
166
|
}
|
|
137
167
|
}
|
|
138
168
|
return result;
|
|
@@ -164,9 +194,10 @@ function _initCloneArray(array) {
|
|
|
164
194
|
}
|
|
165
195
|
/**
|
|
166
196
|
* Initializes a clone of a value by its `toStringTag`. Collections come back empty and are filled by
|
|
167
|
-
* the caller; everything else is complete on return.
|
|
197
|
+
* the caller; everything else is complete on return. A shallow clone of a typed array or data view shares
|
|
198
|
+
* the buffer of the original, an array buffer is always copied.
|
|
168
199
|
*/
|
|
169
|
-
function _initCloneByTag(object, tag) {
|
|
200
|
+
function _initCloneByTag(object, tag, deep) {
|
|
170
201
|
const Ctor = object.constructor;
|
|
171
202
|
switch (tag) {
|
|
172
203
|
case ARRAY_BUFFER_TAG:
|
|
@@ -176,7 +207,8 @@ function _initCloneByTag(object, tag) {
|
|
|
176
207
|
return new Ctor(Number(object));
|
|
177
208
|
case DATA_VIEW_TAG: {
|
|
178
209
|
const view = object;
|
|
179
|
-
|
|
210
|
+
const buffer = deep ? _cloneArrayBuffer(view.buffer) : view.buffer;
|
|
211
|
+
return new Ctor(buffer, view.byteOffset, view.byteLength);
|
|
180
212
|
}
|
|
181
213
|
case MAP_TAG:
|
|
182
214
|
case SET_TAG:
|
|
@@ -193,5 +225,5 @@ function _initCloneByTag(object, tag) {
|
|
|
193
225
|
case SYMBOL_TAG:
|
|
194
226
|
return Object(object.valueOf());
|
|
195
227
|
}
|
|
196
|
-
return _cloneTypedArray(object);
|
|
228
|
+
return _cloneTypedArray(object, deep);
|
|
197
229
|
}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import type { _List } from "./types.js";
|
|
2
2
|
/**
|
|
3
|
-
* The base implementation of `_difference` and `
|
|
4
|
-
* criteria are not among the criteria of the `values` lists, compared with
|
|
5
|
-
*
|
|
3
|
+
* The base implementation of `_difference`, `_differenceBy` and `_differenceWith`: creates an array of the
|
|
4
|
+
* `array` values whose criteria are not among the criteria of the `values` lists, compared with
|
|
5
|
+
* SameValueZero, or with `comparator` when one is given. The order and references of result values are
|
|
6
|
+
* determined by the first array, with `-0` normalised to `0` unless a comparator is used. Only array-like
|
|
6
7
|
* objects are inspected: any other `array` yields an empty array and any other entry of `values` is skipped.
|
|
7
8
|
*
|
|
8
9
|
* @param array - The array to inspect.
|
|
9
10
|
* @param values - The lists of values to exclude.
|
|
10
11
|
* @param iteratee - The iteratee invoked per element to produce its criterion. Defaults to identity.
|
|
12
|
+
* @param comparator - The comparator invoked per element with (arrayValue, otherValue); a truthy result
|
|
13
|
+
* excludes the element.
|
|
11
14
|
* @returns Returns the new array of filtered values.
|
|
12
15
|
* @internal
|
|
13
16
|
*/
|
|
14
|
-
export declare function _baseDifference<T>(array: _List<T> | null | undefined, values: unknown[], iteratee?: (value: unknown) => unknown): T[];
|
|
17
|
+
export declare function _baseDifference<T>(array: _List<T> | null | undefined, values: unknown[], iteratee?: (value: unknown) => unknown, comparator?: (arrayValue: unknown, otherValue: unknown) => boolean): T[];
|
|
15
18
|
//# sourceMappingURL=_baseDifference.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_baseDifference.d.ts","sourceRoot":"","sources":["../../src/_/_baseDifference.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC
|
|
1
|
+
{"version":3,"file":"_baseDifference.d.ts","sourceRoot":"","sources":["../../src/_/_baseDifference.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAC7B,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EAClC,MAAM,EAAE,OAAO,EAAE,EACjB,QAAQ,GAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAA0B,EACxD,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,KAAK,OAAO,GACnE,CAAC,EAAE,CAoCL"}
|
package/esm/_/_baseDifference.js
CHANGED
|
@@ -32,34 +32,45 @@
|
|
|
32
32
|
import { _isArrayLike } from "./isArrayLike.js";
|
|
33
33
|
import { _isObjectLike } from "./isObjectLike.js";
|
|
34
34
|
/**
|
|
35
|
-
* The base implementation of `_difference` and `
|
|
36
|
-
* criteria are not among the criteria of the `values` lists, compared with
|
|
37
|
-
*
|
|
35
|
+
* The base implementation of `_difference`, `_differenceBy` and `_differenceWith`: creates an array of the
|
|
36
|
+
* `array` values whose criteria are not among the criteria of the `values` lists, compared with
|
|
37
|
+
* SameValueZero, or with `comparator` when one is given. The order and references of result values are
|
|
38
|
+
* determined by the first array, with `-0` normalised to `0` unless a comparator is used. Only array-like
|
|
38
39
|
* objects are inspected: any other `array` yields an empty array and any other entry of `values` is skipped.
|
|
39
40
|
*
|
|
40
41
|
* @param array - The array to inspect.
|
|
41
42
|
* @param values - The lists of values to exclude.
|
|
42
43
|
* @param iteratee - The iteratee invoked per element to produce its criterion. Defaults to identity.
|
|
44
|
+
* @param comparator - The comparator invoked per element with (arrayValue, otherValue); a truthy result
|
|
45
|
+
* excludes the element.
|
|
43
46
|
* @returns Returns the new array of filtered values.
|
|
44
47
|
* @internal
|
|
45
48
|
*/
|
|
46
|
-
export function _baseDifference(array, values, iteratee = (value) => value) {
|
|
49
|
+
export function _baseDifference(array, values, iteratee = (value) => value, comparator) {
|
|
47
50
|
if (!_isObjectLike(array) || !_isArrayLike(array)) {
|
|
48
51
|
return [];
|
|
49
52
|
}
|
|
50
|
-
const excluded =
|
|
53
|
+
const excluded = [];
|
|
51
54
|
for (const list of values) {
|
|
52
55
|
if (!_isObjectLike(list) || !_isArrayLike(list)) {
|
|
53
56
|
continue;
|
|
54
57
|
}
|
|
55
58
|
for (let index = 0; index < list.length; index++) {
|
|
56
|
-
excluded.
|
|
59
|
+
excluded.push(iteratee(list[index]));
|
|
57
60
|
}
|
|
58
61
|
}
|
|
62
|
+
const excludedSet = new Set(excluded);
|
|
59
63
|
const result = [];
|
|
60
64
|
for (let index = 0; index < array.length; index++) {
|
|
61
65
|
const value = array[index];
|
|
62
|
-
|
|
66
|
+
const computed = iteratee(value);
|
|
67
|
+
if (comparator) {
|
|
68
|
+
// lodash keeps `-0` as it is when a comparator is used
|
|
69
|
+
if (!excluded.some((other) => comparator(computed, other))) {
|
|
70
|
+
result.push(value);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else if (!excludedSet.has(computed)) {
|
|
63
74
|
// lodash normalises `-0` to `+0` in the result
|
|
64
75
|
result.push(value === 0 ? 0 : value);
|
|
65
76
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { _List } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The base implementation of methods like `_max` and `_min` which accepts a `comparator` to determine the
|
|
4
|
+
* extremum value. Elements whose criterion is nullish, `NaN` or a symbol never seed the result; once a
|
|
5
|
+
* result is seeded every later criterion is passed to the comparator. The `length` of `array` is used as
|
|
6
|
+
* is, as in lodash.
|
|
7
|
+
*
|
|
8
|
+
* @param array - The array to iterate over.
|
|
9
|
+
* @param iteratee - The iteratee invoked per element to produce its criterion.
|
|
10
|
+
* @param comparator - Returns `true` when `current` should replace `computed` as the extremum.
|
|
11
|
+
* @returns Returns the extremum element, or `undefined` when there is none.
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare function _baseExtremum<T, TCriterion>(array: _List<T>, iteratee: (value: T) => TCriterion, comparator: (current: TCriterion, computed: TCriterion) => boolean): T | undefined;
|
|
15
|
+
//# sourceMappingURL=_baseExtremum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_baseExtremum.d.ts","sourceRoot":"","sources":["../../src/_/_baseExtremum.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,UAAU,EACvC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EACf,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,UAAU,EAClC,UAAU,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,KAAK,OAAO,GACnE,CAAC,GAAG,SAAS,CAyBf"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/*!
|
|
3
|
+
* Portions of this file are derived from Lodash.
|
|
4
|
+
* https://github.com/lodash/lodash
|
|
5
|
+
*
|
|
6
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
7
|
+
*
|
|
8
|
+
* Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
9
|
+
* DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
10
|
+
*
|
|
11
|
+
* Modifications Copyright (c) 2026 GoodData Corporation
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
14
|
+
* a copy of this software and associated documentation files (the
|
|
15
|
+
* "Software"), to deal in the Software without restriction, including
|
|
16
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
17
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
18
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
19
|
+
* the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be
|
|
22
|
+
* included in all copies or substantial portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
26
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
27
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
28
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
29
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
30
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
import { _isSymbol } from "./isSymbol.js";
|
|
33
|
+
/**
|
|
34
|
+
* The base implementation of methods like `_max` and `_min` which accepts a `comparator` to determine the
|
|
35
|
+
* extremum value. Elements whose criterion is nullish, `NaN` or a symbol never seed the result; once a
|
|
36
|
+
* result is seeded every later criterion is passed to the comparator. The `length` of `array` is used as
|
|
37
|
+
* is, as in lodash.
|
|
38
|
+
*
|
|
39
|
+
* @param array - The array to iterate over.
|
|
40
|
+
* @param iteratee - The iteratee invoked per element to produce its criterion.
|
|
41
|
+
* @param comparator - Returns `true` when `current` should replace `computed` as the extremum.
|
|
42
|
+
* @returns Returns the extremum element, or `undefined` when there is none.
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
export function _baseExtremum(array, iteratee, comparator) {
|
|
46
|
+
const length = array.length;
|
|
47
|
+
let computed;
|
|
48
|
+
let result;
|
|
49
|
+
for (let index = 0; index < length; index++) {
|
|
50
|
+
const value = array[index];
|
|
51
|
+
const current = iteratee(value);
|
|
52
|
+
if (current == null) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const replaces = computed === undefined
|
|
56
|
+
? !Number.isNaN(current) && !_isSymbol(current)
|
|
57
|
+
: comparator(current, computed);
|
|
58
|
+
if (replaces) {
|
|
59
|
+
computed = current;
|
|
60
|
+
result = value;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The base implementation of `_intersection`, `_intersectionBy` and `_intersectionWith`: creates an array of
|
|
3
|
+
* the values of the first array whose criterion appears in every other array, compared with SameValueZero,
|
|
4
|
+
* or with `comparator` when one is given. Each criterion is kept once, with the first value producing it, in
|
|
5
|
+
* the order of the first array and with `-0` normalised to `0` unless a comparator is used. Only array-like
|
|
6
|
+
* objects are inspected: any other first argument yields an empty array and any other argument counts as
|
|
7
|
+
* empty. As in lodash, the criteria of the other arrays are computed from the last array to the first, the
|
|
8
|
+
* other arrays are searched in that order too, and the first array is only walked until the result is as
|
|
9
|
+
* long as the shortest array.
|
|
10
|
+
*
|
|
11
|
+
* @param arrays - The arrays to inspect.
|
|
12
|
+
* @param iteratee - The iteratee invoked per element to produce its criterion. Defaults to identity.
|
|
13
|
+
* @param comparator - The comparator invoked per criterion with (arrayValue, otherValue); a truthy result
|
|
14
|
+
* is a match, and the result is also deduplicated through it.
|
|
15
|
+
* @returns Returns the new array of intersecting values.
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare function _baseIntersection<T>(arrays: unknown[], iteratee?: (value: unknown) => unknown, comparator?: (arrayValue: unknown, otherValue: unknown) => boolean): T[];
|
|
19
|
+
//# sourceMappingURL=_baseIntersection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_baseIntersection.d.ts","sourceRoot":"","sources":["../../src/_/_baseIntersection.ts"],"names":[],"mappings":"AAqCA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAC/B,MAAM,EAAE,OAAO,EAAE,EACjB,QAAQ,GAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAA0B,EACxD,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,KAAK,OAAO,GACnE,CAAC,EAAE,CAqDL"}
|
|
@@ -0,0 +1,91 @@
|
|
|
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 { _isArrayLike } from "./isArrayLike.js";
|
|
33
|
+
import { _isObjectLike } from "./isObjectLike.js";
|
|
34
|
+
/**
|
|
35
|
+
* The base implementation of `_intersection`, `_intersectionBy` and `_intersectionWith`: creates an array of
|
|
36
|
+
* the values of the first array whose criterion appears in every other array, compared with SameValueZero,
|
|
37
|
+
* or with `comparator` when one is given. Each criterion is kept once, with the first value producing it, in
|
|
38
|
+
* the order of the first array and with `-0` normalised to `0` unless a comparator is used. Only array-like
|
|
39
|
+
* objects are inspected: any other first argument yields an empty array and any other argument counts as
|
|
40
|
+
* empty. As in lodash, the criteria of the other arrays are computed from the last array to the first, the
|
|
41
|
+
* other arrays are searched in that order too, and the first array is only walked until the result is as
|
|
42
|
+
* long as the shortest array.
|
|
43
|
+
*
|
|
44
|
+
* @param arrays - The arrays to inspect.
|
|
45
|
+
* @param iteratee - The iteratee invoked per element to produce its criterion. Defaults to identity.
|
|
46
|
+
* @param comparator - The comparator invoked per criterion with (arrayValue, otherValue); a truthy result
|
|
47
|
+
* is a match, and the result is also deduplicated through it.
|
|
48
|
+
* @returns Returns the new array of intersecting values.
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export function _baseIntersection(arrays, iteratee = (value) => value, comparator) {
|
|
52
|
+
const [first, ...others] = arrays;
|
|
53
|
+
if (!_isObjectLike(first) || !_isArrayLike(first)) {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
const source = first;
|
|
57
|
+
const otherCriteria = [];
|
|
58
|
+
let maxLength = source.length;
|
|
59
|
+
for (let position = others.length - 1; position >= 0; position--) {
|
|
60
|
+
const list = others[position];
|
|
61
|
+
const isList = _isObjectLike(list) && _isArrayLike(list);
|
|
62
|
+
const values = isList ? Array.from(list) : [];
|
|
63
|
+
maxLength = Math.min(maxLength, values.length);
|
|
64
|
+
otherCriteria.push(values.map((value) => iteratee(value)));
|
|
65
|
+
}
|
|
66
|
+
const otherSets = comparator ? [] : otherCriteria.map((criteria) => new Set(criteria));
|
|
67
|
+
const seen = new Set();
|
|
68
|
+
const result = [];
|
|
69
|
+
const resultCriteria = [];
|
|
70
|
+
for (let index = 0; index < source.length && result.length < maxLength; index++) {
|
|
71
|
+
const value = source[index];
|
|
72
|
+
const computed = iteratee(value);
|
|
73
|
+
if (comparator) {
|
|
74
|
+
const matches = (other) => comparator(computed, other);
|
|
75
|
+
if (resultCriteria.some(matches) || otherCriteria.some((criteria) => !criteria.some(matches))) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
resultCriteria.push(computed);
|
|
79
|
+
// lodash keeps `-0` as it is when a comparator is used
|
|
80
|
+
result.push(value);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (seen.has(computed) || otherSets.some((set) => !set.has(computed))) {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
seen.add(computed);
|
|
87
|
+
// lodash normalises `-0` to `+0` in the result
|
|
88
|
+
result.push(value === 0 ? 0 : value);
|
|
89
|
+
}
|
|
90
|
+
return result;
|
|
91
|
+
}
|
package/esm/_/_baseMerge.d.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
import type { _MergeWithCustomizer } from "./types.js";
|
|
1
2
|
type _AnyRecord = Record<PropertyKey, unknown>;
|
|
2
3
|
/** Tracks each traversed source value and its merged counterpart, so cycles and shared references are kept. */
|
|
3
4
|
type _Stack = Map<unknown, unknown>;
|
|
4
5
|
/**
|
|
5
|
-
* The base implementation of `_merge` for a single source: merges the own and inherited
|
|
6
|
-
* keyed properties of `source` into `object`.
|
|
6
|
+
* The base implementation of `_merge` and `_mergeWith` for a single source: merges the own and inherited
|
|
7
|
+
* enumerable string keyed properties of `source` into `object`. When a `customizer` is given it is invoked
|
|
8
|
+
* per property with (objValue, srcValue, key, object, source, stack), and a result other than `undefined`
|
|
9
|
+
* is used as the merged value instead of the default merge.
|
|
7
10
|
*
|
|
8
11
|
* @param object - The destination object.
|
|
9
12
|
* @param source - The source object.
|
|
10
13
|
* @param stack - Tracks traversed source values and their merged counterparts.
|
|
14
|
+
* @param customizer - The function to customize assigned values.
|
|
11
15
|
* @internal
|
|
12
16
|
*/
|
|
13
|
-
export declare function _baseMerge(object: _AnyRecord, source: _AnyRecord, stack: _Stack): void;
|
|
17
|
+
export declare function _baseMerge(object: _AnyRecord, source: _AnyRecord, stack: _Stack, customizer?: _MergeWithCustomizer): void;
|
|
14
18
|
export {};
|
|
15
19
|
//# sourceMappingURL=_baseMerge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_baseMerge.d.ts","sourceRoot":"","sources":["../../src/_/_baseMerge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_baseMerge.d.ts","sourceRoot":"","sources":["../../src/_/_baseMerge.ts"],"names":[],"mappings":"AA4CA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,KAAK,UAAU,GAAG,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAE/C,+GAA+G;AAC/G,KAAK,MAAM,GAAG,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAEpC;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CACtB,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,oBAAoB,GAClC,IAAI,CAkBN"}
|
package/esm/_/_baseMerge.js
CHANGED
|
@@ -41,33 +41,37 @@ import { _isPlainObject } from "./isPlainObject.js";
|
|
|
41
41
|
import { _isTypedArray } from "./isTypedArray.js";
|
|
42
42
|
import { _keysIn } from "./keysIn.js";
|
|
43
43
|
/**
|
|
44
|
-
* The base implementation of `_merge` for a single source: merges the own and inherited
|
|
45
|
-
* keyed properties of `source` into `object`.
|
|
44
|
+
* The base implementation of `_merge` and `_mergeWith` for a single source: merges the own and inherited
|
|
45
|
+
* enumerable string keyed properties of `source` into `object`. When a `customizer` is given it is invoked
|
|
46
|
+
* per property with (objValue, srcValue, key, object, source, stack), and a result other than `undefined`
|
|
47
|
+
* is used as the merged value instead of the default merge.
|
|
46
48
|
*
|
|
47
49
|
* @param object - The destination object.
|
|
48
50
|
* @param source - The source object.
|
|
49
51
|
* @param stack - Tracks traversed source values and their merged counterparts.
|
|
52
|
+
* @param customizer - The function to customize assigned values.
|
|
50
53
|
* @internal
|
|
51
54
|
*/
|
|
52
|
-
export function _baseMerge(object, source, stack) {
|
|
55
|
+
export function _baseMerge(object, source, stack, customizer) {
|
|
53
56
|
if (object === source) {
|
|
54
57
|
return;
|
|
55
58
|
}
|
|
56
59
|
for (const key of _keysIn(source)) {
|
|
57
60
|
const srcValue = source[key];
|
|
58
61
|
if (_isObject(srcValue)) {
|
|
59
|
-
_mergeDeep(object, source, key, stack);
|
|
60
|
-
|
|
61
|
-
else {
|
|
62
|
-
_assignMergeValue(object, key, srcValue);
|
|
62
|
+
_mergeDeep(object, source, key, stack, customizer);
|
|
63
|
+
continue;
|
|
63
64
|
}
|
|
65
|
+
const customized = customizer?.(_safeGet(object, key), srcValue, key, object, source, stack);
|
|
66
|
+
_assignMergeValue(object, key, customized === undefined ? srcValue : customized);
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
69
|
/**
|
|
67
|
-
* Merges the object value at `key`:
|
|
68
|
-
* value, typed arrays are copied, and
|
|
70
|
+
* Merges the object value at `key`: a `customizer` result other than `undefined` is assigned as is; otherwise
|
|
71
|
+
* arrays and plain objects are merged recursively into the destination value, typed arrays are copied, and
|
|
72
|
+
* any other object is assigned by reference.
|
|
69
73
|
*/
|
|
70
|
-
function _mergeDeep(object, source, key, stack) {
|
|
74
|
+
function _mergeDeep(object, source, key, stack, customizer) {
|
|
71
75
|
const objValue = _safeGet(object, key);
|
|
72
76
|
const srcValue = _safeGet(source, key);
|
|
73
77
|
const stacked = stack.get(srcValue);
|
|
@@ -75,6 +79,11 @@ function _mergeDeep(object, source, key, stack) {
|
|
|
75
79
|
_assignMergeValue(object, key, stacked);
|
|
76
80
|
return;
|
|
77
81
|
}
|
|
82
|
+
const customized = customizer?.(objValue, srcValue, key, object, source, stack);
|
|
83
|
+
if (customized !== undefined) {
|
|
84
|
+
_assignMergeValue(object, key, customized);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
78
87
|
let newValue = srcValue;
|
|
79
88
|
// whether `srcValue` still has to be merged into `newValue`
|
|
80
89
|
let isCommon = true;
|
|
@@ -109,7 +118,7 @@ function _mergeDeep(object, source, key, stack) {
|
|
|
109
118
|
}
|
|
110
119
|
if (isCommon) {
|
|
111
120
|
stack.set(srcValue, newValue);
|
|
112
|
-
_baseMerge(newValue, srcValue, stack);
|
|
121
|
+
_baseMerge(newValue, srcValue, stack, customizer);
|
|
113
122
|
stack.delete(srcValue);
|
|
114
123
|
}
|
|
115
124
|
_assignMergeValue(object, key, newValue);
|
package/esm/_/_baseSet.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import type { _SetWithCustomizer } from "./types.js";
|
|
1
2
|
/**
|
|
2
3
|
* The base implementation of `set`.
|
|
3
4
|
*
|
|
4
5
|
* @param object - The object to modify.
|
|
5
6
|
* @param path - The path of the property to set.
|
|
6
7
|
* @param value - The value to set.
|
|
8
|
+
* @param customizer - The function to customize the containers created along the path.
|
|
7
9
|
* @returns Returns `object`.
|
|
8
10
|
* @internal
|
|
9
11
|
*/
|
|
10
|
-
export declare function _baseSet(object: unknown, path: unknown, value: unknown): unknown;
|
|
12
|
+
export declare function _baseSet(object: unknown, path: unknown, value: unknown, customizer?: _SetWithCustomizer<unknown>): unknown;
|
|
11
13
|
//# sourceMappingURL=_baseSet.d.ts.map
|
package/esm/_/_baseSet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_baseSet.d.ts","sourceRoot":"","sources":["../../src/_/_baseSet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_baseSet.d.ts","sourceRoot":"","sources":["../../src/_/_baseSet.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CACpB,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,OAAO,EACd,UAAU,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,GACzC,OAAO,CAoCT"}
|
package/esm/_/_baseSet.js
CHANGED
|
@@ -40,10 +40,11 @@ import { _isObject } from "./isObject.js";
|
|
|
40
40
|
* @param object - The object to modify.
|
|
41
41
|
* @param path - The path of the property to set.
|
|
42
42
|
* @param value - The value to set.
|
|
43
|
+
* @param customizer - The function to customize the containers created along the path.
|
|
43
44
|
* @returns Returns `object`.
|
|
44
45
|
* @internal
|
|
45
46
|
*/
|
|
46
|
-
export function _baseSet(object, path, value) {
|
|
47
|
+
export function _baseSet(object, path, value, customizer) {
|
|
47
48
|
if (!_isObject(object)) {
|
|
48
49
|
return object;
|
|
49
50
|
}
|
|
@@ -58,8 +59,13 @@ export function _baseSet(object, path, value) {
|
|
|
58
59
|
let newValue = value;
|
|
59
60
|
if (index !== lastIndex) {
|
|
60
61
|
const objValue = nested[key];
|
|
61
|
-
//
|
|
62
|
-
|
|
62
|
+
// a customizer may supply the container; otherwise keep an existing one, or create an array for
|
|
63
|
+
// an index segment and an object otherwise; symbol keys are passed as they are, although the
|
|
64
|
+
// lodash typing only names string keys
|
|
65
|
+
newValue = customizer?.(objValue, key, nested);
|
|
66
|
+
if (newValue === undefined) {
|
|
67
|
+
newValue = _isObject(objValue) ? objValue : _isIndex(keys[index + 1]) ? [] : {};
|
|
68
|
+
}
|
|
63
69
|
}
|
|
64
70
|
_assignValue(nested, key, newValue);
|
|
65
71
|
nested = nested[key];
|