From 9042c2e1fc242c150b207b7245c4e9aa3de6c53a Mon Sep 17 00:00:00 2001 From: Thiago Delgado Pinto Date: Wed, 10 Jan 2024 22:18:01 -0300 Subject: [PATCH] Fix #16 and includes #17, #18, #19, and #20 by @jasongitmail --- generate.js | 13 +++++++++++-- index.ts | 9 +++++---- readme.md | 14 +++++++++----- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/generate.js b/generate.js index c40ebf1..58f669e 100644 --- a/generate.js +++ b/generate.js @@ -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; @@ -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, "'") + diff --git a/index.ts b/index.ts index 5fac5f9..d2eaf4f 100644 --- a/index.ts +++ b/index.ts @@ -1,3 +1,4 @@ +// This is a generated file - please do not modify it const countryToCurrency = { AD: 'EUR', AE: 'AED', @@ -50,7 +51,7 @@ const countryToCurrency = { CN: 'CNY', CO: 'COP', CR: 'CRC', - CU: 'CUC', + CU: 'CUP', CV: 'CVE', CW: 'ANG', CX: 'AUD', @@ -97,7 +98,7 @@ const countryToCurrency = { HK: 'HKD', HM: 'AUD', HN: 'HNL', - HR: 'EUR', + HR: 'HUF', HT: 'HTG', HU: 'HUF', ID: 'IDR', @@ -161,7 +162,7 @@ const countryToCurrency = { MZ: 'MZN', NA: 'NAD', NC: 'XPF', - NE: 'NGN', + NE: 'XOF', NF: 'AUD', NG: 'NGN', NI: 'NIO', @@ -243,7 +244,7 @@ const countryToCurrency = { VN: 'VND', VU: 'VUV', WF: 'XPF', - WS: 'USD', + WS: 'WST', YE: 'YER', YT: 'EUR', ZA: 'ZAR', diff --git a/readme.md b/readme.md index f8e214c..23b129f 100644 --- a/readme.md +++ b/readme.md @@ -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