* Truncates a string while preserving a short explanation.
( value: string, maxLength: number = TERMINAL_CONSOLE_LIMITS.MAX_STRING_LENGTH )
| 27 | * Truncates a string while preserving a short explanation. |
| 28 | */ |
| 29 | function truncateString( |
| 30 | value: string, |
| 31 | maxLength: number = TERMINAL_CONSOLE_LIMITS.MAX_STRING_LENGTH |
| 32 | ): string { |
| 33 | if (value.length <= maxLength) { |
| 34 | return value |
| 35 | } |
| 36 | |
| 37 | return `${value.slice(0, maxLength)}... [truncated ${value.length - maxLength} chars]` |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Safely stringifies terminal data without throwing on circular or non-JSON-safe values. |
no outgoing calls
no test coverage detected