From 0bc286ab47d82496b90efb429e16efccc10e5f2d Mon Sep 17 00:00:00 2001 From: Jason Date: Sun, 20 Mar 2022 19:21:42 +0800 Subject: fix(ext/console): fix error with a Proxy of a Map (#14032) --- ext/console/02_console.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'ext') diff --git a/ext/console/02_console.js b/ext/console/02_console.js index 4663ded73..a16095179 100644 --- a/ext/console/02_console.js +++ b/ext/console/02_console.js @@ -661,7 +661,8 @@ if (ctxHas(value)) { return handleCircular(value, cyan); } - return inspectObject(value, level, inspectOptions); + + return inspectObject(value, level, inspectOptions, proxyDetails); default: // Not implemented is red return red("[Not Implemented]"); @@ -1200,6 +1201,7 @@ value, level, inspectOptions, + proxyDetails, ) { if (customInspect in value && typeof value[customInspect] === "function") { return String(value[customInspect](inspect)); @@ -1240,9 +1242,17 @@ } else if (ObjectPrototypeIsPrototypeOf(DatePrototype, value)) { return inspectDate(value, inspectOptions); } else if (ObjectPrototypeIsPrototypeOf(SetPrototype, value)) { - return inspectSet(value, level, inspectOptions); + return inspectSet( + proxyDetails ? proxyDetails[0] : value, + level, + inspectOptions, + ); } else if (ObjectPrototypeIsPrototypeOf(MapPrototype, value)) { - return inspectMap(value, level, inspectOptions); + return inspectMap( + proxyDetails ? proxyDetails[0] : value, + level, + inspectOptions, + ); } else if (ObjectPrototypeIsPrototypeOf(WeakSetPrototype, value)) { return inspectWeakSet(inspectOptions); } else if (ObjectPrototypeIsPrototypeOf(WeakMapPrototype, value)) { -- cgit v1.2.3