@domql/utils 2.3.26 → 2.3.28
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/LICENSE +21 -0
- package/object.js +7 -11
- package/package.json +3 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 rackai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/object.js
CHANGED
|
@@ -49,7 +49,7 @@ export const clone = obj => {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
// Clone anything deeply but exclude keys given in 'exclude'
|
|
52
|
-
export const deepCloneExclude(obj, exclude = []) {
|
|
52
|
+
export const deepCloneExclude = (obj, exclude = []) => {
|
|
53
53
|
if (isArray(obj)) {
|
|
54
54
|
return obj.map(x => deepCloneExclude(x, exclude))
|
|
55
55
|
}
|
|
@@ -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,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/utils",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.28",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"module": "index.js",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@domql/globals": "latest",
|
|
9
9
|
"@domql/tags": "latest"
|
|
10
|
-
}
|
|
10
|
+
},
|
|
11
|
+
"gitHead": "ce6edd557f212de49c3fd8419bb8421d28bb1d92"
|
|
11
12
|
}
|