4 lines
144 B
TypeScript
4 lines
144 B
TypeScript
export const truncateString = (str: string, maxLength: number) => {
|
|
return str.length > maxLength ? `${str.slice(0, maxLength)}...` : str;
|
|
};
|