@domql/utils 2.3.23 → 2.3.25

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.
Files changed (2) hide show
  1. package/object.js +12 -5
  2. package/package.json +3 -2
package/object.js CHANGED
@@ -25,7 +25,6 @@ export const merge = (element, obj) => {
25
25
  }
26
26
 
27
27
  export const deepMerge = (element, extend) => {
28
- // console.groupCollapsed('deepMerge:')
29
28
  for (const e in extend) {
30
29
  const elementProp = element[e]
31
30
  const extendProp = extend[e]
@@ -37,7 +36,6 @@ export const deepMerge = (element, extend) => {
37
36
  deepMerge(elementProp, extendProp)
38
37
  }
39
38
  }
40
- // console.groupEnd('deepMerge:')
41
39
  return element
42
40
  }
43
41
 
@@ -76,12 +74,15 @@ export const deepClone = (obj) => {
76
74
  * Stringify object
77
75
  */
78
76
  export const deepStringify = (obj, stringified = {}) => {
79
- console.log(obj)
80
77
  for (const prop in obj) {
81
78
  const objProp = obj[prop]
82
79
  if (isFunction(objProp)) {
83
80
  stringified[prop] = objProp.toString()
84
81
  } else stringified[prop] = objProp
82
+ // if (prop === 'src') {
83
+ // console.log(typeof stringified[prop])
84
+ // console.log(prop, stringified[prop])
85
+ // }
85
86
  if (isObject(objProp)) deepStringify(stringified[prop], stringified[prop])
86
87
  }
87
88
  return stringified
@@ -94,10 +95,16 @@ export const deepDestringify = (obj, stringified = {}) => {
94
95
  for (const prop in obj) {
95
96
  const objProp = obj[prop]
96
97
  if (isString(objProp)) {
97
- if (objProp.slice(0, 1) === '(') {
98
+ if (objProp.includes('=>') || objProp.includes('function') || objProp[0] === '(') {
99
+ // console.groupCollapsed(prop)
100
+ // console.log(obj)
101
+ // console.log(objProp)
98
102
  try {
99
- stringified[prop] = eval(objProp) // eslint-disable-line
103
+ const evalProp = eval(objProp) // eslint-disable-line
104
+ // console.log(evalProp)
105
+ stringified[prop] = evalProp
100
106
  } catch (e) { if (e) stringified[prop] = objProp }
107
+ // console.groupEnd(prop)
101
108
  }
102
109
  } else stringified[prop] = objProp
103
110
  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.23",
3
+ "version": "2.3.25",
4
4
  "main": "index.js",
5
+ "module": "index.js",
5
6
  "license": "MIT",
6
7
  "dependencies": {
7
8
  "@domql/globals": "latest",
8
9
  "@domql/tags": "latest"
9
10
  },
10
- "gitHead": "3757666fe613ef00cbdf7d020da4b27c8bf3fb54"
11
+ "gitHead": "134c075d1847795fe44805e1a7bb40608408fa4c"
11
12
  }