Skip to contentOpen History to see the last commit
String.ts
8 lines206 Bytes
1export function truncate(text: string, maxLength = 50): string { 2 const trimmed = text.trim(); 3 if (trimmed.length <= maxLength) { 7 return `${trimmed.slice(0, maxLength)}...`;