@domql/utils 2.5.89 → 2.5.92

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
@@ -100,3 +100,21 @@ export const removeValueFromArray = (arr, value) => {
100
100
  export const removeValueFromArrayAll = (arr, value) => {
101
101
  return arr.filter(item => item !== value)
102
102
  }
103
+
104
+ export const addItemAfterEveryElement = (array, item) => {
105
+ // Create a new array to hold the result
106
+ const result = []
107
+
108
+ // Loop through the input array
109
+ for (let i = 0; i < array.length; i++) {
110
+ // Add the current element to the result array
111
+ result.push(array[i])
112
+
113
+ // If it's not the last element, add the item
114
+ if (i < array.length - 1) {
115
+ result.push(item)
116
+ }
117
+ }
118
+
119
+ return result
120
+ }
package/dist/cjs/array.js CHANGED
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var array_exports = {};
20
20
  __export(array_exports, {
21
+ addItemAfterEveryElement: () => addItemAfterEveryElement,
21
22
  arrayContainsOtherArray: () => arrayContainsOtherArray,
22
23
  createNestedObject: () => createNestedObject,
23
24
  cutArrayAfterValue: () => cutArrayAfterValue,
@@ -113,3 +114,13 @@ const removeValueFromArray = (arr, value) => {
113
114
  const removeValueFromArrayAll = (arr, value) => {
114
115
  return arr.filter((item) => item !== value);
115
116
  };
117
+ const addItemAfterEveryElement = (array, item) => {
118
+ const result = [];
119
+ for (let i = 0; i < array.length; i++) {
120
+ result.push(array[i]);
121
+ if (i < array.length - 1) {
122
+ result.push(item);
123
+ }
124
+ }
125
+ return result;
126
+ };
@@ -262,7 +262,7 @@ const deepDestringify = (obj, destringified = {}) => {
262
262
  continue;
263
263
  const objProp = obj[prop];
264
264
  if ((0, import_types.isString)(objProp)) {
265
- if ((objProp.includes("=>") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
265
+ if ((objProp.includes("(){") || objProp.includes("() {") || objProp.includes("=>") || objProp.startsWith("()") || objProp.startsWith("async") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
266
266
  try {
267
267
  const evalProp = import_globals.window.eval(`(${objProp})`);
268
268
  destringified[prop] = evalProp;
package/object.js CHANGED
@@ -249,7 +249,17 @@ export const deepDestringify = (obj, destringified = {}) => {
249
249
  if (!hasOwnProperty) continue
250
250
  const objProp = obj[prop]
251
251
  if (isString(objProp)) {
252
- if ((objProp.includes('=>') || objProp.startsWith('function') || objProp.startsWith('(')) && !objProp.startsWith('{') && !objProp.startsWith('[')) {
252
+ if ((
253
+ objProp.includes('(){') ||
254
+ objProp.includes('() {') ||
255
+ objProp.includes('=>') ||
256
+ objProp.startsWith('()') ||
257
+ objProp.startsWith('async') ||
258
+ objProp.startsWith('function') ||
259
+ objProp.startsWith('(')
260
+ ) &&
261
+ !objProp.startsWith('{') && !objProp.startsWith('[')
262
+ ) {
253
263
  try {
254
264
  const evalProp = window.eval(`(${objProp})`)
255
265
  destringified[prop] = evalProp
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/utils",
3
- "version": "2.5.89",
3
+ "version": "2.5.92",
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": "107aed00dc54d9e9c23948f37c9c704f8ed53cef",
26
+ "gitHead": "41f831e7064481d010f7a763e9466931c6389f87",
27
27
  "devDependencies": {
28
28
  "@babel/core": "^7.12.0"
29
29
  }