static normalizeCurrency()

in src/objects/serverside/utils.js [122:133]


  static normalizeCurrency (currency: string) {
    currency = currency.trim().toLowerCase();

    // Retain only alpha characters bounded for ISO code.
    currency = currency.replace(/[^a-zA-Z]/g, '');

    if (!currency_codes.codes().includes(currency.toUpperCase())) {
      throw new Error("Invalid format for currency:'" + currency + "'.Please follow ISO 4217 3-letter standard for representing currency. Eg: usd");
    }

    return currency;
  }