prajwal-money-convert
v1.1.3
Published
Package to convert money
Downloads
14
Readme
prajwal-money-convert
A simple money converter package to convert between different currencies.
Installation
You can install this package using npm:
npm install prajwal-money-convert
Usage
To use the moneyConverter function from the prajwal-money-convert package, you can import it and then call it with the appropriate parameters.
Importing the Package
First, import the moneyConverter function from the package:
import { moneyConverter } from 'prajwal-money-convert';
Using the moneyConverter Function
The moneyConverter function takes three parameters:
- The source currency (e.g., "USD")
- The target currency (e.g., "INR")
- The amount to convert
The function returns a promise that resolves with the converted amount. Here's an example of how to use the function:
moneyConverter('USD', 'INR', 3)
.then(res => console.log(res))
.catch(err => console.error(err));
Example
Here's a full example showing how to use the moneyConverter function:
import { moneyConverter } from 'prajwal-money-convert';
moneyConverter('USD', 'INR', 3)
.then(res => console.log(`Converted amount: ${res}`))
.catch(err => console.error(`Error: ${err.message}`));
Output
The output will be the converted amount from USD to INR. For example, if 1 USD is equal to 75 INR, the output will be:
Converted amount: 225