@domql/utils 2.5.170 → 2.5.177
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/dist/cjs/object.js +3 -0
- package/dist/esm/object.js +3 -0
- package/object.js +5 -1
- package/package.json +2 -2
package/dist/cjs/object.js
CHANGED
|
@@ -231,6 +231,9 @@ const deepStringifyWithMaxDepth = (obj, stringified = {}, depth = 0, path = "")
|
|
|
231
231
|
return stringified;
|
|
232
232
|
};
|
|
233
233
|
const objectToString = (obj = {}, indent = 0) => {
|
|
234
|
+
if (Object.keys(obj).length === 0) {
|
|
235
|
+
return "{}";
|
|
236
|
+
}
|
|
234
237
|
const spaces = " ".repeat(indent);
|
|
235
238
|
let str = "{\n";
|
|
236
239
|
for (const [key, value] of Object.entries(obj)) {
|
package/dist/esm/object.js
CHANGED
|
@@ -202,6 +202,9 @@ const deepStringifyWithMaxDepth = (obj, stringified = {}, depth = 0, path = "")
|
|
|
202
202
|
return stringified;
|
|
203
203
|
};
|
|
204
204
|
const objectToString = (obj = {}, indent = 0) => {
|
|
205
|
+
if (Object.keys(obj).length === 0) {
|
|
206
|
+
return "{}";
|
|
207
|
+
}
|
|
205
208
|
const spaces = " ".repeat(indent);
|
|
206
209
|
let str = "{\n";
|
|
207
210
|
for (const [key, value] of Object.entries(obj)) {
|
package/object.js
CHANGED
|
@@ -238,6 +238,11 @@ export const deepStringifyWithMaxDepth = (obj, stringified = {}, depth = 0, path
|
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
export const objectToString = (obj = {}, indent = 0) => {
|
|
241
|
+
// Handle empty object case
|
|
242
|
+
if (Object.keys(obj).length === 0) {
|
|
243
|
+
return '{}'
|
|
244
|
+
}
|
|
245
|
+
|
|
241
246
|
const spaces = ' '.repeat(indent)
|
|
242
247
|
let str = '{\n'
|
|
243
248
|
|
|
@@ -252,7 +257,6 @@ export const objectToString = (obj = {}, indent = 0) => {
|
|
|
252
257
|
if (isObjectLike(element) && element !== null) {
|
|
253
258
|
str += `${spaces} ${objectToString(element, indent + 2)},\n`
|
|
254
259
|
} else if (isString(element)) {
|
|
255
|
-
// if (element.includes('\n')) str += spaces + ' ' + '`' + element + '`,\n'
|
|
256
260
|
str += `${spaces} '${element}',\n`
|
|
257
261
|
} else {
|
|
258
262
|
str += `${spaces} ${element},\n`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/utils",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.177",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"build": "npm run build:cjs; npm run build:esm",
|
|
26
26
|
"prepublish": "rimraf -I dist; npm run build; npm run copy:package:cjs"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "faa8ed6c9ba30a49c81962cd3e16c0ffac833f4e",
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@babel/core": "^7.12.0"
|
|
31
31
|
}
|