mirror of
https://github.com/datahub-project/datahub.git
synced 2025-09-28 10:35:20 +00:00
7 lines
197 B
TypeScript
7 lines
197 B
TypeScript
![]() |
export function formatNumber(n) {
|
||
|
if (n < 1e3) return n;
|
||
|
if (n >= 1e3 && n < 1e6) return `${+(n / 1e3).toFixed(1)}K`;
|
||
|
if (n >= 1e6) return `${+(n / 1e6).toFixed(1)}M`;
|
||
|
return '';
|
||
|
}
|