util: rename setIteratorBraces to getIteratorBraces
The function is actually a getter, not a setter. PR-URL: https://github.com/nodejs/node/pull/27342 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
parent
2f1add18a4
commit
f0df222e82
@ -560,15 +560,6 @@ function formatValue(ctx, value, recurseTimes, typedArray) {
|
||||
return formatRaw(ctx, value, recurseTimes, typedArray);
|
||||
}
|
||||
|
||||
function setIteratorBraces(type, tag) {
|
||||
if (tag !== `${type} Iterator`) {
|
||||
if (tag !== '')
|
||||
tag += '] [';
|
||||
tag += `${type} Iterator`;
|
||||
}
|
||||
return [`[${tag}] {`, '}'];
|
||||
}
|
||||
|
||||
function formatRaw(ctx, value, recurseTimes, typedArray) {
|
||||
let keys;
|
||||
|
||||
@ -630,11 +621,11 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
|
||||
extrasType = kArrayExtrasType;
|
||||
} else if (isMapIterator(value)) {
|
||||
keys = getKeys(value, ctx.showHidden);
|
||||
braces = setIteratorBraces('Map', tag);
|
||||
braces = getIteratorBraces('Map', tag);
|
||||
formatter = formatIterator;
|
||||
} else if (isSetIterator(value)) {
|
||||
keys = getKeys(value, ctx.showHidden);
|
||||
braces = setIteratorBraces('Set', tag);
|
||||
braces = getIteratorBraces('Set', tag);
|
||||
formatter = formatIterator;
|
||||
} else {
|
||||
noIterator = true;
|
||||
@ -754,10 +745,10 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
|
||||
}
|
||||
}
|
||||
if (isMapIterator(value)) {
|
||||
braces = setIteratorBraces('Map', tag);
|
||||
braces = getIteratorBraces('Map', tag);
|
||||
formatter = formatIterator;
|
||||
} else if (isSetIterator(value)) {
|
||||
braces = setIteratorBraces('Set', tag);
|
||||
braces = getIteratorBraces('Set', tag);
|
||||
formatter = formatIterator;
|
||||
// Handle other regular objects again.
|
||||
} else if (keys.length === 0) {
|
||||
@ -818,6 +809,15 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
|
||||
return res;
|
||||
}
|
||||
|
||||
function getIteratorBraces(type, tag) {
|
||||
if (tag !== `${type} Iterator`) {
|
||||
if (tag !== '')
|
||||
tag += '] [';
|
||||
tag += `${type} Iterator`;
|
||||
}
|
||||
return [`[${tag}] {`, '}'];
|
||||
}
|
||||
|
||||
function formatError(err, constructor, tag, ctx) {
|
||||
// TODO(BridgeAR): Always show the error code if present.
|
||||
let stack = err.stack || ErrorPrototype.toString(err);
|
||||
|
Loading…
x
Reference in New Issue
Block a user