@domql/utils 2.5.76 → 2.5.81

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.
@@ -20,7 +20,6 @@ var object_exports = {};
20
20
  __export(object_exports, {
21
21
  clone: () => clone,
22
22
  deepClone: () => deepClone,
23
- deepCloneEntrance: () => deepCloneEntrance,
24
23
  deepCloneExclude: () => deepCloneExclude,
25
24
  deepCloneWithExtend: () => deepCloneWithExtend,
26
25
  deepContains: () => deepContains,
@@ -136,6 +135,8 @@ const mergeArrayExclude = (arr, excl = []) => {
136
135
  const deepClone = (obj, excludeFrom = [], cleanUndefined = false) => {
137
136
  const o = (0, import_types.isArray)(obj) ? [] : {};
138
137
  for (const prop in obj) {
138
+ if (!Object.prototype.hasOwnProperty.call(obj, prop))
139
+ continue;
139
140
  if (prop === "__proto__")
140
141
  continue;
141
142
  if (excludeFrom.includes(prop) || prop.startsWith("__"))
@@ -153,21 +154,13 @@ const deepClone = (obj, excludeFrom = [], cleanUndefined = false) => {
153
154
  }
154
155
  return o;
155
156
  };
156
- const deepCloneEntrance = (...params) => {
157
- let extended;
158
- try {
159
- extended = deepCloneWithExtend(...params);
160
- } catch {
161
- console.log("HERE", extended);
162
- }
163
- return extended;
164
- };
165
157
  const deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}) => {
166
158
  const o = (0, import_types.isArray)(obj) ? [] : {};
167
159
  for (const prop in obj) {
168
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, prop);
160
+ if (!Object.prototype.hasOwnProperty.call(obj, prop))
161
+ continue;
169
162
  const objProp = obj[prop];
170
- if (!hasOwnProperty2 || excludeFrom.includes(prop) || prop.startsWith("__") || options.cleanUndefined && (0, import_types.isUndefined)(objProp) || options.cleanNull && (0, import_types.isNull)(objProp))
163
+ if (excludeFrom.includes(prop) || prop.startsWith("__") || options.cleanUndefined && (0, import_types.isUndefined)(objProp) || options.cleanNull && (0, import_types.isNull)(objProp))
171
164
  continue;
172
165
  if ((0, import_types.isObjectLike)(objProp)) {
173
166
  o[prop] = deepCloneWithExtend(objProp, excludeFrom, options);
package/object.js CHANGED
@@ -98,6 +98,11 @@ export const mergeArrayExclude = (arr, excl = []) => {
98
98
  export const deepClone = (obj, excludeFrom = [], cleanUndefined = false) => {
99
99
  const o = isArray(obj) ? [] : {}
100
100
  for (const prop in obj) {
101
+ if (!Object.prototype.hasOwnProperty.call(obj, prop)) continue
102
+ // if (prop === 'node' || prop === 'parent' || prop === 'root' || prop === '__element') {
103
+ // console.warn('recursive clonning is called', obj)
104
+ // continue
105
+ // }
101
106
  if (prop === '__proto__') continue
102
107
  if (excludeFrom.includes(prop) || prop.startsWith('__')) continue
103
108
  let objProp = obj[prop]
@@ -106,39 +111,35 @@ export const deepClone = (obj, excludeFrom = [], cleanUndefined = false) => {
106
111
  objProp = mergeArray(objProp)
107
112
  }
108
113
  if (isObjectLike(objProp)) {
114
+ // queueMicrotask(() => {
109
115
  o[prop] = deepClone(objProp, excludeFrom, cleanUndefined)
116
+ // })
110
117
  } else o[prop] = objProp
111
118
  }
112
119
  return o
113
120
  }
121
+
114
122
  /**
115
123
  * Deep cloning of object
116
124
  */
117
- export const deepCloneEntrance = (...params) => {
118
- // console.groupCollapsed('deepCloneEntrance')
119
- // console.warn(params)
120
- let extended
121
- try {
122
- extended = deepCloneWithExtend(...params)
123
- } catch {
124
- console.log('HERE', extended)
125
- }
126
- // console.groupEnd('deepCloneEntrance')
127
- return extended
128
- }
129
-
130
125
  export const deepCloneWithExtend = (obj, excludeFrom = ['node'], options = {}) => {
131
126
  const o = isArray(obj) ? [] : {}
132
127
  for (const prop in obj) {
133
- const hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, prop)
128
+ if (!Object.prototype.hasOwnProperty.call(obj, prop)) continue
129
+ // if (prop === 'node' || prop === 'parent' || prop === 'root' || prop === '__element') {
130
+ // console.warn('recursive clonning is called', obj)
131
+ // continue
132
+ // }
134
133
  const objProp = obj[prop]
135
134
  if (
136
- !hasOwnProperty || excludeFrom.includes(prop) || prop.startsWith('__') ||
135
+ excludeFrom.includes(prop) || prop.startsWith('__') ||
137
136
  (options.cleanUndefined && isUndefined(objProp)) ||
138
137
  (options.cleanNull && isNull(objProp))
139
138
  ) continue
140
139
  if (isObjectLike(objProp)) {
140
+ // queueMicrotask(() => {
141
141
  o[prop] = deepCloneWithExtend(objProp, excludeFrom, options)
142
+ // })
142
143
  } else o[prop] = objProp
143
144
  }
144
145
  return o
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/utils",
3
- "version": "2.5.76",
3
+ "version": "2.5.81",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "index.js",
@@ -23,7 +23,7 @@
23
23
  "build": "yarn build:cjs",
24
24
  "prepublish": "rimraf -I dist && yarn build && yarn copy:package:cjs"
25
25
  },
26
- "gitHead": "767e48d9adb22095984c0feb21fd92f045cdfe4a",
26
+ "gitHead": "450e26c2ab4a2646dd0f51bd412b9152bff9c898",
27
27
  "devDependencies": {
28
28
  "@babel/core": "^7.12.0"
29
29
  }