requireCurrencyCode()function
requireCurrencyCode(value: string, caller: AnyCaller = requireCurrencyCode): CurrencyCode
| Param | Type | |
|---|---|---|
value | string | The string to normalise and check. required |
caller | AnyCaller | The function to attribute a thrown error to (defaults to requireCurrencyCode). Defaults to requireCurrencyCode |
| Return | |
|---|---|
CurrencyCode | The normalised CurrencyCode. |
| Throws | |
|---|---|
RequiredError | If the value isn't a supported ISO 4217 currency code. |
Normalise a value to a valid ISO 4217 CurrencyCode, or throw RequiredError if it isn't a supported currency.
Examples
requireCurrencyCode("gbp") // "GBP"