# currency-codes

> Lookup currency codes based on ISO 4217

Latest version **2.2.0** (published 2024-10-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install currency-codes
pnpm add currency-codes
yarn add currency-codes
bun add currency-codes
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2024-10-23 |
| First published | 2013-10-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 84.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 165 |
| Maintainers | freeall |
| Keywords | iso4217, iso, 4217, currency, currencies, code, codes, lookup |

## Links

- npm: https://www.npmjs.com/package/currency-codes
- Repository: https://github.com/freeall/currency-codes
- Homepage: https://github.com/freeall/currency-codes#readme
- Issues: https://github.com/freeall/currency-codes/issues
- npm.io page: https://npm.io/package/currency-codes

## Dependencies (2)

- [nub](https://npm.io/package/nub.md) ~0.0.0
- [first-match](https://npm.io/package/first-match.md) ~0.0.1

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 2.2.0 (latest) — 2024-10-23
- 2.1.0 — 2020-02-11
- 2.0.0 — 2020-02-03
- 1.5.1 — 2019-10-30
- 1.5.0 — 2018-08-24
- 1.4.0 — 2018-08-06
- 1.3.0 — 2018-05-07
- 1.2.0 — 2018-04-11
- 1.1.2 — 2015-08-07
- 1.1.1 — 2015-07-23
- 1.1.0 — 2014-04-16
- 1.0.2 — 2013-10-02
- 1.0.1 — 2013-10-01
- 1.0.0 — 2013-10-01

## README

# currency-codes

A node.js module to list and work on currency codes based on the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) standard.

	npm install currency-codes

## code('EUR')

``` js
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)

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

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

## country('colombia')

``` js
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()

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

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

## numbers()

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

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

## countries()

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

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

## data

``` js
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

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

console.log(cc.publishDate);

/*
2024-06-25
*/
```

## Updating the data

Fetch the latest copy of ISO-4217 from the [maintainer](https://www.iso.org/iso-4217-currency-codes.html) and update this library's currency data file.

```bash
$ npm run iso

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


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

Downloaded https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml to iso-4217-list-one.xml

> currency-codes@2.1.0 iso:ingest-xml
> 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

---
_Source: https://npm.io/package/currency-codes · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
