Package Exports
- currency-converter-lt
- currency-converter-lt/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (currency-converter-lt) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
NodeJS Currency Converter
A minimal currency converter library for NodeJS that works out of the box.
Announcement : For crypto currency conversion, check my other package Nodejs Crypto Converter.
Getting started
Installation
This package can be installed using npm
npm install currency-converter-lt
or, yarn
yarn add currency-converter-lt
Usage
Import currency-converter-lt
.
const CC = require('currency-converter-lt')
Then instantiate with either the empty constructor
let currencyConverter = new CC()
Or, with a json object
let currencyConverter = new CC({from:"USD", to:"JPY", amount:100})
The convert method will return the conversion based on the last conversion rate and can be used as a promise.
currencyConverter.convert().then((response) => {
console.log(response) //or do something else
})
convert
can also take the amount as a parameter.
currencyConverter.convert(100).then((response) => {
console.log(response) //or do something else
})
To find the rates use the rates
method.
currencyConverter.rates().then((response) => {
console.log(response) //or do something else
})
Chaining is also supported.
currencyConverter.from("USD").to("GBP").amount(125).convert().then((response) => {
console.log(response) //or do something else
})
Issues
If any issues are found, they can be reported here.
License
This project is licensed under the MIT license.