(
object: Record<string, unknown>,
{ level }: { level: number },
)
| 611 | } |
| 612 | |
| 613 | stringifyFlowMapping( |
| 614 | object: Record<string, unknown>, |
| 615 | { level }: { level: number }, |
| 616 | ): string { |
| 617 | const quote = this.condenseFlow ? '"' : ""; |
| 618 | const separator = this.condenseFlow ? ":" : ": "; |
| 619 | |
| 620 | const results = []; |
| 621 | for (const [key, value] of Object.entries(object)) { |
| 622 | const keyString = this.stringifyNode(key, { |
| 623 | level, |
| 624 | block: false, |
| 625 | compact: false, |
| 626 | isKey: false, |
| 627 | }); |
| 628 | if (keyString === null) continue; // Skip this pair because of invalid key; |
| 629 | |
| 630 | const valueString = this.stringifyNode(value, { |
| 631 | level, |
| 632 | block: false, |
| 633 | compact: false, |
| 634 | isKey: false, |
| 635 | }); |
| 636 | if (valueString === null) continue; // Skip this pair because of invalid value. |
| 637 | |
| 638 | const keyPrefix = keyString.length > 1024 ? "? " : ""; |
| 639 | results.push( |
| 640 | quote + keyPrefix + keyString + quote + separator + valueString, |
| 641 | ); |
| 642 | } |
| 643 | |
| 644 | return `{${results.join(", ")}}`; |
| 645 | } |
| 646 | |
| 647 | stringifyBlockMapping( |
| 648 | object: Record<string, unknown>, |
no test coverage detected