Files
js/components/engine/utils.ts
T
Phillip Ho 6b59289c9b fix: crash if unable to load balance (#2082)
* fix: crash if unable to load balance

* unit test
2023-12-22 20:36:14 +00:00

12 lines
267 B
TypeScript

export const prettyPrintCurrency = ({
amount,
symbol,
}: {
amount?: string | number;
symbol: string;
}): string => {
const amountNumber =
typeof amount === "string" ? parseFloat(amount) : amount ?? 0;
return `${amountNumber.toFixed(6)} ${symbol}`;
};