getCurrencyStep()function
getCurrencyStep(currency: CurrencyCode, caller: AnyCaller = getCurrencyStep): number
| Param | Type | |
|---|---|---|
currency | CurrencyCode | The ISO 4217 currency code to get the step for. required |
caller | AnyCaller | The function to attribute a thrown error to (defaults to getCurrencyStep). Defaults to getCurrencyStep |
| Return | |
|---|---|
number | The smallest fractional unit used for the currency. |
| Throws | |
|---|---|
RequiredError | If the currency code is malformed or unsupported. |
Get the "step" value for a currency, i.e. the smallest fractional unit that is used for that currency.
- E.g.
0.01for USD,0.001for some cryptocurrencies, and1for JPY.
Examples
getCurrencyStep("USD") // 0.01getCurrencyStep("JPY") // 1