Template
13 lines
354 B
TypeScript
13 lines
354 B
TypeScript
import { clsx, type ClassValue } from 'clsx';
|
|
import { twMerge } from 'tailwind-merge';
|
|
|
|
export function cn(...inputs: ClassValue[]) {
|
|
return twMerge(clsx(inputs));
|
|
}
|
|
|
|
export function truncate(str: string, maxLength: number): string {
|
|
if (!str) return '';
|
|
if (str.length <= maxLength) return str;
|
|
return str.slice(0, maxLength).trim() + '...';
|
|
}
|