Skip to content

Commit 3966b69

Browse files
Paul-IsacheMylesBorins
authored andcommitted
lib: combine contructor, tag, Object into a function
combine these parts into a function to be used in multiple parts PR-URL: #24171 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent 4b9518d commit 3966b69

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎lib/internal/util/inspect.js‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,10 @@ function getKeys(value, showHidden) {
362362
returnkeys;
363363
}
364364

365+
functiongetCtxStyle(constructor,tag){
366+
returnconstructor||tag||'Object';
367+
}
368+
365369
functionformatProxy(ctx,proxy,recurseTimes){
366370
if(recurseTimes!=null){
367371
if(recurseTimes<0)
@@ -708,7 +712,7 @@ function formatRaw(ctx, value, recurseTimes) {
708712

709713
if(recurseTimes!=null){
710714
if(recurseTimes<0)
711-
returnctx.stylize(`[${constructor||tag||'Object'}]`,'special');
715+
returnctx.stylize(`[${getCtxStyle(constructor,tag)}]`,'special');
712716
recurseTimes-=1;
713717
}
714718

@@ -746,7 +750,7 @@ function handleMaxCallStackSize(ctx, err, constructor, tag, indentationLvl) {
746750
ctx.seen.pop();
747751
ctx.indentationLvl=indentationLvl;
748752
returnctx.stylize(
749-
`[${constructor||tag||'Object'}: Inspection interrupted `+
753+
`[${getCtxStyle(constructor,tag)}: Inspection interrupted `+
750754
'prematurely. Maximum call stack size exceeded.]',
751755
'special'
752756
);

0 commit comments

Comments
 (0)