A simple Node.js package for converting currencies using the cc-currency-converter library.
Install the package using npm:
npm install cc-currency-converter
Import the package by using the following block of code
import { convertCurrency } from "cc-currency-converter";
convertCurrency("USD", "INR", 4)
.then((result) => {
console.log(result);
})
.catch((error) => {
console.error("Error:", error.message);
});
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.
If you find a bug or have a feature request, please open an issue or submit a pull request. Contributions are welcome!