* Reduces a string down to a maximum length of characters with ellipsis for readability * * @param input a string input * @param maxLength a maximum length in characters * @returns string
(input: string | null, maxLength = 50)
| 484 | * @returns string |
| 485 | */ |
| 486 | function shorten(input: string | null, maxLength = 50): string { |
| 487 | if (!input) { |
| 488 | return ''; |
| 489 | } |
| 490 | input = stripNewlines(input); |
| 491 | return input.length > maxLength ? `${input.substring(0, maxLength - 1)}…` : input; |
| 492 | } |
no test coverage detected
searching dependent graphs…