mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-05 08:10:14 +00:00
14 lines
363 B
TypeScript
14 lines
363 B
TypeScript
const formatter = new Intl.NumberFormat("en-US", {
|
|
style: "currency",
|
|
currency: "USD",
|
|
})
|
|
|
|
export const formatCurrency = (amount: number | null | undefined) => {
|
|
if (amount === null || amount === undefined) {
|
|
return "-"
|
|
}
|
|
|
|
return formatter.format(amount)
|
|
}
|
|
|
|
export const parsePrice = (price?: string) => (price ? parseFloat(price) * 1_000_000 : undefined)
|