-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
What problem is this solving
Currency Formatting
Proposed solution
export type Separators = {
thousands: string
decimal: string
}
export type Currency = string
export function toCurrency(num: string | number | BigInt, currency: string = toCurrency.currency, precision: number = toCurrency.precision, separators: Separators = toCurrency.separators) : Currency {}
toCurrency.prototype.currency = "$"
toCurrency.prototype.precision = 2
toCurrency.prototype.separators = {thousands: ".", decimal: ","}
export function fromCurrency(value: Currency) : BigInt {}
//Example
let currency = toCurrency(100000.83) // result: "$100,000.83"
let number = fromCurrency(currency) // result 100000.83Check accounting.js as reference
Describe alternatives you've considered
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels