File size: 576 Bytes
7572a96 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import { type ClassValue, clsx } from 'clsx'
import { twMerge } from 'tailwind-merge'
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
export function fmt(n: number, d = 3): string {
if (n === 0) return '0'
return n.toFixed(d)
}
export function fmtInt(n: number): string {
return n.toLocaleString()
}
export function pct(n: number): string {
return (n * 100).toFixed(1) + '%'
}
export function compression(ours: number, theirs: number): string {
if (theirs <= 0 || ours <= 0) return '--'
return Math.round(theirs / ours) + 'x'
}
|