Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/internal/util/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,10 @@ function getKeys(value, showHidden) {
return keys;
}

function getCtxStyle(constructor, tag) {
return constructor || tag || 'Object';
}

function formatProxy(ctx, proxy, recurseTimes) {
if (recurseTimes != null) {
if (recurseTimes < 0)
Expand Down Expand Up @@ -741,7 +745,7 @@ function formatRaw(ctx, value, recurseTimes) {

if (recurseTimes != null) {
if (recurseTimes < 0)
return ctx.stylize(`[${constructor || tag || 'Object'}]`, 'special');
return ctx.stylize(`[${getCtxStyle(constructor, tag)}]`, 'special');
recurseTimes -= 1;
}

Expand Down Expand Up @@ -793,7 +797,7 @@ function handleMaxCallStackSize(ctx, err, constructor, tag, indentationLvl) {
ctx.seen.pop();
ctx.indentationLvl = indentationLvl;
return ctx.stylize(
`[${constructor || tag || 'Object'}: Inspection interrupted ` +
`[${getCtxStyle(constructor, tag)}: Inspection interrupted ` +
'prematurely. Maximum call stack size exceeded.]',
'special'
);
Expand Down