Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Currency

Hierarchy

  • Currency

Index

Constructors

Properties

Methods

Constructors

constructor

  • new Currency(code: string, subunitsPerUnit: i32): Currency
  • Creates an instance of Currency

    Parameters

    • code: string

      The ISO 4217 code for the currency

    • subunitsPerUnit: i32

      The amount of subunits per unit in this currency

    Returns Currency

Properties

Readonly code

code: string

The ISO 4217 code for the currency

Methods

subunitsToUnits

  • subunitsToUnits(subunits: i64): f64
  • Converts integer subunits of Currency to the float units value. For example, when the currency is CAD and subunits is 10 (10 cents), this method returns 0.10 (0.10 dollars).

    Parameters

    • subunits: i64

      The integer subunits to convert to units

    Returns f64

    The corresponding float amount of units

toString

  • toString(): string
  • Returns string

unitsToSubunits

  • unitsToSubunits(units: f64): i64
  • Converts float units of Currency to the subunits value. For example, when the currency is CAD and units is 0.10 (0.10 dollars), this method returns 10 (10 cents)

    Parameters

    • units: f64

      The number of units to convert

    Returns i64

    The corresponding integer amount of subunits

Generated using TypeDoc