import type { CatalogBaseStat } from "./types"; export function formatBaseStat({ key, value }: CatalogBaseStat): string { const normalizedKey = key.toLowerCase(); const rawLabel = key.endsWith("%") ? key.slice(0, -1) : key; const label = ["hp", "atk", "def", "em", "er"].includes(normalizedKey) ? normalizedKey.toUpperCase() : rawLabel; const numericValue = typeof value === "number" ? value : Number(value); const formattedValue = Number.isFinite(numericValue) ? numericValue.toLocaleString("en-US", { maximumFractionDigits: 2 }) : value; const suffix = key.endsWith("%") || normalizedKey === "er" ? "%" : ""; return `${label} ${formattedValue}${suffix}`; }