* Return values (for example, of a set) * with spacing, indentation, and comma * without surrounding punctuation (braces or brackets)
(
iterator: Iterable<unknown>,
config: PrettyFormatConfig,
indentation: string,
depth: number,
refs: unknown[],
printer: PrettyFormatPrinter
)
| 314 | * without surrounding punctuation (braces or brackets) |
| 315 | */ |
| 316 | static printIterableValues( |
| 317 | iterator: Iterable<unknown>, |
| 318 | config: PrettyFormatConfig, |
| 319 | indentation: string, |
| 320 | depth: number, |
| 321 | refs: unknown[], |
| 322 | printer: PrettyFormatPrinter |
| 323 | ): string { |
| 324 | let result = ''; |
| 325 | let width = 0; |
| 326 | |
| 327 | const indentationNext = indentation + config.indent; |
| 328 | for (const current of iterator) { |
| 329 | if (result.length === 0) { |
| 330 | result += config.spacingOuter; |
| 331 | result += indentationNext; |
| 332 | } else { |
| 333 | result += `,${config.spacingInner}`; |
| 334 | result += indentationNext; |
| 335 | } |
| 336 | |
| 337 | if (width++ === config.maxWidth) { |
| 338 | result += '…'; |
| 339 | break; |
| 340 | } |
| 341 | |
| 342 | result += printer(current, config, indentationNext, depth, refs); |
| 343 | } |
| 344 | |
| 345 | if (result.length > 0) { |
| 346 | result += ','; |
| 347 | result += config.spacingOuter + indentation; |
| 348 | } |
| 349 | |
| 350 | return result; |
| 351 | } |
| 352 | |
| 353 | /** |
| 354 | * Returns a presentation string of your `val` object |