requireCurrencyCode()function

requireCurrencyCode(value: string, caller: AnyCaller = requireCurrencyCode): CurrencyCode
ParamType
valuestring
The string to normalise and check. required
callerAnyCaller
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"