Repository: validatorjs/validator.js
Pull request #2332 (2023-10-27 16:04:07)

feat(isISO4217): update iso4217 currency codes according to wiki
<!--
Add a descriptive title textbox above, e.g.
feat(validatorName): brief title of what has been done
-->
feat(isISO4217): update iso4217 currency codes according to wiki

<!--- briefly describe what you have done in this PR --->
- Removed 'CUC' and 'HRK' currency codes

| Code | Num | D | Currency               | From       | Until      | Replaced by |
|------|-----|---|------------------------|------------|------------|-------------|
| HRK  | 191 | 2 | [Croatian kuna](https://en.wikipedia.org/wiki/Croatian_kuna)          | 1994-05-30 | 2023-01-01 | EUR[[31]](https://en.wikipedia.org/wiki/ISO_4217#cite_note-Amendment_174-40)        |
| CUC  | 931 | 2 | [Cuban convertible peso](https://en.wikipedia.org/wiki/Cuban_convertible_peso) |            | 2022       | CUP         |

- Added 'SLE' and 'VED' currency codes

| Code | Num | D | Currency                                     | Locations      |
|------|-----|---|----------------------------------------------|----------------|
| SLE  | 925 | 2 | [Sierra Leonean leone (new leone)](https://en.wikipedia.org/wiki/Sierra_Leonean_leone)[[12]](https://en.wikipedia.org/wiki/ISO_4217#cite_note-A171-18)[[13]](https://en.wikipedia.org/wiki/ISO_4217#cite_note-A172-19)[[14]](https://en.wikipedia.org/wiki/ISO_4217#cite_note-A173-20) |![image](https://github.com/validatorjs/validator.js/assets/17348349/e1e10efb-20b9-493b-bda5-ece165146959) [Sierra Leone](https://en.wikipedia.org/wiki/Sierra_Leone) |
| VED  | 926 | 2 | [Venezuelan digital bolívar](https://en.wikipedia.org/wiki/Venezuelan_bol%C3%ADvar#Digital_bol%C3%ADvar)[[18]](https://en.wikipedia.org/wiki/ISO_4217#cite_note-A170-24)               | ![image](https://github.com/validatorjs/validator.js/assets/17348349/aaee9f85-8a45-4781-95b3-68f0741fd60b) [Venezuela](https://en.wikipedia.org/wiki/Venezuela)    |

<!--- provide some (credible) references showing the structure of the data to be validated, if applicable --->
Resources:

- https://en.wikipedia.org/wiki/ISO_4217#Active_codes_(List_One)

## Checklist

- [x] PR contains only changes related; no stray files, etc.
- [x] README updated (where applicable)
- [x] Tests written (where applicable)
- [x] References provided in PR (where applicable)


codecov[bot]: We're currently processing your upload.  This comment will be updated when the results are available.

Patch:
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index feab2fa..799e413 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -14,6 +14,9 @@ A clear and concise description of what the bug is.
 **Examples**
 If applicable, add screenshots to help explain your problem.
 
+**Reproductions**
+If applicable, provide a reproduction on platforms like [runkit](npm.runkit.com/validator)
+
 **Additional context**
 Validator.js version:
 Node.js version:
diff --git a/src/lib/isISO4217.js b/src/lib/isISO4217.js
index 076d5a6..bbca596 100644
--- a/src/lib/isISO4217.js
+++ b/src/lib/isISO4217.js
@@ -4,12 +4,12 @@ import assertString from './util/assertString';
 const validISO4217CurrencyCodes = new Set([
   'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AWG', 'AZN',
   'BAM', 'BBD', 'BDT', 'BGN', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BOV', 'BRL', 'BSD', 'BTN', 'BWP', 'BYN', 'BZD',
-  'CAD', 'CDF', 'CHE', 'CHF', 'CHW', 'CLF', 'CLP', 'CNY', 'COP', 'COU', 'CRC', 'CUC', 'CUP', 'CVE', 'CZK',
+  'CAD', 'CDF', 'CHE', 'CHF', 'CHW', 'CLF', 'CLP', 'CNY', 'COP', 'COU', 'CRC', 'CUP', 'CVE', 'CZK',
   'DJF', 'DKK', 'DOP', 'DZD',
   'EGP', 'ERN', 'ETB', 'EUR',
   'FJD', 'FKP',
   'GBP', 'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GTQ', 'GYD',
-  'HKD', 'HNL', 'HRK', 'HTG', 'HUF',
+  'HKD', 'HNL', 'HTG', 'HUF',
   'IDR', 'ILS', 'INR', 'IQD', 'IRR', 'ISK',
   'JMD', 'JOD', 'JPY',
   'KES', 'KGS', 'KHR', 'KMF', 'KPW', 'KRW', 'KWD', 'KYD', 'KZT',
@@ -23,7 +23,7 @@ const validISO4217CurrencyCodes = new Set([
   'SAR', 'SBD', 'SCR', 'SDG', 'SEK', 'SGD', 'SHP', 'SLE', 'SLL', 'SOS', 'SRD', 'SSP', 'STN', 'SVC', 'SYP', 'SZL',
   'THB', 'TJS', 'TMT', 'TND', 'TOP', 'TRY', 'TTD', 'TWD', 'TZS',
   'UAH', 'UGX', 'USD', 'USN', 'UYI', 'UYU', 'UYW', 'UZS',
-  'VES', 'VND', 'VUV',
+  'VED', 'VES', 'VND', 'VUV',
   'WST',
   'XAF', 'XAG', 'XAU', 'XBA', 'XBB', 'XBC', 'XBD', 'XCD', 'XDR', 'XOF', 'XPD', 'XPF', 'XPT', 'XSU', 'XTS', 'XUA', 'XXX',
   'YER',


Test patch:
diff --git a/test/validators.test.js b/test/validators.test.js
index 1b69f7e..54dbfb1 100644
--- a/test/validators.test.js
+++ b/test/validators.test.js
@@ -11679,13 +11679,15 @@ describe('Validators', () => {
         'AED',
         'aed',
         'AUD',
-        'CUC',
+        'CUP',
         'EUR',
         'GBP',
         'LYD',
         'MYR',
         'SGD',
+        'SLE',
         'USD',
+        'VED',
         'SLE',
       ],
       invalid: [
@@ -11698,6 +11700,8 @@ describe('Validators', () => {
         'RWA',
         'EURO',
         'euro',
+        'HRK',
+        'CUC',
       ],
     });
   });