Files
maher 511fad8199
Build / run (push) Has been cancelled
Initial commit
2026-05-14 13:42:10 +02:00

7 lines
208 B
TypeScript
Executable File

export function truncateString(str: string, length: number, end = '...') {
if (length == null || length >= str.length) {
return str;
}
return str.slice(0, Math.max(0, length - end.length)) + end;
}