(value: unknown)
| 574 | } |
| 575 | |
| 576 | function formatArgValue(value: unknown): string | undefined { |
| 577 | if (typeof value === "string") { |
| 578 | return shortenValue(value.replace(/\s+/g, " ").trim()) |
| 579 | } |
| 580 | |
| 581 | if (typeof value === "number" || typeof value === "boolean") { |
| 582 | return String(value) |
| 583 | } |
| 584 | |
| 585 | if (Array.isArray(value)) { |
| 586 | const items: string[] = value |
| 587 | .slice(0, 3) |
| 588 | .map(formatArgValue) |
| 589 | .filter((item): item is string => Boolean(item)) |
| 590 | return items.length > 0 ? `[${items.join(",")}]` : undefined |
| 591 | } |
| 592 | |
| 593 | return undefined |
| 594 | } |
| 595 | |
| 596 | function shortenValue(value: string, maxLength = 80) { |
| 597 | if (value.length <= maxLength) { |
no test coverage detected