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.
currency-library
Advanced tools
Readme
Easily get data about different currencies in Javascript
None
Returns object with ISO currency code as a key
const currencyLibrary = require('currency-library');
// OR
import * as currencyLibrary from 'currency-library';
console.log(currencyLibrary.getAll());
/** =>
{
//...
USD: {
isoCode: 'USD',
numericCode: '840',
minorUnits: 2,
name: 'United States dollar',
symbol: '$'
},
UAH: {
isoCode: 'UAH',
numericCode: '980',
minorUnits: 2,
name: 'Ukrainian hryvnia',
symbol: '₴'
},
// ...
}
**/
Expects ISO code string as only parameter
Returns currency object or undefined if currency not found
const currencyLibrary = require('currency-library');
// OR
import * as currencyLibrary from 'currency-library';
console.log(currencyLibrary.getByIsoCode('UAH'));
/** =>
{
isoCode: 'UAH',
numericCode: '980',
minorUnits: 2,
name: 'Ukrainian hryvnia',
symbol: '₴'
}
**/
console.log(currencyLibrary.getByIsoCode('WRONG CODE'));
// => undefined
Expects numeric currency code as only parameter
Returns currency object or undefined if currency not found
const currencyLibrary = require('currency-library');
// OR
import * as currencyLibrary from 'currency-library';
console.log(currencyLibrary.getByNumericCode(980));
/** =>
{
isoCode: 'UAH',
numericCode: '980',
minorUnits: 2,
name: 'Ukrainian hryvnia',
symbol: '₴'
}
**/
console.log(currencyLibrary.getByNumericCode(-1));
// => undefined
Expects symbol parameter as only parameter
Returns currency object or undefined if currency not found
const currencyLibrary = require('currency-library');
// OR
import * as currencyLibrary from 'currency-library';
console.log(currencyLibrary.getBySymbol('₴'));
/** =>
{
isoCode: 'UAH',
numericCode: '980',
minorUnits: 2,
name: 'Ukrainian hryvnia',
symbol: '₴'
}
**/
console.log(currencyLibrary.getBySymbol('~'));
// => undefined
Run tests:
npm test -- --coverage
FAQs
Easily get data about different currencies
The npm package currency-library receives a total of 97 weekly downloads. As such, currency-library popularity was classified as not popular.
We found that currency-library 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.