Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
currency-library
Advanced tools
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 143 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.