1export const truncateText = (text: string, maxLength: number = 100) => { 2 if (typeof maxLength !== 'number' || text.length <= maxLength) { 3 return text; 4 } 5 6 return text.slice(0, maxLength) + '...'; 7};