| 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' | |
| } | |