Skip to content

Commit 161dbe5

Browse files
committed
fixup: fix util.format on a revoked proxy
Signed-off-by: Daeyeon Jeong [email protected]
1 parent 5723aaf commit 161dbe5

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/internal/util/inspect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,7 @@ function hasBuiltInToString(value) {
19791979
}
19801980

19811981
// Count objects that have no `toString` function as built-in.
1982-
if (typeof value.toString !== 'function') {
1982+
if (typeof value?.toString !== 'function') {
19831983
return true;
19841984
}
19851985

test/parallel/test-util-inspect-proxy.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ assert.strictEqual(
7676
'{ proxy: Proxy [ null, null ], revoke: [Function (anonymous)] }',
7777
);
7878

79+
assert.strictEqual(util.format('%s', r.proxy), 'Proxy []');
80+
7981
assert.strictEqual(
8082
util.inspect(proxyObj, opts),
8183
'Proxy [\n' +

0 commit comments

Comments
 (0)