File size: 167 Bytes
f27679f
 
 
 
 
1
2
3
4
5
export function truncate(text: string, length: number): string {
  const truncated = text.slice(0, length)

  return `${truncated}${truncated !== text ? '...' : ''}`
}