@domql/utils 2.3.27 → 2.3.29
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/node.js +11 -5
- package/object.js +6 -10
- package/package.json +2 -2
package/node.js
CHANGED
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
export const cleanWithNode = extend => delete extend.node && extend
|
|
4
4
|
|
|
5
|
-
export const createID = (function
|
|
6
|
-
let index =
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
export const createID = (function () {
|
|
6
|
+
let index = 0
|
|
7
|
+
|
|
8
|
+
function newId () {
|
|
9
|
+
index++
|
|
10
|
+
return index
|
|
9
11
|
}
|
|
10
|
-
|
|
12
|
+
|
|
13
|
+
return newId
|
|
14
|
+
})()
|
|
15
|
+
|
|
16
|
+
export const createSnapshotId = createID
|
package/object.js
CHANGED
|
@@ -109,12 +109,13 @@ export const deepStringify = (obj, stringified = {}) => {
|
|
|
109
109
|
const objProp = obj[prop]
|
|
110
110
|
if (isFunction(objProp)) {
|
|
111
111
|
stringified[prop] = objProp.toString()
|
|
112
|
+
} else if (isObject(objProp)) {
|
|
113
|
+
stringified[prop] = {}
|
|
114
|
+
deepStringify(objProp[prop], stringified[prop])
|
|
115
|
+
} else if (isArray(objProp)) {
|
|
116
|
+
stringified[prop] = []
|
|
117
|
+
objProp.map((v, i) => deepStringify(v, stringified[prop][i]))
|
|
112
118
|
} else stringified[prop] = objProp
|
|
113
|
-
// if (prop === 'src') {
|
|
114
|
-
// console.log(typeof stringified[prop])
|
|
115
|
-
// console.log(prop, stringified[prop])
|
|
116
|
-
// }
|
|
117
|
-
if (isObject(objProp)) deepStringify(stringified[prop], stringified[prop])
|
|
118
119
|
}
|
|
119
120
|
return stringified
|
|
120
121
|
}
|
|
@@ -127,15 +128,10 @@ export const deepDestringify = (obj, stringified = {}) => {
|
|
|
127
128
|
const objProp = obj[prop]
|
|
128
129
|
if (isString(objProp)) {
|
|
129
130
|
if (objProp.includes('=>') || objProp.includes('function') || objProp[0] === '(') {
|
|
130
|
-
// console.groupCollapsed(prop)
|
|
131
|
-
// console.log(obj)
|
|
132
|
-
// console.log(objProp)
|
|
133
131
|
try {
|
|
134
132
|
const evalProp = eval(objProp) // eslint-disable-line
|
|
135
|
-
// console.log(evalProp)
|
|
136
133
|
stringified[prop] = evalProp
|
|
137
134
|
} catch (e) { if (e) stringified[prop] = objProp }
|
|
138
|
-
// console.groupEnd(prop)
|
|
139
135
|
}
|
|
140
136
|
} else stringified[prop] = objProp
|
|
141
137
|
if (isObject(objProp)) deepDestringify(stringified[prop], stringified[prop])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/utils",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.29",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"module": "index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
"@domql/globals": "latest",
|
|
9
9
|
"@domql/tags": "latest"
|
|
10
10
|
},
|
|
11
|
-
"gitHead": "
|
|
11
|
+
"gitHead": "6ed7919e6dc65a6bc48b9711d2dd85afcffe4a17"
|
|
12
12
|
}
|