You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

currency-codes

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

currency-codes

Lookup currency codes based on ISO 4217


Version published
Weekly downloads
221K
decreased by-7.54%
Maintainers
1
Install size
96.2 kB
Created
Weekly downloads
 

Package description

What is currency-codes?

The currency-codes npm package provides a comprehensive list of currency codes and related information based on the ISO 4217 standard. It allows users to look up currency codes, names, and other related data.

What are currency-codes's main functionalities?

Get currency by code

This feature allows you to retrieve information about a currency using its code. For example, 'USD' will return details about the US Dollar.

const currencyCodes = require('currency-codes');
const currency = currencyCodes.code('USD');
console.log(currency);

Get currency by number

This feature allows you to retrieve information about a currency using its numeric code. For example, '840' will return details about the US Dollar.

const currencyCodes = require('currency-codes');
const currency = currencyCodes.number('840');
console.log(currency);

Get currency by countries

This feature allows you to retrieve a list of currencies used in a specific country. For example, 'United States' will return the US Dollar.

const currencyCodes = require('currency-codes');
const currencies = currencyCodes.countries('United States');
console.log(currencies);

Get all currency codes

This feature allows you to retrieve a list of all currency codes available in the package.

const currencyCodes = require('currency-codes');
const allCurrencies = currencyCodes.codes();
console.log(allCurrencies);

Other packages similar to currency-codes

Readme

Source

currency-codes

A node.js module to list and work on currency codes based on the ISO 4217 standard.

npm install currency-codes

code('EUR')

var cc = require('currency-codes');
console.log(cc.code('EUR'));

/*
{
	code: 'EUR',
	number: 978,
	digits: 2,
	currency: 'Euro',
	countries: [
		'andorra', 'austria', 'belgium', 'cyprus', 'estonia', 'finland',
		'france', 'germany', 'greece', 'ireland', 'italy', 'kosovo',
		'luxembourg', 'malta', 'monaco', 'montenegro', 'netherlands',
		'portugal', 'san marino', 'slovakia', 'slovenia', 'spain',
		'vatican city' ]
}
*/

number(967)

var cc = require('currency-codes');
console.log(cc.number(967));

/*
{
	code: 'ZMW',
	number: 967,
	digits: 2,
	currency: 'Zambian kwacha',
	countries: [ 'zambia' ] }
*/

country('colombia')

var cc = require('currency-codes');
console.log(cc.country('colombia'));

/*
[
	{
		code: 'COP',
		number: 170,
		digits: 2,
		currency: 'Colombian peso',
		countries: [ 'colombia' ]
	}, {
		code: 'COU',
		number: 970,
		digits: 2,
		currency: 'Unidad de Valor Real',
		countries: [ 'colombia' ]
	}
]
*/

codes()

var cc = require('currency-codes');
console.log(cc.codes());

/*
[
	'AED',
	'AFN',
	...
	'ZAR',
	'ZMW'
]
*/

numbers()

var cc = require('currency-codes');
console.log(cc.numbers());

/*
[
	'784',
	'971',
	...
	'710',
	'967'
]
*/

countries()

var cc = require('currency-codes');
console.log(cc.countries());

/*
[ 
	'united arab emirates',
	'afghanistan',
	...
]
*/

data

var data = require('currency-codes/data');
console.log(data);

/*
[{
	code: 'AED',
	number: '784',
	digits: 2,
	currency: 'United Arab Emirates dirham',
	countries: ['united arab emirates']
}, {
	code: 'AFN',
	number: '971',
	digits: 2,
	currency: 'Afghan afghani',
	countries: ['afghanistan']
}, {
	...
*/

publishDate

var cc = require('currency-codes');

console.log(cc.publishDate);

/*
2018-08-29
*/

ISO-4217

Fetch the latest copy of ISO-4217 from the maintainer and update this library's currency data file.

$ npm run iso

> currency-codes@1.5.1 iso currency-codes
> npm run iso:fetch-xml && npm run iso:ingest-xml


> currency-codes@1.5.1 iso:fetch-xml currency-codes
> node scripts/fetch-iso-4217-xml.js

Downloaded https://www.currency-iso.org/dam/downloads/lists/list_one.xml to iso-4217-list-one.xml

> currency-codes@1.5.1 iso:ingest-xml currency-codes
> node scripts/ingest-iso-4217-xml.js

Ingested iso-4217-list-one.xml into data.js
Wrote publish date to iso-4217-publish-date.js

Note: You may have to manually tweak the capitalization of some country's names.

License

MIT

Keywords

FAQs

Package last updated on 11 Feb 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc