Currency
Currency class describes supported currencies as well as operations on them, such as mapping from and to a Currency index as well as exchanging a list of interval in different currencies to a single base for evaluation.
Static Member Summary
Static Public Members | ||
public static get |
Supported currencies as described in CurrenciesType. |
|
public static get |
Number of defined currencies in Currencies |
Static Method Summary
Static Public Methods | ||
public static |
async changeAllCurrencies(base: String, currencies: Array): Object Takes a currency base in ISO 4217 and a list of intervals in different currencies and transforms all to the specified base using http://fixer.io API |
|
public static |
convertToJSON(currencyList: Array): Object Transforms an array of currency intervals to an object with bases as keys and corresponding intervals as values |
|
public static |
getCurrencyIndex(currency: String): Number Given a currency name in ISO 4217, return its index from Currencies |
Static Public Members
public static get Currencies: CurrenciesType source
Supported currencies as described in CurrenciesType.
Static Public Methods
public static async changeAllCurrencies(base: String, currencies: Array): Object source
Takes a currency base in ISO 4217 and a list of intervals in different currencies and transforms all to the specified base using http://fixer.io API
Params:
Name | Type | Attribute | Description |
base | String | a string specifiying currency from Currencies |
|
currencies | Array | an array of intervals in different currencies |
public static convertToJSON(currencyList: Array): Object source
Transforms an array of currency intervals to an object with bases as keys and corresponding intervals as values
Params:
Name | Type | Attribute | Description |
currencyList | Array | an array of intervals in different currencies |
public static getCurrencyIndex(currency: String): Number source
Given a currency name in ISO 4217, return its index from Currencies
Params:
Name | Type | Attribute | Description |
currency | String | name in ISO 4217 |
Throw:
If currency is not defined |