(ctx, recurseTimes, entries, state)
| 2455 | } |
| 2456 | |
| 2457 | function formatMapIterInner(ctx, recurseTimes, entries, state) { |
| 2458 | const maxArrayLength = MathMax(ctx.maxArrayLength, 0); |
| 2459 | // Entries exist as [key1, val1, key2, val2, ...] |
| 2460 | const len = entries.length / 2; |
| 2461 | const remaining = len - maxArrayLength; |
| 2462 | const maxLength = MathMin(maxArrayLength, len); |
| 2463 | const output = new Array(maxLength); |
| 2464 | let i = 0; |
| 2465 | ctx.indentationLvl += 2; |
| 2466 | if (state === kWeak) { |
| 2467 | for (; i < maxLength; i++) { |
| 2468 | const pos = i * 2; |
| 2469 | output[i] = |
| 2470 | `${formatValue(ctx, entries[pos], recurseTimes)} => ${formatValue(ctx, entries[pos + 1], recurseTimes)}`; |
| 2471 | } |
| 2472 | // Sort all entries to have a halfway reliable output (if more entries than |
| 2473 | // retrieved ones exist, we can not reliably return the same output) if the |
| 2474 | // output is not sorted anyway. |
| 2475 | if (!ctx.sorted) |
| 2476 | ArrayPrototypeSort(output); |
| 2477 | } else { |
| 2478 | for (; i < maxLength; i++) { |
| 2479 | const pos = i * 2; |
| 2480 | const res = [ |
| 2481 | formatValue(ctx, entries[pos], recurseTimes), |
| 2482 | formatValue(ctx, entries[pos + 1], recurseTimes), |
| 2483 | ]; |
| 2484 | output[i] = reduceToSingleString( |
| 2485 | ctx, res, '', ['[', ']'], kArrayExtrasType, recurseTimes); |
| 2486 | } |
| 2487 | } |
| 2488 | ctx.indentationLvl -= 2; |
| 2489 | if (remaining > 0) { |
| 2490 | ArrayPrototypePush(output, remainingText(remaining)); |
| 2491 | } |
| 2492 | return output; |
| 2493 | } |
| 2494 | |
| 2495 | function formatWeakCollection(ctx) { |
| 2496 | return [ctx.stylize('<items unknown>', 'special')]; |
no test coverage detected
searching dependent graphs…