Millwork
    Preparing search index...

    An amount of money. amount is an integer in units of 10 ** -scale of currency. A Money is immutable. It does no arithmetic: use dinero or a decimal library for math.

    Index
    • Use fromMinor or fromDecimal. Without scale, the currency must be in the table.

      Parameters

      • amount: bigint
      • currency: string
      • Optionalscale: number

      Returns Money

    amount: bigint
    currency: string
    scale: number
    currencies: readonly string[] = ...

    All the currency codes in the built-in ISO 4217 table.

    • Writes the amount as a decimal string with scale digits after the point.

      Returns string

    • Makes a Money from a decimal string, such as "19.99". The scale is the larger of the digits after the point and the ISO 4217 exponent.

      Parameters

      • text: string
      • currency: string

      Returns Money

    • Makes a Money from minor units. The scale defaults to the ISO 4217 exponent.

      Parameters

      • amount: string | number | bigint
      • currency: string
      • Optionalscale: number

      Returns Money