@domql/utils 2.3.150 → 2.3.152

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/array.js CHANGED
@@ -45,37 +45,37 @@ export const mergeAndCloneIfArray = obj => {
45
45
  }
46
46
 
47
47
  export const cutArrayBeforeValue = (arr, value) => {
48
- const index = arr.indexOf(value);
48
+ const index = arr.indexOf(value)
49
49
  if (index !== -1) {
50
- return arr.slice(0, index);
50
+ return arr.slice(0, index)
51
51
  }
52
- return arr;
52
+ return arr
53
53
  }
54
54
 
55
55
  export const cutArrayAfterValue = (arr, value) => {
56
- const index = arr.indexOf(value);
56
+ const index = arr.indexOf(value)
57
57
  if (index !== -1) {
58
- return arr.slice(index + 1);
58
+ return arr.slice(index + 1)
59
59
  }
60
- return arr;
60
+ return arr
61
61
  }
62
62
 
63
63
  export const createNestedObject = (arr, lastValue) => {
64
- let nestedObject = {};
64
+ const nestedObject = {}
65
65
 
66
66
  if (arr.length === 0) {
67
- return lastValue;
67
+ return lastValue
68
68
  }
69
69
 
70
70
  arr.reduce((obj, value, index) => {
71
71
  if (!obj[value]) {
72
- obj[value] = {};
72
+ obj[value] = {}
73
73
  }
74
74
  if (index === arr.length - 1 && lastValue) {
75
- obj[value] = lastValue;
75
+ obj[value] = lastValue
76
76
  }
77
- return obj[value];
78
- }, nestedObject);
77
+ return obj[value]
78
+ }, nestedObject)
79
79
 
80
- return nestedObject;
80
+ return nestedObject
81
81
  }
package/dist/cjs/array.js CHANGED
@@ -76,7 +76,7 @@ const cutArrayAfterValue = (arr, value) => {
76
76
  return arr;
77
77
  };
78
78
  const createNestedObject = (arr, lastValue) => {
79
- let nestedObject = {};
79
+ const nestedObject = {};
80
80
  if (arr.length === 0) {
81
81
  return lastValue;
82
82
  }
@@ -64,6 +64,8 @@ const map = (obj, extention, element) => {
64
64
  };
65
65
  const merge = (element, obj, excludeFrom = []) => {
66
66
  for (const e in obj) {
67
+ if (e === "__proto__")
68
+ continue;
67
69
  if (excludeFrom.includes(e) || e.startsWith("__"))
68
70
  continue;
69
71
  const elementProp = element[e];
@@ -126,6 +128,8 @@ const mergeArrayExclude = (arr, excl = []) => {
126
128
  const deepClone = (obj, excludeFrom = []) => {
127
129
  const o = (0, import_types.isArray)(obj) ? [] : {};
128
130
  for (const prop in obj) {
131
+ if (prop === "__proto__")
132
+ continue;
129
133
  if (excludeFrom.includes(prop) || prop.startsWith("__"))
130
134
  continue;
131
135
  let objProp = obj[prop];
package/object.js CHANGED
@@ -24,6 +24,7 @@ export const map = (obj, extention, element) => {
24
24
 
25
25
  export const merge = (element, obj, excludeFrom = []) => {
26
26
  for (const e in obj) {
27
+ if (e === '__proto__') continue
27
28
  if (excludeFrom.includes(e) || e.startsWith('__')) continue
28
29
  const elementProp = element[e]
29
30
  const objProp = obj[e]
@@ -95,6 +96,7 @@ export const mergeArrayExclude = (arr, excl = []) => {
95
96
  export const deepClone = (obj, excludeFrom = []) => {
96
97
  const o = isArray(obj) ? [] : {}
97
98
  for (const prop in obj) {
99
+ if (prop === '__proto__') continue
98
100
  if (excludeFrom.includes(prop) || prop.startsWith('__')) continue
99
101
  let objProp = obj[prop]
100
102
  if (prop === 'extend' && isArray(objProp)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/utils",
3
- "version": "2.3.150",
3
+ "version": "2.3.152",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "index.js",
@@ -23,7 +23,7 @@
23
23
  "@domql/key": "latest",
24
24
  "@domql/tags": "latest"
25
25
  },
26
- "gitHead": "368c731d0e9f7225329b235dfa446d41a36a341c",
26
+ "gitHead": "9424c9efe8b2b9e4b39bf7dfac3caf1f964ddb9a",
27
27
  "devDependencies": {
28
28
  "@babel/core": "^7.12.0"
29
29
  }