main
| 1 | import { MedusaError, MedusaErrorTypes } from "./errors" |
| 2 | import { isString } from "./is-string" |
| 3 | |
| 4 | /** |
| 5 | * Normalizes `currencyCode` by transforming it to lowercase |
| 6 | */ |
| 7 | export function normalizeCurrencyCode(currencyCode: string) { |
| 8 | if (!isString(currencyCode)) { |
| 9 | throw new MedusaError(MedusaErrorTypes.INVALID_ARGUMENT, "Currency code needs to be a string") |
| 10 | } |
| 11 | |
| 12 | return currencyCode.toLowerCase() |
| 13 | } |