* Truncate a string to max length, adding ellipsis if needed.
(str: string, maxLength: number)
| 151 | * Truncate a string to max length, adding ellipsis if needed. |
| 152 | */ |
| 153 | function truncate(str: string, maxLength: number): string { |
| 154 | if (str.length <= maxLength) { |
| 155 | return str |
| 156 | } |
| 157 | return `${str.slice(0, maxLength - 1)}…` |
| 158 | } |
| 159 | |
| 160 | /** |
| 161 | * Get a shortened version of a block ID for display. |
no outgoing calls
no test coverage detected