File size: 404 Bytes
a414867 | 1 2 3 4 5 6 7 8 9 10 11 12 13 | import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
export function truncateMiddle(value: string, maxLength = 48) {
if (value.length <= maxLength) return value;
const edge = Math.max(6, Math.floor((maxLength - 3) / 2));
return `${value.slice(0, edge)}...${value.slice(-edge)}`;
}
|