@domql/utils 2.5.87 → 2.5.91
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 +18 -0
- package/dist/cjs/array.js +11 -0
- package/dist/cjs/object.js +1 -1
- package/object.js +1 -1
- package/package.json +2 -2
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
|
+
};
|
package/dist/cjs/object.js
CHANGED
|
@@ -195,7 +195,7 @@ const deepStringify = (obj, stringified = {}) => {
|
|
|
195
195
|
}
|
|
196
196
|
return stringified;
|
|
197
197
|
};
|
|
198
|
-
const objectToString = (obj, indent = 0) => {
|
|
198
|
+
const objectToString = (obj = {}, indent = 0) => {
|
|
199
199
|
const spaces = " ".repeat(indent);
|
|
200
200
|
let str = "{\n";
|
|
201
201
|
for (const [key, value] of Object.entries(obj)) {
|
package/object.js
CHANGED
|
@@ -175,7 +175,7 @@ export const deepStringify = (obj, stringified = {}) => {
|
|
|
175
175
|
return stringified
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
export const objectToString = (obj, indent = 0) => {
|
|
178
|
+
export const objectToString = (obj = {}, indent = 0) => {
|
|
179
179
|
const spaces = ' '.repeat(indent)
|
|
180
180
|
let str = '{\n'
|
|
181
181
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/utils",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.91",
|
|
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": "
|
|
26
|
+
"gitHead": "15a57f968b6c8832cb843c886e251a89ff17cc24",
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/core": "^7.12.0"
|
|
29
29
|
}
|