@gooddata/util 11.68.0-alpha.2 → 11.68.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/_/_assignValue.d.ts +12 -0
- package/esm/_/_assignValue.d.ts.map +1 -0
- package/esm/_/_assignValue.js +53 -0
- package/esm/_/_baseClone.d.ts +15 -0
- package/esm/_/_baseClone.d.ts.map +1 -0
- package/esm/_/_baseClone.js +224 -0
- package/esm/_/_baseEach.d.ts +11 -0
- package/esm/_/_baseEach.d.ts.map +1 -0
- package/esm/_/_baseEach.js +62 -0
- package/esm/_/_baseGet.d.ts +10 -0
- package/esm/_/_baseGet.d.ts.map +1 -0
- package/esm/_/_baseGet.js +50 -0
- package/esm/_/_baseGetTag.d.ts +9 -0
- package/esm/_/_baseGetTag.d.ts.map +1 -0
- package/esm/_/_baseGetTag.js +48 -0
- package/esm/_/_baseIsEqual.d.ts +34 -0
- package/esm/_/_baseIsEqual.d.ts.map +1 -0
- package/esm/_/_baseIsEqual.js +278 -0
- package/esm/_/_baseIsMatch.d.ts +13 -0
- package/esm/_/_baseIsMatch.d.ts.map +1 -0
- package/esm/_/_baseIsMatch.js +67 -0
- package/esm/_/_baseIteratee.d.ts +15 -0
- package/esm/_/_baseIteratee.d.ts.map +1 -0
- package/esm/_/_baseIteratee.js +65 -0
- package/esm/_/_baseKeys.d.ts +12 -0
- package/esm/_/_baseKeys.d.ts.map +1 -0
- package/esm/_/_baseKeys.js +46 -0
- package/esm/_/_baseMatches.d.ts +10 -0
- package/esm/_/_baseMatches.d.ts.map +1 -0
- package/esm/_/_baseMatches.js +50 -0
- package/esm/_/_baseMatchesProperty.d.ts +11 -0
- package/esm/_/_baseMatchesProperty.d.ts.map +1 -0
- package/esm/_/_baseMatchesProperty.js +59 -0
- package/esm/_/_baseSet.d.ts +11 -0
- package/esm/_/_baseSet.d.ts.map +1 -0
- package/esm/_/_baseSet.js +68 -0
- package/esm/_/_baseUniq.d.ts +43 -0
- package/esm/_/_baseUniq.d.ts.map +1 -0
- package/esm/_/_baseUniq.js +57 -0
- package/esm/_/_baseUnset.d.ts +13 -0
- package/esm/_/_baseUnset.d.ts.map +1 -0
- package/esm/_/_baseUnset.js +62 -0
- package/esm/_/_castPath.d.ts +10 -0
- package/esm/_/_castPath.d.ts.map +1 -0
- package/esm/_/_castPath.js +48 -0
- package/esm/_/_getAllKeys.d.ts +9 -0
- package/esm/_/_getAllKeys.d.ts.map +1 -0
- package/esm/_/_getAllKeys.js +43 -0
- package/esm/_/_getAllKeysIn.d.ts +12 -0
- package/esm/_/_getAllKeysIn.d.ts.map +1 -0
- package/esm/_/_getAllKeysIn.js +59 -0
- package/esm/_/_getMatchData.d.ts +16 -0
- package/esm/_/_getMatchData.d.ts.map +1 -0
- package/esm/_/_getMatchData.js +46 -0
- package/esm/_/_getRawTag.d.ts +43 -0
- package/esm/_/_getRawTag.d.ts.map +1 -0
- package/esm/_/_getRawTag.js +65 -0
- package/esm/_/_hasPath.d.ts +13 -0
- package/esm/_/_hasPath.d.ts.map +1 -0
- package/esm/_/_hasPath.js +70 -0
- package/esm/_/_isIndex.d.ts +11 -0
- package/esm/_/_isIndex.d.ts.map +1 -0
- package/esm/_/_isIndex.js +51 -0
- package/esm/_/_isIterateeCall.d.ts +13 -0
- package/esm/_/_isIterateeCall.d.ts.map +1 -0
- package/esm/_/_isIterateeCall.js +55 -0
- package/esm/_/_isKey.d.ts +12 -0
- package/esm/_/_isKey.d.ts.map +1 -0
- package/esm/_/_isKey.js +58 -0
- package/esm/_/_isPrototype.d.ts +39 -0
- package/esm/_/_isPrototype.d.ts.map +1 -0
- package/esm/_/_isPrototype.js +43 -0
- package/esm/_/_isStrictComparable.d.ts +9 -0
- package/esm/_/_isStrictComparable.d.ts.map +1 -0
- package/esm/_/_isStrictComparable.js +42 -0
- package/esm/_/_matchesStrictComparable.d.ts +41 -0
- package/esm/_/_matchesStrictComparable.d.ts.map +1 -0
- package/esm/_/_matchesStrictComparable.js +50 -0
- package/esm/_/_stringToPath.d.ts +10 -0
- package/esm/_/_stringToPath.d.ts.map +1 -0
- package/esm/_/_stringToPath.js +64 -0
- package/esm/_/_toKey.d.ts +9 -0
- package/esm/_/_toKey.d.ts.map +1 -0
- package/esm/_/_toKey.js +46 -0
- package/esm/_/cloneDeep.d.ts +14 -0
- package/esm/_/cloneDeep.d.ts.map +1 -0
- package/esm/_/cloneDeep.js +47 -0
- package/esm/_/compact.d.ts +46 -0
- package/esm/_/compact.d.ts.map +1 -0
- package/esm/_/compact.js +23 -0
- package/esm/_/debounce.d.ts +70 -0
- package/esm/_/debounce.d.ts.map +1 -0
- package/esm/_/debounce.js +136 -0
- package/esm/_/eq.d.ts +41 -0
- package/esm/_/eq.d.ts.map +1 -0
- package/esm/_/eq.js +43 -0
- package/esm/_/groupBy.d.ts +19 -0
- package/esm/_/groupBy.d.ts.map +1 -0
- package/esm/_/groupBy.js +49 -0
- package/esm/_/isArguments.d.ts +9 -0
- package/esm/_/isArguments.d.ts.map +1 -0
- package/esm/_/isArguments.js +45 -0
- package/esm/_/isArrayLike.d.ts +25 -0
- package/esm/_/isArrayLike.d.ts.map +1 -0
- package/esm/_/isArrayLike.js +35 -0
- package/esm/_/isEmpty.d.ts +49 -0
- package/esm/_/isEmpty.d.ts.map +1 -0
- package/esm/_/isEmpty.js +57 -0
- package/esm/_/isEqual.d.ts +15 -0
- package/esm/_/isEqual.d.ts.map +1 -0
- package/esm/_/isEqual.js +48 -0
- package/esm/_/isLength.d.ts +41 -0
- package/esm/_/isLength.d.ts.map +1 -0
- package/esm/_/isLength.js +43 -0
- package/esm/_/isObject.d.ts +40 -0
- package/esm/_/isObject.d.ts.map +1 -0
- package/esm/_/isObject.js +42 -0
- package/esm/_/isObjectLike.d.ts +40 -0
- package/esm/_/isObjectLike.d.ts.map +1 -0
- package/esm/_/isObjectLike.js +42 -0
- package/esm/_/isPlainObject.d.ts +10 -0
- package/esm/_/isPlainObject.d.ts.map +1 -0
- package/esm/_/isPlainObject.js +58 -0
- package/esm/_/isSymbol.d.ts +9 -0
- package/esm/_/isSymbol.d.ts.map +1 -0
- package/esm/_/isSymbol.js +45 -0
- package/esm/_/isTypedArray.d.ts +43 -0
- package/esm/_/isTypedArray.d.ts.map +1 -0
- package/esm/_/isTypedArray.js +45 -0
- package/esm/_/omit.d.ts +31 -0
- package/esm/_/omit.d.ts.map +1 -0
- package/esm/_/omit.js +76 -0
- package/esm/_/range.d.ts +24 -0
- package/esm/_/range.d.ts.map +1 -0
- package/esm/_/range.js +56 -0
- package/esm/_/set.d.ts +25 -0
- package/esm/_/set.d.ts.map +1 -0
- package/esm/_/set.js +35 -0
- package/esm/_/toFinite.d.ts +40 -0
- package/esm/_/toFinite.d.ts.map +1 -0
- package/esm/_/toFinite.js +50 -0
- package/esm/_/types.d.ts +70 -0
- package/esm/_/types.d.ts.map +1 -0
- package/esm/_/types.js +2 -0
- package/esm/_/uniqBy.d.ts +13 -0
- package/esm/_/uniqBy.d.ts.map +1 -0
- package/esm/_/uniqBy.js +49 -0
- package/esm/index.d.ts +11 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +11 -0
- package/esm/util.d.ts +337 -0
- package/package.json +3 -3
|
@@ -0,0 +1,278 @@
|
|
|
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 { _baseGetTag } from "./_baseGetTag.js";
|
|
33
|
+
import { _getAllKeys } from "./_getAllKeys.js";
|
|
34
|
+
import { _eq } from "./eq.js";
|
|
35
|
+
import { _isObjectLike } from "./isObjectLike.js";
|
|
36
|
+
import { _isTypedArray } from "./isTypedArray.js";
|
|
37
|
+
/** `Object#toString` result references. */
|
|
38
|
+
const ARGS_TAG = "[object Arguments]";
|
|
39
|
+
const ARRAY_TAG = "[object Array]";
|
|
40
|
+
const OBJECT_TAG = "[object Object]";
|
|
41
|
+
const ARRAY_BUFFER_TAG = "[object ArrayBuffer]";
|
|
42
|
+
const BOOL_TAG = "[object Boolean]";
|
|
43
|
+
const DATA_VIEW_TAG = "[object DataView]";
|
|
44
|
+
const DATE_TAG = "[object Date]";
|
|
45
|
+
const ERROR_TAG = "[object Error]";
|
|
46
|
+
const MAP_TAG = "[object Map]";
|
|
47
|
+
const NUMBER_TAG = "[object Number]";
|
|
48
|
+
const REGEXP_TAG = "[object RegExp]";
|
|
49
|
+
const SET_TAG = "[object Set]";
|
|
50
|
+
const STRING_TAG = "[object String]";
|
|
51
|
+
const SYMBOL_TAG = "[object Symbol]";
|
|
52
|
+
const DEFAULT_OPTIONS = { unordered: false, partial: false };
|
|
53
|
+
/**
|
|
54
|
+
* The base implementation of `_isEqual` which tracks traversed objects.
|
|
55
|
+
*
|
|
56
|
+
* @param value - The value to compare.
|
|
57
|
+
* @param other - The other value to compare.
|
|
58
|
+
* @param options - See {@link _CompareOptions}; both flags default to `false`.
|
|
59
|
+
* @param stack - Tracks traversed `value` and `other` objects.
|
|
60
|
+
* @returns Returns `true` if the values are equivalent, else `false`.
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
export function _baseIsEqual(value, other, options = DEFAULT_OPTIONS, stack = new Map()) {
|
|
64
|
+
if (value === other) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
if (value == null || other == null || (!_isObjectLike(value) && !_isObjectLike(other))) {
|
|
68
|
+
// the only value that is not equal to itself is NaN, so this is `NaN` versus `NaN`
|
|
69
|
+
return value !== value && other !== other;
|
|
70
|
+
}
|
|
71
|
+
const compare = { ...DEFAULT_OPTIONS, ...options };
|
|
72
|
+
return _baseIsEqualDeep(value, other, compare, stack);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Deep comparison of two non-primitive (or one boxed-primitive) values by their `toStringTag`.
|
|
76
|
+
*/
|
|
77
|
+
function _baseIsEqualDeep(object, other, options, stack) {
|
|
78
|
+
const objIsArr = Array.isArray(object);
|
|
79
|
+
const othIsArr = Array.isArray(other);
|
|
80
|
+
let objTag = objIsArr ? ARRAY_TAG : _baseGetTag(object);
|
|
81
|
+
let othTag = othIsArr ? ARRAY_TAG : _baseGetTag(other);
|
|
82
|
+
// arguments objects are compared like plain objects
|
|
83
|
+
objTag = objTag === ARGS_TAG ? OBJECT_TAG : objTag;
|
|
84
|
+
othTag = othTag === ARGS_TAG ? OBJECT_TAG : othTag;
|
|
85
|
+
const objIsObj = objTag === OBJECT_TAG;
|
|
86
|
+
const othIsObj = othTag === OBJECT_TAG;
|
|
87
|
+
const isSameTag = objTag === othTag;
|
|
88
|
+
if (isSameTag && !objIsObj) {
|
|
89
|
+
return objIsArr || _isTypedArray(object)
|
|
90
|
+
? _equalArrays(object, other, options, stack)
|
|
91
|
+
: _equalByTag(object, other, objTag, options, stack);
|
|
92
|
+
}
|
|
93
|
+
// lodash chain wrappers are compared by the value they wrap; kept for parity with lodash
|
|
94
|
+
if (!options.partial) {
|
|
95
|
+
const objIsWrapped = objIsObj && Object.hasOwn(object, "__wrapped__");
|
|
96
|
+
const othIsWrapped = othIsObj && Object.hasOwn(other, "__wrapped__");
|
|
97
|
+
if (objIsWrapped || othIsWrapped) {
|
|
98
|
+
const objUnwrapped = objIsWrapped ? object.value() : object;
|
|
99
|
+
const othUnwrapped = othIsWrapped ? other.value() : other;
|
|
100
|
+
return _baseIsEqual(objUnwrapped, othUnwrapped, options, stack);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (!isSameTag) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
return _equalObjects(object, other, options, stack);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Compares arrays and typed arrays element by element, or in any order when `unordered` is set.
|
|
110
|
+
* A partial comparison lets `other` be longer than `array`.
|
|
111
|
+
*/
|
|
112
|
+
function _equalArrays(array, other, options, stack) {
|
|
113
|
+
const length = array.length;
|
|
114
|
+
if (length !== other.length && !(options.partial && other.length > length)) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
const arrStacked = stack.get(array);
|
|
118
|
+
const othStacked = stack.get(other);
|
|
119
|
+
if (arrStacked && othStacked) {
|
|
120
|
+
return arrStacked === other && othStacked === array;
|
|
121
|
+
}
|
|
122
|
+
stack.set(array, other);
|
|
123
|
+
stack.set(other, array);
|
|
124
|
+
// indices of `other` already matched to an element of `array`, only tracked for unordered comparison
|
|
125
|
+
const seen = options.unordered ? new Set() : undefined;
|
|
126
|
+
let result = true;
|
|
127
|
+
for (let index = 0; index < length; index++) {
|
|
128
|
+
const arrValue = array[index];
|
|
129
|
+
if (seen) {
|
|
130
|
+
let matched = false;
|
|
131
|
+
for (let othIndex = 0; othIndex < other.length; othIndex++) {
|
|
132
|
+
const othValue = other[othIndex];
|
|
133
|
+
if (!seen.has(othIndex) &&
|
|
134
|
+
(arrValue === othValue || _baseIsEqual(arrValue, othValue, options, stack))) {
|
|
135
|
+
seen.add(othIndex);
|
|
136
|
+
matched = true;
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (!matched) {
|
|
141
|
+
result = false;
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
const othValue = other[index];
|
|
147
|
+
if (!(arrValue === othValue || _baseIsEqual(arrValue, othValue, options, stack))) {
|
|
148
|
+
result = false;
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
stack.delete(array);
|
|
154
|
+
stack.delete(other);
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Compares two array buffers byte by byte.
|
|
159
|
+
*/
|
|
160
|
+
function _equalArrayBuffers(object, other) {
|
|
161
|
+
if (object.byteLength !== other.byteLength) {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
const objBytes = new Uint8Array(object);
|
|
165
|
+
const othBytes = new Uint8Array(other);
|
|
166
|
+
for (let index = 0; index < objBytes.length; index++) {
|
|
167
|
+
if (objBytes[index] !== othBytes[index]) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Compares two values that share one of the supported `toStringTag`s. Any other tag is not comparable
|
|
175
|
+
* and yields `false`, which covers weak collections, promises and host objects.
|
|
176
|
+
*/
|
|
177
|
+
function _equalByTag(object, other, tag, options, stack) {
|
|
178
|
+
switch (tag) {
|
|
179
|
+
case DATA_VIEW_TAG: {
|
|
180
|
+
const objView = object;
|
|
181
|
+
const othView = other;
|
|
182
|
+
if (objView.byteLength !== othView.byteLength || objView.byteOffset !== othView.byteOffset) {
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
return _equalArrayBuffers(objView.buffer, othView.buffer);
|
|
186
|
+
}
|
|
187
|
+
case ARRAY_BUFFER_TAG:
|
|
188
|
+
return _equalArrayBuffers(object, other);
|
|
189
|
+
case BOOL_TAG:
|
|
190
|
+
case DATE_TAG:
|
|
191
|
+
case NUMBER_TAG:
|
|
192
|
+
// booleans become 1 or 0, dates their milliseconds, invalid dates NaN; `_eq` makes NaN equal NaN
|
|
193
|
+
return _eq(Number(object), Number(other));
|
|
194
|
+
case ERROR_TAG: {
|
|
195
|
+
const objError = object;
|
|
196
|
+
const othError = other;
|
|
197
|
+
return objError.name === othError.name && objError.message === othError.message;
|
|
198
|
+
}
|
|
199
|
+
case REGEXP_TAG:
|
|
200
|
+
case STRING_TAG:
|
|
201
|
+
// regexes compare by their source and flags, strings by content whether boxed or primitive
|
|
202
|
+
return String(object) === String(other);
|
|
203
|
+
case MAP_TAG:
|
|
204
|
+
case SET_TAG: {
|
|
205
|
+
const objCollection = object;
|
|
206
|
+
const othCollection = other;
|
|
207
|
+
if (objCollection.size !== othCollection.size && !options.partial) {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
const stacked = stack.get(objCollection);
|
|
211
|
+
if (stacked) {
|
|
212
|
+
return stacked === othCollection;
|
|
213
|
+
}
|
|
214
|
+
stack.set(objCollection, othCollection);
|
|
215
|
+
// entries (maps) or values (sets) are matched in any order
|
|
216
|
+
const result = _equalArrays([...objCollection], [...othCollection], { unordered: true, partial: options.partial }, stack);
|
|
217
|
+
stack.delete(objCollection);
|
|
218
|
+
return result;
|
|
219
|
+
}
|
|
220
|
+
case SYMBOL_TAG:
|
|
221
|
+
return object.valueOf() === other.valueOf();
|
|
222
|
+
}
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Compares two plain objects by their own enumerable string and symbol keys, then by constructor.
|
|
227
|
+
* A partial comparison only requires `other` to have every key of `object`, own or inherited, and
|
|
228
|
+
* skips the constructor check.
|
|
229
|
+
*/
|
|
230
|
+
function _equalObjects(object, other, options, stack) {
|
|
231
|
+
const objProps = _getAllKeys(object);
|
|
232
|
+
const othProps = _getAllKeys(other);
|
|
233
|
+
if (objProps.length !== othProps.length && !options.partial) {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
for (const key of objProps) {
|
|
237
|
+
if (!(options.partial ? key in other : Object.hasOwn(other, key))) {
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
const objStacked = stack.get(object);
|
|
242
|
+
const othStacked = stack.get(other);
|
|
243
|
+
if (objStacked && othStacked) {
|
|
244
|
+
return objStacked === other && othStacked === object;
|
|
245
|
+
}
|
|
246
|
+
stack.set(object, other);
|
|
247
|
+
stack.set(other, object);
|
|
248
|
+
const objRecord = object;
|
|
249
|
+
const othRecord = other;
|
|
250
|
+
let result = true;
|
|
251
|
+
let skipCtor = options.partial;
|
|
252
|
+
for (const key of objProps) {
|
|
253
|
+
const objValue = objRecord[key];
|
|
254
|
+
const othValue = othRecord[key];
|
|
255
|
+
if (!(objValue === othValue || _baseIsEqual(objValue, othValue, options, stack))) {
|
|
256
|
+
result = false;
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
skipCtor ||= key === "constructor";
|
|
260
|
+
}
|
|
261
|
+
if (result && !skipCtor) {
|
|
262
|
+
const objCtor = object.constructor;
|
|
263
|
+
const othCtor = other.constructor;
|
|
264
|
+
// non-`Object` instances with different constructors are not equal
|
|
265
|
+
if (objCtor !== othCtor &&
|
|
266
|
+
"constructor" in object &&
|
|
267
|
+
"constructor" in other &&
|
|
268
|
+
!(typeof objCtor === "function" &&
|
|
269
|
+
objCtor instanceof objCtor &&
|
|
270
|
+
typeof othCtor === "function" &&
|
|
271
|
+
othCtor instanceof othCtor)) {
|
|
272
|
+
result = false;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
stack.delete(object);
|
|
276
|
+
stack.delete(other);
|
|
277
|
+
return result;
|
|
278
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { _MatchData } from "./_getMatchData.js";
|
|
2
|
+
/**
|
|
3
|
+
* The base implementation of `isMatch` without support for iteratee shorthands: whether `object` has
|
|
4
|
+
* every property described by `matchData`, comparing strictly where the source value allows it and
|
|
5
|
+
* by a partial, unordered deep comparison otherwise.
|
|
6
|
+
*
|
|
7
|
+
* @param object - The object to inspect.
|
|
8
|
+
* @param matchData - The property names, values, and compare flags to match.
|
|
9
|
+
* @returns Returns `true` if `object` is a match, else `false`.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function _baseIsMatch(object: unknown, matchData: _MatchData[]): boolean;
|
|
13
|
+
//# sourceMappingURL=_baseIsMatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_baseIsMatch.d.ts","sourceRoot":"","sources":["../../src/_/_baseIsMatch.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,OAAO,CA4B9E"}
|
|
@@ -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 { _baseIsEqual } from "./_baseIsEqual.js";
|
|
33
|
+
/**
|
|
34
|
+
* The base implementation of `isMatch` without support for iteratee shorthands: whether `object` has
|
|
35
|
+
* every property described by `matchData`, comparing strictly where the source value allows it and
|
|
36
|
+
* by a partial, unordered deep comparison otherwise.
|
|
37
|
+
*
|
|
38
|
+
* @param object - The object to inspect.
|
|
39
|
+
* @param matchData - The property names, values, and compare flags to match.
|
|
40
|
+
* @returns Returns `true` if `object` is a match, else `false`.
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
export function _baseIsMatch(object, matchData) {
|
|
44
|
+
if (object == null) {
|
|
45
|
+
return matchData.length === 0;
|
|
46
|
+
}
|
|
47
|
+
const target = Object(object);
|
|
48
|
+
// cheap presence and strict-value pass first, so a deep comparison only runs on candidates
|
|
49
|
+
for (const [key, srcValue, isStrict] of matchData) {
|
|
50
|
+
if (isStrict ? srcValue !== target[key] : !(key in target)) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
for (const [key, srcValue, isStrict] of matchData) {
|
|
55
|
+
const objValue = target[key];
|
|
56
|
+
if (isStrict) {
|
|
57
|
+
// an `undefined` source value only matches a key that actually exists
|
|
58
|
+
if (objValue === undefined && !(key in target)) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else if (!_baseIsEqual(srcValue, objValue, { partial: true, unordered: true })) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The base implementation of `iteratee`: turns any of lodash's iteratee shorthands into a function.
|
|
3
|
+
*
|
|
4
|
+
* - a function is returned as is
|
|
5
|
+
* - `null` or `undefined` becomes the identity function
|
|
6
|
+
* - an array `[path, value]` becomes a `matchesProperty` predicate
|
|
7
|
+
* - any other object becomes a `matches` predicate
|
|
8
|
+
* - anything else is a property name or path and becomes a `property` accessor
|
|
9
|
+
*
|
|
10
|
+
* @param value - The value to convert to an iteratee.
|
|
11
|
+
* @returns Returns the iteratee.
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare function _baseIteratee(value: unknown): (object: unknown) => unknown;
|
|
15
|
+
//# sourceMappingURL=_baseIteratee.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_baseIteratee.d.ts","sourceRoot":"","sources":["../../src/_/_baseIteratee.ts"],"names":[],"mappings":"AAuCA;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAoB1E"}
|
|
@@ -0,0 +1,65 @@
|
|
|
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 { _baseMatches } from "./_baseMatches.js";
|
|
34
|
+
import { _baseMatchesProperty } from "./_baseMatchesProperty.js";
|
|
35
|
+
import { _isKey } from "./_isKey.js";
|
|
36
|
+
import { _toKey } from "./_toKey.js";
|
|
37
|
+
/**
|
|
38
|
+
* The base implementation of `iteratee`: turns any of lodash's iteratee shorthands into a function.
|
|
39
|
+
*
|
|
40
|
+
* - a function is returned as is
|
|
41
|
+
* - `null` or `undefined` becomes the identity function
|
|
42
|
+
* - an array `[path, value]` becomes a `matchesProperty` predicate
|
|
43
|
+
* - any other object becomes a `matches` predicate
|
|
44
|
+
* - anything else is a property name or path and becomes a `property` accessor
|
|
45
|
+
*
|
|
46
|
+
* @param value - The value to convert to an iteratee.
|
|
47
|
+
* @returns Returns the iteratee.
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
export function _baseIteratee(value) {
|
|
51
|
+
if (typeof value === "function") {
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
if (value == null) {
|
|
55
|
+
return (object) => object;
|
|
56
|
+
}
|
|
57
|
+
if (typeof value === "object") {
|
|
58
|
+
return Array.isArray(value) ? _baseMatchesProperty(value[0], value[1]) : _baseMatches(value);
|
|
59
|
+
}
|
|
60
|
+
if (_isKey(value)) {
|
|
61
|
+
const key = _toKey(value);
|
|
62
|
+
return (object) => (object == null ? undefined : object[key]);
|
|
63
|
+
}
|
|
64
|
+
return (object) => _baseGet(object, value);
|
|
65
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The base implementation of `keys` which doesn't treat sparse arrays as dense.
|
|
3
|
+
*
|
|
4
|
+
* Returns the own enumerable string keys of `object`. On a prototype object an enumerable `constructor`
|
|
5
|
+
* key is skipped, since it only exists because the prototype was replaced wholesale.
|
|
6
|
+
*
|
|
7
|
+
* @param object - The object to query.
|
|
8
|
+
* @returns Returns the array of property names.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare function _baseKeys(object: unknown): string[];
|
|
12
|
+
//# sourceMappingURL=_baseKeys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_baseKeys.d.ts","sourceRoot":"","sources":["../../src/_/_baseKeys.ts"],"names":[],"mappings":"AAmCA;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,CAInD"}
|
|
@@ -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 { _isPrototype } from "./_isPrototype.js";
|
|
33
|
+
/**
|
|
34
|
+
* The base implementation of `keys` which doesn't treat sparse arrays as dense.
|
|
35
|
+
*
|
|
36
|
+
* Returns the own enumerable string keys of `object`. On a prototype object an enumerable `constructor`
|
|
37
|
+
* key is skipped, since it only exists because the prototype was replaced wholesale.
|
|
38
|
+
*
|
|
39
|
+
* @param object - The object to query.
|
|
40
|
+
* @returns Returns the array of property names.
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
export function _baseKeys(object) {
|
|
44
|
+
const keys = Object.keys(Object(object));
|
|
45
|
+
return _isPrototype(object) ? keys.filter((key) => key !== "constructor") : keys;
|
|
46
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The base implementation of `matches` which doesn't clone `source`: creates a predicate that tells
|
|
3
|
+
* whether an object has the same values as `source` for all of `source`'s own enumerable keys.
|
|
4
|
+
*
|
|
5
|
+
* @param source - The object of property values to match.
|
|
6
|
+
* @returns Returns the new spec function.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare function _baseMatches(source: object): (object: unknown) => boolean;
|
|
10
|
+
//# sourceMappingURL=_baseMatches.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_baseMatches.d.ts","sourceRoot":"","sources":["../../src/_/_baseMatches.ts"],"names":[],"mappings":"AAqCA;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CASzE"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/*!
|
|
3
|
+
* Portions of this file are derived from Lodash.
|
|
4
|
+
* https://github.com/lodash/lodash
|
|
5
|
+
*
|
|
6
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
7
|
+
*
|
|
8
|
+
* Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
9
|
+
* DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
10
|
+
*
|
|
11
|
+
* Modifications Copyright (c) 2026 GoodData Corporation
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
14
|
+
* a copy of this software and associated documentation files (the
|
|
15
|
+
* "Software"), to deal in the Software without restriction, including
|
|
16
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
17
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
18
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
19
|
+
* the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be
|
|
22
|
+
* included in all copies or substantial portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
26
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
27
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
28
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
29
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
30
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
import { _baseIsMatch } from "./_baseIsMatch.js";
|
|
33
|
+
import { _getMatchData } from "./_getMatchData.js";
|
|
34
|
+
import { _matchesStrictComparable } from "./_matchesStrictComparable.js";
|
|
35
|
+
/**
|
|
36
|
+
* The base implementation of `matches` which doesn't clone `source`: creates a predicate that tells
|
|
37
|
+
* whether an object has the same values as `source` for all of `source`'s own enumerable keys.
|
|
38
|
+
*
|
|
39
|
+
* @param source - The object of property values to match.
|
|
40
|
+
* @returns Returns the new spec function.
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
export function _baseMatches(source) {
|
|
44
|
+
const matchData = _getMatchData(source);
|
|
45
|
+
const [single] = matchData;
|
|
46
|
+
if (matchData.length === 1 && single?.[2]) {
|
|
47
|
+
return _matchesStrictComparable(single[0], single[1]);
|
|
48
|
+
}
|
|
49
|
+
return (object) => object === source || _baseIsMatch(object, matchData);
|
|
50
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The base implementation of `matchesProperty` which doesn't clone `srcValue`: creates a predicate
|
|
3
|
+
* that tells whether the value at `path` of an object matches `srcValue`.
|
|
4
|
+
*
|
|
5
|
+
* @param path - The path of the property to get.
|
|
6
|
+
* @param srcValue - The value to match.
|
|
7
|
+
* @returns Returns the new spec function.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare function _baseMatchesProperty(path: unknown, srcValue: unknown): (object: unknown) => boolean;
|
|
11
|
+
//# sourceMappingURL=_baseMatchesProperty.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_baseMatchesProperty.d.ts","sourceRoot":"","sources":["../../src/_/_baseMatchesProperty.ts"],"names":[],"mappings":"AAyCA;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAanG"}
|
|
@@ -0,0 +1,59 @@
|
|
|
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 { _baseIsEqual } from "./_baseIsEqual.js";
|
|
34
|
+
import { _hasPath } from "./_hasPath.js";
|
|
35
|
+
import { _isKey } from "./_isKey.js";
|
|
36
|
+
import { _isStrictComparable } from "./_isStrictComparable.js";
|
|
37
|
+
import { _matchesStrictComparable } from "./_matchesStrictComparable.js";
|
|
38
|
+
import { _toKey } from "./_toKey.js";
|
|
39
|
+
/**
|
|
40
|
+
* The base implementation of `matchesProperty` which doesn't clone `srcValue`: creates a predicate
|
|
41
|
+
* that tells whether the value at `path` of an object matches `srcValue`.
|
|
42
|
+
*
|
|
43
|
+
* @param path - The path of the property to get.
|
|
44
|
+
* @param srcValue - The value to match.
|
|
45
|
+
* @returns Returns the new spec function.
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
export function _baseMatchesProperty(path, srcValue) {
|
|
49
|
+
if (_isKey(path) && _isStrictComparable(srcValue)) {
|
|
50
|
+
return _matchesStrictComparable(_toKey(path), srcValue);
|
|
51
|
+
}
|
|
52
|
+
return (object) => {
|
|
53
|
+
const objValue = object == null ? undefined : _baseGet(object, path);
|
|
54
|
+
// an `undefined` source value only matches a path that actually exists, own or inherited
|
|
55
|
+
return objValue === undefined && objValue === srcValue
|
|
56
|
+
? _hasPath(object, path, (target, key) => key in target)
|
|
57
|
+
: _baseIsEqual(srcValue, objValue, { partial: true, unordered: true });
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The base implementation of `set`.
|
|
3
|
+
*
|
|
4
|
+
* @param object - The object to modify.
|
|
5
|
+
* @param path - The path of the property to set.
|
|
6
|
+
* @param value - The value to set.
|
|
7
|
+
* @returns Returns `object`.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare function _baseSet(object: unknown, path: unknown, value: unknown): unknown;
|
|
11
|
+
//# sourceMappingURL=_baseSet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_baseSet.d.ts","sourceRoot":"","sources":["../../src/_/_baseSet.ts"],"names":[],"mappings":"AAuCA;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CA8BhF"}
|