Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
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
The npm package xchanger receives a total of 2 weekly downloads. As such, xchanger popularity was classified as not popular.
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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.