summaryrefslogtreecommitdiff
path: root/cli/rt/02_console.js
diff options
context:
space:
mode:
authoruki00a <uki00a@gmail.com>2020-09-08 23:06:26 +0900
committerGitHub <noreply@github.com>2020-09-08 16:06:26 +0200
commitac455050ee5de10984a9bd9f704e430ac244cb54 (patch)
treeadbebfcca020310be2d563816d2c2a71031ce306 /cli/rt/02_console.js
parent6ff939553216125ce058a070d91b7eb430cc4665 (diff)
feat(console): print proxy details (#7139)
Diffstat (limited to 'cli/rt/02_console.js')
-rw-r--r--cli/rt/02_console.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/cli/rt/02_console.js b/cli/rt/02_console.js
index e3492772d..00ecd3aac 100644
--- a/cli/rt/02_console.js
+++ b/cli/rt/02_console.js
@@ -154,6 +154,7 @@
trailingComma: false,
compact: true,
iterableLimit: 100,
+ showProxy: false,
};
const DEFAULT_INDENT = " "; // Default indent string
@@ -400,6 +401,13 @@
level,
inspectOptions,
) {
+ const proxyDetails = Deno.core.getProxyDetails(value);
+ if (proxyDetails != null) {
+ return inspectOptions.showProxy
+ ? inspectProxy(proxyDetails, ctx, level, inspectOptions)
+ : inspectValue(proxyDetails[0], ctx, level, inspectOptions);
+ }
+
switch (typeof value) {
case "string":
return value;
@@ -657,7 +665,16 @@
return `Promise { ${str} }`;
}
- // TODO: Proxy
+ function inspectProxy(
+ targetAndHandler,
+ ctx,
+ level,
+ inspectOptions,
+ ) {
+ return `Proxy ${
+ inspectArray(targetAndHandler, ctx, level, inspectOptions)
+ }`;
+ }
function inspectRawObject(
value,