Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3966b69

Browse filesBrowse 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
Copy full SHA for 3966b69

File tree

Expand file treeCollapse file tree

1 file changed

+6
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-2
lines changed
Open diff view settings
Collapse file

‎lib/internal/util/inspect.js‎

Copy file name to clipboardExpand all lines: lib/internal/util/inspect.js
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,10 @@ function getKeys(value, showHidden) {
362362
return keys;
363363
}
364364

365+
function getCtxStyle(constructor, tag) {
366+
return constructor || tag || 'Object';
367+
}
368+
365369
function formatProxy(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-
return ctx.stylize(`[${constructor || tag || 'Object'}]`, 'special');
715+
return ctx.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
return ctx.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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.