1.0.2 • Published 3 years ago
@mrzaghar/node-currency-converter v1.0.2
Installation
npm install @mrzaghar/node-currency-converter
Usage
const currencyConverter = new (require('@mrzaghar/node-currency-converter'))
(async () => {
var toGbp =await currencyConverter.from('USD').to('GBP').convert(300);
// from USD to GBP
console.log(toGbp.result) // 216.88
console.log(toGbp.beautify) // £216.88
})()
Example
const currencyConverter = new (require('@mrzaghar/node-currency-converter'));
(async () => {
var toGbp =await currencyConverter.from('USD').to('GBP').convert(300);
var toEUR =await currencyConverter.from('GBP').to('EUR').convert(300);
// from USD to GBP
console.log(toGbp.result) // 216.88
console.log(toGbp.beautify) // £216.88
// from GBP to EUR
console.log(toEUR.result) // 352.38
console.log(toEUR.beautify) // €352.38
// Convert from Bitcoin to USD
var btcToUSD = await currencyConverter.from('BTC').to('USD').convert(1);
console.log(btcToUSD.result) // 58855.9
console.log(btcToUSD.beautify) // $58,855.90
})()