@domql/utils 3.4.11 → 3.5.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/dist/cjs/object.js +8 -8
- package/dist/esm/object.js +8 -8
- package/dist/iife/index.js +8 -8
- package/object.js +6 -6
- package/package.json +1 -1
package/dist/cjs/object.js
CHANGED
|
@@ -23,9 +23,9 @@ __export(object_exports, {
|
|
|
23
23
|
createObjectWithoutPrototype: () => createObjectWithoutPrototype,
|
|
24
24
|
deepClone: () => deepClone,
|
|
25
25
|
deepContains: () => deepContains,
|
|
26
|
-
|
|
26
|
+
deepDestringifyFunctions: () => deepDestringifyFunctions,
|
|
27
27
|
deepMerge: () => deepMerge,
|
|
28
|
-
|
|
28
|
+
deepStringifyFunctions: () => deepStringifyFunctions,
|
|
29
29
|
detectInfiniteLoop: () => detectInfiniteLoop,
|
|
30
30
|
excludeKeysFromObject: () => excludeKeysFromObject,
|
|
31
31
|
exec: () => exec,
|
|
@@ -171,7 +171,7 @@ const deepClone = (obj, options = {}) => {
|
|
|
171
171
|
}
|
|
172
172
|
return clone2;
|
|
173
173
|
};
|
|
174
|
-
const
|
|
174
|
+
const deepStringifyFunctions = (obj, stringified = {}) => {
|
|
175
175
|
if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
|
|
176
176
|
;
|
|
177
177
|
(obj.__element || obj.parent?.__element).warn(
|
|
@@ -186,14 +186,14 @@ const deepStringify = (obj, stringified = {}) => {
|
|
|
186
186
|
stringified[prop] = objProp.toString();
|
|
187
187
|
} else if ((0, import_types.isObject)(objProp)) {
|
|
188
188
|
stringified[prop] = {};
|
|
189
|
-
|
|
189
|
+
deepStringifyFunctions(objProp, stringified[prop]);
|
|
190
190
|
} else if ((0, import_types.isArray)(objProp)) {
|
|
191
191
|
const arr = stringified[prop] = [];
|
|
192
192
|
for (let i = 0; i < objProp.length; i++) {
|
|
193
193
|
const v = objProp[i];
|
|
194
194
|
if ((0, import_types.isObject)(v)) {
|
|
195
195
|
arr[i] = {};
|
|
196
|
-
|
|
196
|
+
deepStringifyFunctions(v, arr[i]);
|
|
197
197
|
} else if ((0, import_types.isFunction)(v)) {
|
|
198
198
|
arr[i] = v.toString();
|
|
199
199
|
} else {
|
|
@@ -295,7 +295,7 @@ const hasFunction = (str) => {
|
|
|
295
295
|
if (RE_JSON_LIKE.test(trimmed) && !hasArrow) return false;
|
|
296
296
|
return true;
|
|
297
297
|
};
|
|
298
|
-
const
|
|
298
|
+
const deepDestringifyFunctions = (obj, destringified = {}) => {
|
|
299
299
|
for (const prop in obj) {
|
|
300
300
|
if (!Object.prototype.hasOwnProperty.call(obj, prop)) continue;
|
|
301
301
|
const objProp = obj[prop];
|
|
@@ -324,13 +324,13 @@ const deepDestringify = (obj, destringified = {}) => {
|
|
|
324
324
|
arr.push(arrProp);
|
|
325
325
|
}
|
|
326
326
|
} else if ((0, import_types.isObject)(arrProp)) {
|
|
327
|
-
arr.push(
|
|
327
|
+
arr.push(deepDestringifyFunctions(arrProp));
|
|
328
328
|
} else {
|
|
329
329
|
arr.push(arrProp);
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
332
|
} else if ((0, import_types.isObject)(objProp)) {
|
|
333
|
-
destringified[prop] =
|
|
333
|
+
destringified[prop] = deepDestringifyFunctions(objProp, destringified[prop]);
|
|
334
334
|
} else {
|
|
335
335
|
destringified[prop] = objProp;
|
|
336
336
|
}
|
package/dist/esm/object.js
CHANGED
|
@@ -127,7 +127,7 @@ const deepClone = (obj, options = {}) => {
|
|
|
127
127
|
}
|
|
128
128
|
return clone2;
|
|
129
129
|
};
|
|
130
|
-
const
|
|
130
|
+
const deepStringifyFunctions = (obj, stringified = {}) => {
|
|
131
131
|
if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
|
|
132
132
|
;
|
|
133
133
|
(obj.__element || obj.parent?.__element).warn(
|
|
@@ -142,14 +142,14 @@ const deepStringify = (obj, stringified = {}) => {
|
|
|
142
142
|
stringified[prop] = objProp.toString();
|
|
143
143
|
} else if (isObject(objProp)) {
|
|
144
144
|
stringified[prop] = {};
|
|
145
|
-
|
|
145
|
+
deepStringifyFunctions(objProp, stringified[prop]);
|
|
146
146
|
} else if (isArray(objProp)) {
|
|
147
147
|
const arr = stringified[prop] = [];
|
|
148
148
|
for (let i = 0; i < objProp.length; i++) {
|
|
149
149
|
const v = objProp[i];
|
|
150
150
|
if (isObject(v)) {
|
|
151
151
|
arr[i] = {};
|
|
152
|
-
|
|
152
|
+
deepStringifyFunctions(v, arr[i]);
|
|
153
153
|
} else if (isFunction(v)) {
|
|
154
154
|
arr[i] = v.toString();
|
|
155
155
|
} else {
|
|
@@ -251,7 +251,7 @@ const hasFunction = (str) => {
|
|
|
251
251
|
if (RE_JSON_LIKE.test(trimmed) && !hasArrow) return false;
|
|
252
252
|
return true;
|
|
253
253
|
};
|
|
254
|
-
const
|
|
254
|
+
const deepDestringifyFunctions = (obj, destringified = {}) => {
|
|
255
255
|
for (const prop in obj) {
|
|
256
256
|
if (!Object.prototype.hasOwnProperty.call(obj, prop)) continue;
|
|
257
257
|
const objProp = obj[prop];
|
|
@@ -280,13 +280,13 @@ const deepDestringify = (obj, destringified = {}) => {
|
|
|
280
280
|
arr.push(arrProp);
|
|
281
281
|
}
|
|
282
282
|
} else if (isObject(arrProp)) {
|
|
283
|
-
arr.push(
|
|
283
|
+
arr.push(deepDestringifyFunctions(arrProp));
|
|
284
284
|
} else {
|
|
285
285
|
arr.push(arrProp);
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
} else if (isObject(objProp)) {
|
|
289
|
-
destringified[prop] =
|
|
289
|
+
destringified[prop] = deepDestringifyFunctions(objProp, destringified[prop]);
|
|
290
290
|
} else {
|
|
291
291
|
destringified[prop] = objProp;
|
|
292
292
|
}
|
|
@@ -543,9 +543,9 @@ export {
|
|
|
543
543
|
createObjectWithoutPrototype,
|
|
544
544
|
deepClone,
|
|
545
545
|
deepContains,
|
|
546
|
-
|
|
546
|
+
deepDestringifyFunctions,
|
|
547
547
|
deepMerge,
|
|
548
|
-
|
|
548
|
+
deepStringifyFunctions,
|
|
549
549
|
detectInfiniteLoop,
|
|
550
550
|
excludeKeysFromObject,
|
|
551
551
|
exec,
|
package/dist/iife/index.js
CHANGED
|
@@ -87,11 +87,11 @@ var DomqlUtils = (() => {
|
|
|
87
87
|
decodeNewlines: () => decodeNewlines,
|
|
88
88
|
deepClone: () => deepClone,
|
|
89
89
|
deepContains: () => deepContains,
|
|
90
|
-
|
|
90
|
+
deepDestringifyFunctions: () => deepDestringifyFunctions,
|
|
91
91
|
deepExtend: () => deepExtend,
|
|
92
92
|
deepMerge: () => deepMerge,
|
|
93
93
|
deepMergeExtends: () => deepMergeExtends,
|
|
94
|
-
|
|
94
|
+
deepStringifyFunctions: () => deepStringifyFunctions,
|
|
95
95
|
defineSetter: () => defineSetter,
|
|
96
96
|
detectInfiniteLoop: () => detectInfiniteLoop,
|
|
97
97
|
document: () => document2,
|
|
@@ -829,7 +829,7 @@ var DomqlUtils = (() => {
|
|
|
829
829
|
}
|
|
830
830
|
return clone2;
|
|
831
831
|
};
|
|
832
|
-
var
|
|
832
|
+
var deepStringifyFunctions = (obj, stringified = {}) => {
|
|
833
833
|
if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
|
|
834
834
|
;
|
|
835
835
|
(obj.__element || obj.parent?.__element).warn(
|
|
@@ -844,14 +844,14 @@ var DomqlUtils = (() => {
|
|
|
844
844
|
stringified[prop] = objProp.toString();
|
|
845
845
|
} else if (isObject(objProp)) {
|
|
846
846
|
stringified[prop] = {};
|
|
847
|
-
|
|
847
|
+
deepStringifyFunctions(objProp, stringified[prop]);
|
|
848
848
|
} else if (isArray(objProp)) {
|
|
849
849
|
const arr = stringified[prop] = [];
|
|
850
850
|
for (let i = 0; i < objProp.length; i++) {
|
|
851
851
|
const v = objProp[i];
|
|
852
852
|
if (isObject(v)) {
|
|
853
853
|
arr[i] = {};
|
|
854
|
-
|
|
854
|
+
deepStringifyFunctions(v, arr[i]);
|
|
855
855
|
} else if (isFunction(v)) {
|
|
856
856
|
arr[i] = v.toString();
|
|
857
857
|
} else {
|
|
@@ -953,7 +953,7 @@ var DomqlUtils = (() => {
|
|
|
953
953
|
if (RE_JSON_LIKE.test(trimmed) && !hasArrow) return false;
|
|
954
954
|
return true;
|
|
955
955
|
};
|
|
956
|
-
var
|
|
956
|
+
var deepDestringifyFunctions = (obj, destringified = {}) => {
|
|
957
957
|
for (const prop in obj) {
|
|
958
958
|
if (!Object.prototype.hasOwnProperty.call(obj, prop)) continue;
|
|
959
959
|
const objProp = obj[prop];
|
|
@@ -982,13 +982,13 @@ var DomqlUtils = (() => {
|
|
|
982
982
|
arr.push(arrProp);
|
|
983
983
|
}
|
|
984
984
|
} else if (isObject(arrProp)) {
|
|
985
|
-
arr.push(
|
|
985
|
+
arr.push(deepDestringifyFunctions(arrProp));
|
|
986
986
|
} else {
|
|
987
987
|
arr.push(arrProp);
|
|
988
988
|
}
|
|
989
989
|
}
|
|
990
990
|
} else if (isObject(objProp)) {
|
|
991
|
-
destringified[prop] =
|
|
991
|
+
destringified[prop] = deepDestringifyFunctions(objProp, destringified[prop]);
|
|
992
992
|
} else {
|
|
993
993
|
destringified[prop] = objProp;
|
|
994
994
|
}
|
package/object.js
CHANGED
|
@@ -180,7 +180,7 @@ export const deepClone = (obj, options = {}) => {
|
|
|
180
180
|
/**
|
|
181
181
|
* Stringify object
|
|
182
182
|
*/
|
|
183
|
-
export const
|
|
183
|
+
export const deepStringifyFunctions = (obj, stringified = {}) => {
|
|
184
184
|
if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
|
|
185
185
|
;(obj.__element || obj.parent?.__element).warn(
|
|
186
186
|
'Trying to clone element or state at',
|
|
@@ -195,14 +195,14 @@ export const deepStringify = (obj, stringified = {}) => {
|
|
|
195
195
|
stringified[prop] = objProp.toString()
|
|
196
196
|
} else if (isObject(objProp)) {
|
|
197
197
|
stringified[prop] = {}
|
|
198
|
-
|
|
198
|
+
deepStringifyFunctions(objProp, stringified[prop])
|
|
199
199
|
} else if (isArray(objProp)) {
|
|
200
200
|
const arr = stringified[prop] = []
|
|
201
201
|
for (let i = 0; i < objProp.length; i++) {
|
|
202
202
|
const v = objProp[i]
|
|
203
203
|
if (isObject(v)) {
|
|
204
204
|
arr[i] = {}
|
|
205
|
-
|
|
205
|
+
deepStringifyFunctions(v, arr[i])
|
|
206
206
|
} else if (isFunction(v)) {
|
|
207
207
|
arr[i] = v.toString()
|
|
208
208
|
} else {
|
|
@@ -303,7 +303,7 @@ export const hasFunction = str => {
|
|
|
303
303
|
return true
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
export const
|
|
306
|
+
export const deepDestringifyFunctions = (obj, destringified = {}) => {
|
|
307
307
|
for (const prop in obj) {
|
|
308
308
|
if (!Object.prototype.hasOwnProperty.call(obj, prop)) continue
|
|
309
309
|
|
|
@@ -334,13 +334,13 @@ export const deepDestringify = (obj, destringified = {}) => {
|
|
|
334
334
|
arr.push(arrProp)
|
|
335
335
|
}
|
|
336
336
|
} else if (isObject(arrProp)) {
|
|
337
|
-
arr.push(
|
|
337
|
+
arr.push(deepDestringifyFunctions(arrProp))
|
|
338
338
|
} else {
|
|
339
339
|
arr.push(arrProp)
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
} else if (isObject(objProp)) {
|
|
343
|
-
destringified[prop] =
|
|
343
|
+
destringified[prop] = deepDestringifyFunctions(objProp, destringified[prop])
|
|
344
344
|
} else {
|
|
345
345
|
destringified[prop] = objProp
|
|
346
346
|
}
|