Skip to content

Commit f0df222

Browse files
BridgeARdanbev
authored andcommitted
util: rename setIteratorBraces to getIteratorBraces
The function is actually a getter, not a setter. PR-URL: #27342 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent 2f1add1 commit f0df222

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

lib/internal/util/inspect.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -560,15 +560,6 @@ function formatValue(ctx, value, recurseTimes, typedArray) {
560560
return formatRaw(ctx, value, recurseTimes, typedArray);
561561
}
562562

563-
function setIteratorBraces(type, tag) {
564-
if (tag !== `${type} Iterator`) {
565-
if (tag !== '')
566-
tag += '] [';
567-
tag += `${type} Iterator`;
568-
}
569-
return [`[${tag}] {`, '}'];
570-
}
571-
572563
function formatRaw(ctx, value, recurseTimes, typedArray) {
573564
let keys;
574565

@@ -630,11 +621,11 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
630621
extrasType = kArrayExtrasType;
631622
} else if (isMapIterator(value)) {
632623
keys = getKeys(value, ctx.showHidden);
633-
braces = setIteratorBraces('Map', tag);
624+
braces = getIteratorBraces('Map', tag);
634625
formatter = formatIterator;
635626
} else if (isSetIterator(value)) {
636627
keys = getKeys(value, ctx.showHidden);
637-
braces = setIteratorBraces('Set', tag);
628+
braces = getIteratorBraces('Set', tag);
638629
formatter = formatIterator;
639630
} else {
640631
noIterator = true;
@@ -754,10 +745,10 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
754745
}
755746
}
756747
if (isMapIterator(value)) {
757-
braces = setIteratorBraces('Map', tag);
748+
braces = getIteratorBraces('Map', tag);
758749
formatter = formatIterator;
759750
} else if (isSetIterator(value)) {
760-
braces = setIteratorBraces('Set', tag);
751+
braces = getIteratorBraces('Set', tag);
761752
formatter = formatIterator;
762753
// Handle other regular objects again.
763754
} else if (keys.length === 0) {
@@ -818,6 +809,15 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
818809
return res;
819810
}
820811

812+
function getIteratorBraces(type, tag) {
813+
if (tag !== `${type} Iterator`) {
814+
if (tag !== '')
815+
tag += '] [';
816+
tag += `${type} Iterator`;
817+
}
818+
return [`[${tag}] {`, '}'];
819+
}
820+
821821
function formatError(err, constructor, tag, ctx) {
822822
// TODO(BridgeAR): Always show the error code if present.
823823
let stack = err.stack || ErrorPrototype.toString(err);

0 commit comments

Comments
 (0)