| Conditions | 2 |
| Total Lines | 15 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | |||
| 21 | |||
| 22 | /** |
||
| 23 | * Currency codes are |
||
| 24 | * [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217) |
||
| 25 | * |
||
| 26 | * @param currencyCode The currency code to be validated. |
||
| 27 | * @returns Returns the given currency code if valid otherwise throws. |
||
| 28 | */ |
||
| 29 | export function validateCurrencyCode(currencyCode: string) { |
||
| 30 | if (currencyCode.length !== 3) { |
||
| 31 | throw new RangeError( |
||
| 32 | "Currency string length must be 3, see " |
||
| 33 | ) |
||
| 34 | } |
||
| 35 | return currencyCode |
||
| 36 | } |
||
| 37 |