annexare / Countries

Countries, Languages & Continents data (capital and currency, native name, calling codes).
https://annexare.github.io/Countries/
MIT License
1.18k stars 429 forks source link

Default currency for Countries #97

Open shreyashah115 opened 2 years ago

shreyashah115 commented 2 years ago

Is there a way to add a default/ official currency for all countries?

Example, Switzerland has its official currency as CHF but in the currency array we have ['CHE', 'CHF', 'CHW'], either we can change the alphabetical order of array to have the official currency listed as first ['CHF', 'CHE', 'CHW'] or introduce a new field to only have the official one? This would help in cases where we need to show one of the currencies in form options based on country.

dmythro commented 2 years ago

So, there's like 6 countries which have more than 1 currency. And one of them is not sorted A-Z, the rest are. I think you're right, it's better to check all of them manually and fix the order to have first one as main official currency. Will do that with next release @shreyashah115.

image

But next release will be a major one and have a few breaking changes, as it will utilise couple new data structures and completely move to TypeScript for code, utils etc. Currencies is an array of string there now instead of a comma-separated string, by the way.