(text: string, maxLines: number)
| 227 | * @returns The truncated text with ellipsis if truncated |
| 228 | */ |
| 229 | export function truncateToLines(text: string, maxLines: number): string { |
| 230 | const lines = text.split('\n') |
| 231 | if (lines.length <= maxLines) { |
| 232 | return text |
| 233 | } |
| 234 | return lines.slice(0, maxLines).join('\n') + '…' |
| 235 | } |
no outgoing calls
no test coverage detected