Skip to content

Commit

Permalink
Fix #16 and includes #17, #18, #19, and #20 by @jasongitmail
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagodp committed Jan 11, 2024
1 parent 619bced commit 9042c2e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
13 changes: 11 additions & 2 deletions generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,18 @@ const inclusionsOrFixes = [
{ countryCode: 'HR', currencyCode: 'EUR' },
// According to ISO 4217, Netherlands Antilles ('AN') uses Netherlands Antillean Guilder, code 'ANG'. Thanks @jayPare
{ countryCode: 'AN', currencyCode: 'ANG' },
// According to Wikipedia, El Salvador (SV) change from 'SVC' to 'USD' since 2001. Thanks @chaitanya-d
// According to Wikipedia, El Salvador (SV) changed from 'SVC' to 'USD' since 2001. Thanks @chaitanya-d
{ countryCode: 'SV', currencyCode: 'USD' },
// According to Wikipedia and https://gov.gs, South Georgia and the South Sandwich Islands ('GS') uses the currency 'Falkland Islands Pound' ('FKP'). Thanks @danielrentz
{ countryCode: 'GS', currencyCode: 'FKP' },
// According to Wikipedia, Cuba (CU) changed from 'CUC' to 'CUP' since 2021. Thanks @jasongitmail
{ countryCode: 'CU', currencyCode: 'CUP' },
// According to Wikipedia, Hungary (HR) uses Forint ('HUF'). Thanks @jasongitmail
{ countryCode: 'HR', currencyCode: 'HUF' },
// According to Wikipedia, Samoa (WS) uses Tālā ('WST'). Thanks @jasongitmail
{ countryCode: 'WS', currencyCode: 'WST' },
// According to Wikipedia, Niger (NE) uses West African CFA Franc ('XOF'). Thanks @danielrentz
{ countryCode: 'NE', currencyCode: 'XOF' },
];

let inclusions = 0;
Expand Down Expand Up @@ -102,7 +110,8 @@ const sorted = Object.keys( result )
// Generate file
//

const content = 'const countryToCurrency = ' +
const content = '// This is a generated file - please do not modify it\n' +
'const countryToCurrency = ' +
JSON.stringify( sorted, null, 2 )
.replace(/"([A-Z]{2})":/g, '$1:')
.replace(/"/g, "'") +
Expand Down
9 changes: 5 additions & 4 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This is a generated file - please do not modify it
const countryToCurrency = {
AD: 'EUR',
AE: 'AED',
Expand Down Expand Up @@ -50,7 +51,7 @@ const countryToCurrency = {
CN: 'CNY',
CO: 'COP',
CR: 'CRC',
CU: 'CUC',
CU: 'CUP',
CV: 'CVE',
CW: 'ANG',
CX: 'AUD',
Expand Down Expand Up @@ -97,7 +98,7 @@ const countryToCurrency = {
HK: 'HKD',
HM: 'AUD',
HN: 'HNL',
HR: 'EUR',
HR: 'HUF',
HT: 'HTG',
HU: 'HUF',
ID: 'IDR',
Expand Down Expand Up @@ -161,7 +162,7 @@ const countryToCurrency = {
MZ: 'MZN',
NA: 'NAD',
NC: 'XPF',
NE: 'NGN',
NE: 'XOF',
NF: 'AUD',
NG: 'NGN',
NI: 'NIO',
Expand Down Expand Up @@ -243,7 +244,7 @@ const countryToCurrency = {
VN: 'VND',
VU: 'VUV',
WF: 'XPF',
WS: 'USD',
WS: 'WST',
YE: 'YER',
YT: 'EUR',
ZA: 'ZAR',
Expand Down
14 changes: 9 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,20 @@ console.log( countryToCurrency[ 'US' ] ); // USD

- Countries included: `250`.
- For `Antarctica` (`AQ`), the currency `USD` is being assumed.
- For `Palestine` (`PS`), the currency `ILS` is being assumed.
- For `South Korea` (`KR`), the currency `KRW` is being assumed.
- For `Switzerland` (`CH`), the currency `CHF` is being assumed.
- For `Chile` (`CLF`), the currency `CLP` is being assumed.
- For `Uruguay` (`UY`), the currency `UYU` is being assumed.
- For `Croatia` (`HR`), the currency `EUR` is being assumed since January 1st, 2023.
- For `Cuba` (`CU`), the currency `CUP` is being assumed since 2021.
- For `El Salvador` (`SV`), the currency `USD` is being assumed.
- For `Hungary` (`HR`), the currency `HUF` is being assumed.
- For `Niger` (`NE`), the currency `XOF` is being assumed.
- For `Palestine` (`PS`), the currency `ILS` is being assumed.
- For `Samoa` (`WS`), the currency `WST` is being assumed.
- For `South Georgia and the South Sandwich Islands` (`GS`), the currency `FKP` is being assumed.
- For `South Korea` (`KR`), the currency `KRW` is being assumed.
- For `Switzerland` (`CH`), the currency `CHF` is being assumed.
- For `Uruguay` (`UY`), the currency `UYU` is being assumed.

> _Suggestions? Please [open an Issue](https://github.com/thiagodp/country-to-currency/issues/new)._
> _Suggestions? Please [open an Issue](https://github.com/thiagodp/country-to-currency/issues/new). Pull Requests? Make sure to edit [generate.js](generate.js) instead of [index.ts](index.ts)._
## License

Expand Down

0 comments on commit 9042c2e

Please sign in to comment.