Skip to content

Commit

Permalink
fixup: fix util.format on a revoked proxy
Browse files Browse the repository at this point in the history
Signed-off-by: Daeyeon Jeong [email protected]
  • Loading branch information
daeyeon committed May 15, 2022
1 parent 5723aaf commit ddf91e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/internal/util/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -1979,7 +1979,7 @@ function hasBuiltInToString(value) {
}

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

Expand Down
2 changes: 2 additions & 0 deletions test/parallel/test-util-inspect-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ assert.strictEqual(
'{ proxy: Proxy [ null, null ], revoke: [Function (anonymous)] }',
);

assert.strictEqual(util.format('%s', r.proxy), 'Proxy []');

assert.strictEqual(
util.inspect(proxyObj, opts),
'Proxy [\n' +
Expand Down

0 comments on commit ddf91e4

Please sign in to comment.