* Truncate a string with ellipsis
(str: string, maxLength: number)
| 270 | * Truncate a string with ellipsis |
| 271 | */ |
| 272 | function truncate(str: string, maxLength: number): string { |
| 273 | if (str.length <= maxLength) { |
| 274 | return str; |
| 275 | } |
| 276 | return str.slice(0, maxLength - 3) + '...'; |
| 277 | } |
| 278 | |
| 279 | /** |
| 280 | * Format bytes as human-readable string |
no outgoing calls
no test coverage detected