lib: combine contructor, tag, Object into a function
combine these parts into a function to be used in multiple parts PR-URL: https://github.com/nodejs/node/pull/24171 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
parent
8793e0de1d
commit
04ccc98de6
@ -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)
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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'
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user