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'));
number(967)
var cc = require('currency-codes');
console.log(cc.number(967));
country('colombia')
var cc = require('currency-codes');
console.log(cc.country('colombia'));
codes()
var cc = require('currency-codes');
console.log(cc.codes());
numbers()
var cc = require('currency-codes');
console.log(cc.numbers());
countries()
var cc = require('currency-codes');
console.log(cc.countries());
data
var data = require('currency-codes/data');
console.log(data);
publishDate
var cc = require('currency-codes');
console.log(cc.publishDate);
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