@domql/utils 2.5.94 → 2.5.95

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.
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var object_exports = {};
20
20
  __export(object_exports, {
21
21
  clone: () => clone,
22
+ createObjectWithoutPrototype: () => createObjectWithoutPrototype,
22
23
  deepClone: () => deepClone,
23
24
  deepCloneExclude: () => deepCloneExclude,
24
25
  deepCloneWithExtend: () => deepCloneWithExtend,
@@ -502,3 +503,15 @@ const removeFromObject = (obj, props) => {
502
503
  }
503
504
  return obj;
504
505
  };
506
+ const createObjectWithoutPrototype = (obj) => {
507
+ if (obj === null || typeof obj !== "object") {
508
+ return obj;
509
+ }
510
+ const newObj = /* @__PURE__ */ Object.create(null);
511
+ for (const key in obj) {
512
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
513
+ newObj[key] = createObjectWithoutPrototype(obj[key]);
514
+ }
515
+ }
516
+ return newObj;
517
+ };
package/object.js CHANGED
@@ -577,3 +577,19 @@ export const removeFromObject = (obj, props) => {
577
577
  }
578
578
  return obj
579
579
  }
580
+
581
+ export const createObjectWithoutPrototype = (obj) => {
582
+ if (obj === null || typeof obj !== 'object') {
583
+ return obj // Return the value if obj is not an object
584
+ }
585
+
586
+ const newObj = Object.create(null) // Create an object without prototype
587
+
588
+ for (const key in obj) {
589
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
590
+ newObj[key] = createObjectWithoutPrototype(obj[key]) // Recursively copy each property
591
+ }
592
+ }
593
+
594
+ return newObj
595
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/utils",
3
- "version": "2.5.94",
3
+ "version": "2.5.95",
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": "76edeab829524b706fd1a0bd3fac3fd5563a3b84",
26
+ "gitHead": "8ac5f539ad4739c7baa30dd68cb7d6f94e70aa3c",
27
27
  "devDependencies": {
28
28
  "@babel/core": "^7.12.0"
29
29
  }