aboutsummaryrefslogtreecommitdiff
path: root/packages/bun-inspector-protocol/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--packages/bun-inspector-protocol/src/util/preview.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/bun-inspector-protocol/src/util/preview.ts b/packages/bun-inspector-protocol/src/util/preview.ts
index ad751a2b8..c6d748304 100644
--- a/packages/bun-inspector-protocol/src/util/preview.ts
+++ b/packages/bun-inspector-protocol/src/util/preview.ts
@@ -1,6 +1,6 @@
import type { JSC } from "../protocol";
-export function remoteObjectToString(remoteObject: JSC.Runtime.RemoteObject): string {
+export function remoteObjectToString(remoteObject: JSC.Runtime.RemoteObject, topLevel?: boolean): string {
const { type, subtype, value, description, className, preview } = remoteObject;
switch (type) {
case "undefined":
@@ -9,6 +9,9 @@ export function remoteObjectToString(remoteObject: JSC.Runtime.RemoteObject): st
case "number":
return description ?? JSON.stringify(value);
case "string":
+ if (topLevel) {
+ return String(value ?? description);
+ }
return JSON.stringify(value ?? description);
case "symbol":
case "bigint":