/cc-currency-converter

An npm package to convert currencies

Primary LanguageJavaScriptApache License 2.0Apache-2.0

Currency Converter Node Package

A simple Node.js package for converting currencies using the cc-currency-converter library.

Installation

Install the package using npm:

npm install cc-currency-converter

Import

Import the package by using the following block of code

import { convertCurrency } from "cc-currency-converter";

Ussage

convertCurrency("USD", "INR", 4)
  .then((result) => {
    console.log(result);
  })
  .catch((error) => {
    console.error("Error:", error.message);
  });

API

convertCurrency(sourceCurrency, targetCurrency, amount)
Converts the given amount from the source currency to the target currency.

sourceCurrency: The currency code of the source currency (e.g., "USD").
targetCurrency: The currency code of the target currency (e.g., "INR").
amount: The amount to convert.
Returns a Promise that resolves to the converted amount.

Contributing

If you find a bug or have a feature request, please open an issue or submit a pull request. Contributions are welcome!