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.
ecb-euro-fx
Advanced tools
Readme
The ecb publishes a daily feed with the latest euro foreign exchange rates (in XML format). This module parses this feed and convert it into a handy javascript object that can be used in any related FX calculations involving the Euro and other currencies.
You can install with [npm]:
$ npm install --save ecb-euro-fx
The module doesn't require any parameters, but it returns a promise that needs to be handled to use the resulting object:
const ecbFx = require('ecb-euro-fx')
ecbFx().then(ratesObj => { console.log(ratesObj) })
// It will show in the console, an object like:
// { subject: 'Reference rates',
// sender: 'European Central Bank',
// time: '2019-05-08',
// rates:
// [ { currency: 'USD', rate: '1.1202' },
// { currency: 'JPY', rate: '123.31' },
// { currency: 'BGN', rate: '1.9558' },
// { currency: 'CZK', rate: '25.727' },
// ...
// ratesBySymbol:
// { USD: 1.1202,
// JPY: 123.31,
// BGN: 1.9558,
// CZK: 25.727,
Note that the module returns an array of objects with the rates (as in the ECB feed), but it also provides an object with the ratesBySymbol
. You can use this object to right away calculate the FX for a particular rate.
Let's say you want to calculate how many dollars are 50 euro today?
const ecbFx = require('ecb-euro-fx')
ecbFx().then(ratesObj => {
const dollars = parseInt(50 * ratesObj.ratesBySymbol.USD)
console.log(`50 Euro are ${dollars} Dollars`)
})
// It will show in the console the dollars with the current FX
Both the request to the ECB servers and the object conversion are cached, so any subsequent call to the module should be really fast.
You can run the tests with JEST and check the functionality of this module using:
$ npm install && npm test
Copyright © 2019, Juan Convers. Released under the MIT License.
FAQs
Module to get eurofxref daily feeds from ECB and returns them in a nice object format.
The npm package ecb-euro-fx receives a total of 2 weekly downloads. As such, ecb-euro-fx popularity was classified as not popular.
We found that ecb-euro-fx 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.