This commit is contained in:
2025-12-03 17:33:37 +01:00
parent 4b43c5dacc
commit efcbb33d30
3 changed files with 70 additions and 3 deletions
+6
View File
@@ -0,0 +1,6 @@
export default function formatNumber(num: number): string {
if (num < 1000) return num.toString();
if (num < 1_000_000)
return (num / 1000).toFixed(num % 1000 === 0 ? 0 : 1) + "k";
return (num / 1_000_000).toFixed(num % 1_000_000 === 0 ? 0 : 1) + "M";
}