Files
wehub-resource-sync 979fb22d7c
CI / test (20, macos-latest) (push) Waiting to run
CI / test (20, ubuntu-latest) (push) Waiting to run
CI / test (22, macos-latest) (push) Waiting to run
CI / test (22, ubuntu-latest) (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 13:01:18 +08:00

6 lines
205 B
TypeScript

export function formatCompact(n: number): string {
if (n >= 10_000) return `${(n / 1000).toFixed(1).replace(/\.0$/, "")}K`;
if (n >= 1_000) return `${(n / 1000).toFixed(1)}K`;
return n.toString();
}