ChemPare Documentation - v0.0.0
    Preparing search index...

    Function USDto

    • Converts a given amount from USD to any supported currency. Uses real-time exchange rates from the Hexarate API. Results are rounded to 2 decimal places for standard currency format.

      Parameters

      • amount: number

        The amount to convert

      • toCurrencyCode: valueof

        The target currency code (e.g., 'EUR', 'GBP')

      Returns Promise<number>

      The converted amount in the target currency, formatted to 2 decimal places

      // Convert 100 USD to EUR
      await USDto(100, 'EUR')
      // Returns 85.32 (if rate is 0.8532)

      // Convert 500 USD to GBP
      await USDto(500, 'GBP')
      // Returns 387.50 (if rate is 0.775)