discombobulator 1.0.8 → 1.0.9
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/package.json +1 -1
- package/src/util-adapter.mjs +28 -16
package/package.json
CHANGED
package/src/util-adapter.mjs
CHANGED
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
// Inserted from Disco App (base44)
|
|
2
2
|
|
|
3
3
|
// A browser-safe adapter for Node's util module
|
|
4
|
-
|
|
4
|
+
const inspect = (value) => {
|
|
5
|
+
try {
|
|
6
|
+
return JSON.stringify(value, null, 2);
|
|
7
|
+
} catch (err) {
|
|
8
|
+
return String(value);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
5
11
|
|
|
6
|
-
|
|
7
|
-
// Dynamic import works in both Node (as of v12+) and browser environments
|
|
8
|
-
const util = await import('util');
|
|
9
|
-
inspect = util.inspect;
|
|
10
|
-
} catch (e) {
|
|
11
|
-
// Fallback for browsers
|
|
12
|
-
inspect = (value) => {
|
|
13
|
-
try {
|
|
14
|
-
return JSON.stringify(value, null, 2);
|
|
15
|
-
} catch (err) {
|
|
16
|
-
return String(value);
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
}
|
|
12
|
+
export { inspect };
|
|
20
13
|
|
|
21
|
-
|
|
14
|
+
|
|
15
|
+
// A browser-safe adapter for Node's util module
|
|
16
|
+
// let inspect = (value) => String(value);
|
|
17
|
+
|
|
18
|
+
// try {
|
|
19
|
+
// // Dynamic import works in both Node (as of v12+) and browser environments
|
|
20
|
+
// const util = await import('util');
|
|
21
|
+
// inspect = util.inspect;
|
|
22
|
+
// } catch (e) {
|
|
23
|
+
// // Fallback for browsers
|
|
24
|
+
// inspect = (value) => {
|
|
25
|
+
// try {
|
|
26
|
+
// return JSON.stringify(value, null, 2);
|
|
27
|
+
// } catch (err) {
|
|
28
|
+
// return String(value);
|
|
29
|
+
// }
|
|
30
|
+
// };
|
|
31
|
+
// }
|
|
32
|
+
|
|
33
|
+
// export { inspect };
|