nodejs-currency-converter
Version:
A simple currency converter based on fixer.io
42 lines (26 loc) • 1.46 kB
Markdown
# NodeJS Currency Converter
[](https://travis-ci.org/arthurmbandeira/nodejs-currency-converter)
[](https://david-dm.org/arthurmbandeira/node-currency-converter/)
[](https://david-dm.org/arthurmbandeira/node-currency-converter/)
A simple currency converter based on [fixer.io](http://fixer.io).
## Getting started
### Installation
This package can be installed using npm
```
npm install nodejs-currency-converter
```
### Usage
Import `nodejs-currency-converter` and use it as a Promise.
```
const convertCurrency = require('nodejs-currency-converter');
convertCurrency(1, 'USD', 'BRL').then(response => response);
```
Without the last parameter, the function will return the currency based on the current day conversion. To pass the date to convert, pass the last parameter in the format `YYYY-MM-DD`.
```
const convertCurrency = require('nodejs-currency-converter');
convertCurrency(1, 'EUR', 'BRL', '2015-08-29').then(response => response);
```
## Issues
If any issues are found, they can be reported [here](https://github.com/arthurmbandeira/nodejs-currency-converter/issues).
## License
This project is licensed under the [MIT](LICENSE) license.