MCPcopy Index your code
hub / github.com/nodejs/node / formatMap

Function formatMap

lib/internal/util/inspect.js:2413–2433  ·  view source on GitHub ↗
(value, ctx, ignored, recurseTimes)

Source from the content-addressed store, hash-verified

2411}
2412
2413function formatMap(value, ctx, ignored, recurseTimes) {
2414 const length = value.size;
2415 const maxLength = MathMin(MathMax(0, ctx.maxArrayLength), length);
2416 const remaining = length - maxLength;
2417 const output = [];
2418 ctx.indentationLvl += 2;
2419 let i = 0;
2420 for (const { 0: k, 1: v } of value) {
2421 if (i >= maxLength) break;
2422 ArrayPrototypePush(
2423 output,
2424 `${formatValue(ctx, k, recurseTimes)} => ${formatValue(ctx, v, recurseTimes)}`,
2425 );
2426 i++;
2427 }
2428 if (remaining > 0) {
2429 ArrayPrototypePush(output, remainingText(remaining));
2430 }
2431 ctx.indentationLvl -= 2;
2432 return output;
2433}
2434
2435function formatSetIterInner(ctx, recurseTimes, entries, state) {
2436 const maxArrayLength = MathMax(ctx.maxArrayLength, 0);

Callers

nothing calls this directly

Calls 2

formatValueFunction · 0.85
remainingTextFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…