mirror of
https://github.com/YouHaveTrouble/GuildMaster.git
synced 2026-05-12 06:26:59 +00:00
21 lines
674 B
TypeScript
21 lines
674 B
TypeScript
const goldFormatter = new Intl.NumberFormat('en-US', {
|
|
maximumFractionDigits: 3,
|
|
// @ts-ignore - typescript doesn't know about this option for some godforsaken reason
|
|
notation: "compact",
|
|
useGrouping: true,
|
|
});
|
|
|
|
const damageFormatter = new Intl.NumberFormat('en-US', {
|
|
maximumFractionDigits: 2,
|
|
// @ts-ignore - typescript doesn't know about this option for some godforsaken reason
|
|
notation: "compact",
|
|
});
|
|
|
|
export function formatGold(number: number | null): string {
|
|
if (number === null) return "";
|
|
return goldFormatter.format(number);
|
|
}
|
|
|
|
export function formatDamage(number: number): string {
|
|
return damageFormatter.format(number);
|
|
} |