/
afanasevn
/
PdfEncoder
Обзор
Документация
Войти
/
afanasevn
/
PdfEncoder
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
client/src/lib/text-format.ts
32 строки
755 B
IBS\NAfanasev
Field validation, integration tests, UI polish
06 июл 2026, 17:18
06 июл 2026, 17:18
0e936b0
Код
Авторство
О чём код?
/** * Обрезает текст до maxLength символов с многоточием. */ export function truncateText( text: string, maxLength: number, ): string { if (text.length <= maxLength) { return text; } return `${text.slice(0, maxLength)}…`; } /** * Разбивает длинный текст на строки для tooltip (перенос каждые lineLength символов). */ export function wrapTextForTooltip( text: string, lineLength: number, ): string { if (text.length <= lineLength) { return text; } const lines: string[] = []; for (let index = 0; index < text.length; index += lineLength) { lines.push(text.slice(index, index + lineLength)); } return lines.join("\n"); }