Skip to content
7 linesCodeBlameRaw
1/** Micro-dollars as people read them: "$0.14", "$12.50", "$1,204". */
2export function dollars(micros: number): string {
3 const value = Math.max(0, micros) / 1_000_000;
4 if (value >= 1000) return `$${Math.round(value).toLocaleString("en-US")}`;
5 if (value > 0 && value < 0.01) return "<$0.01";
6 return `$${value.toFixed(2)}`;
7}