| export const fmtPrice = (v: number) => | |
| v.toLocaleString("en-US", { minimumFractionDigits: 3, maximumFractionDigits: 3 }); | |
| export const fmtBps = (v: number) => | |
| `${v >= 0 ? "+" : ""}${v.toFixed(1)} bps`; | |
| export const fmtPct = (v: number, d = 3) => `${(v * 100).toFixed(d)}%`; | |
| export const fmtScore = (v: number) => v.toFixed(1); | |
| export const confidenceTone = (score: number): "positive" | "warning" | "negative" => { | |
| if (score >= 7.5) return "positive"; | |
| if (score >= 4.5) return "warning"; | |
| return "negative"; | |
| }; | |
| export const toneClasses = { | |
| positive: "text-positive", | |
| warning: "text-warning", | |
| negative: "text-negative", | |
| neutral: "text-text", | |
| } as const; | |