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 = ;console;/*{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 = ;console;/*{code: 'ZMW',number: 967,digits: 2,currency: 'Zambian kwacha',countries: [ 'zambia' ] }*/
country('colombia')
var cc = ;console;/*[{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 = ;console;/*['AED','AFN',...'ZAR','ZMW']*/
numbers()
var cc = ;console;/*['784','971',...'710','967']*/
countries()
var cc = ;console;/*['united arab emirates','afghanistan',...]*/
data
var data = ;console;/*[{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 = ; console; /*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.jsWrote publish date to iso-4217-publish-date.js
Note: You may have to manually tweak the capitalization of some country's names.
License
MIT