feat: astro test

This commit is contained in:
trafficlunar 2026-04-16 22:32:08 +01:00
parent df6e31ba89
commit 84144c383c
262 changed files with 18993 additions and 2655 deletions

View file

@ -0,0 +1,11 @@
export function abbreviateNumber(number: number): string {
if (number < 1000) return number.toString();
const units = ["", "K", "M", "B", "T"]; // very unlikely to go into thousands, let alone millions, but you never know
// update: it went into thousands
const order = Math.floor(Math.log10(number) / 3);
const unit = units[order] || "";
const scaled = number / Math.pow(10, order * 3);
return `${scaled.toFixed(scaled < 10 ? 1 : 0)}${unit}`;
}