Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
xchanger
Advanced tools
Readme
__
/\ \
__ _ ___\ \ \___ __ ___ __ __ _ __
/\ \/'\ /'___\ \ _ `\ /'__`\ /' _ `\ /'_ `\ /'__`\/\`'__\
\/> <//\ \__/\ \ \ \ \/\ \L\.\_/\ \/\ \/\ \L\ \/\ __/\ \ \/
/\_/\_\ \____\\ \_\ \_\ \__/.\_\ \_\ \_\ \____ \ \____\\ \_\
\//\/_/\/____/ \/_/\/_/\/__/\/_/\/_/\/_/\/___L\ \/____/ \/_/
/\____/
\_/__/
Currency converter with auto caching of exchange rates from exchangeratesapi.io
Its really simple to use. Just require the module and create a new xchange instance.
const XCHANGER = require('xchanger')
const xchange = new XCHANGER() // or new XCHANGER(<currency code>)
xchange.setBase('inr') //Set the base exchange currency to use as a default
// Convert to currency specified as base currency
xchange.convert(100, 'usd').then(result => {
// Since we specified INR as base
// the converted result will be in INR
console.log(result)
}).catch(error => {
console.log(error)
})
// Convert from usd to aud
xchange.convert(100, 'usd', 'aud').then(result => {
console.log(result)
}).catch(error => {
console.log(error)
})
// Get a list of supported currency codes
xchange.getValidCodes()
The module itself exports a constructor from which and exchange object can be created. Each exchange object has the following methods available -
Currently the api provides support for the 33 currencies listed below -
Thats it!
This module uses exchangeratesapi.io to fetch rates and caches them for 30 minutes. There is no functionality to reduce that time as of now. Therefore, the converted results from this module may vary from the real time results. Furthermore, the fact that it depends on the external API means the author has no control over the rates returned and is therefore not liable for any damage, loss or failure due to the use of this module.
All that being said, if you are looking to convert currencies with reasonable accuracy and real time isnt really your use case, then go to town with this.
Created and maintained by Hanut Singh Gusain
FAQs
Currency exhange api with auto caching of api calls for better performance and bandwidth utilization
We found that xchanger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).