ngx-iban-validator 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +120 -113
- package/dist/README.md +120 -113
- package/dist/code-lengths.js +1 -0
- package/dist/iban.validator.js +2 -2
- package/dist/iban.validator.spec.js +13 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# IBAN Validator
|
|
2
2
|
|
|
3
|
-
IBAN Validator for your web application forms ([Angular](#angular), [React](#react), Vue, ...), comes without any dependencies and can be used as a standalone function in any JS project. It can perform format, digit and length IBAN validations. Currently [
|
|
3
|
+
IBAN Validator for your web application forms ([Angular](#angular), [React](#react), Vue, ...), comes without any dependencies and can be used as a standalone function in any JS project. It can perform format, digit and length IBAN validations. Currently [112 countries](#supported-countries) are supported.
|
|
4
4
|
|
|
5
5
|
## Content
|
|
6
6
|
|
|
@@ -280,118 +280,119 @@ Check demo applications for usage examples:
|
|
|
280
280
|
Click here to expand list of supported countries
|
|
281
281
|
</summary>
|
|
282
282
|
|
|
283
|
-
| Country | Country Code | Length |
|
|
284
|
-
| ------------------------ | ------------ | ------ |
|
|
285
|
-
| Albania | AL | 28 |
|
|
286
|
-
| Algeria | DZ | 26 |
|
|
287
|
-
| Andorra | AD | 24 |
|
|
288
|
-
| Angola | AO | 25 |
|
|
289
|
-
| Austria | AT | 20 |
|
|
290
|
-
| Azerbaijan | AZ | 28 |
|
|
291
|
-
| Bahrain | BH | 22 |
|
|
292
|
-
| Belarus | BY | 28 |
|
|
293
|
-
| Belgium | BE | 16 |
|
|
294
|
-
| Benin | BJ | 28 |
|
|
295
|
-
| Bosnia and Herzegovina | BA | 20 |
|
|
296
|
-
| Brazil | BR | 29 |
|
|
297
|
-
| Bulgaria | BG | 22 |
|
|
298
|
-
| Burundi | BI | 27 |
|
|
299
|
-
| Burkina Faso | BF | 28 |
|
|
300
|
-
| Cameroon | CM | 27 |
|
|
301
|
-
| Cape Verde | CV | 25 |
|
|
302
|
-
| Central African Republic | CF | 27 |
|
|
303
|
-
| Chad | TD | 27 |
|
|
304
|
-
| Comoros | KM | 27 |
|
|
305
|
-
| Congo | CG | 27 |
|
|
306
|
-
| Costa Rica | CR | 22 |
|
|
307
|
-
| Croatia | HR | 21 |
|
|
308
|
-
| Cyprus | CY | 28 |
|
|
309
|
-
| Czech Republic | CZ | 24 |
|
|
310
|
-
| Denmark | DK | 18 |
|
|
311
|
-
| Djibouti | DJ | 27 |
|
|
312
|
-
| Dominican Republic | DO | 28 |
|
|
313
|
-
| Egypt | EG | 29 |
|
|
314
|
-
| El Salvador | SV | 28 |
|
|
315
|
-
| Equatorial Guinea | GQ | 27 |
|
|
316
|
-
| Estonia | EE | 20 |
|
|
317
|
-
| Falkland Islands | FK | 18 |
|
|
318
|
-
| Faroe Islands | FO | 18 |
|
|
319
|
-
| Finland | FI | 18 |
|
|
320
|
-
| France | FR | 27 |
|
|
321
|
-
| Gabon | GA | 27 |
|
|
322
|
-
| Georgia | GE | 22 |
|
|
323
|
-
| Germany | DE | 22 |
|
|
324
|
-
| Gibraltar | GI | 23 |
|
|
325
|
-
| Greece | GR | 27 |
|
|
326
|
-
| Greenland | GL | 18 |
|
|
327
|
-
| Guatemala | GT | 28 |
|
|
328
|
-
| Guinea-Bissau | GW | 25 |
|
|
329
|
-
| Vatican | VA | 22 |
|
|
330
|
-
| Honduras | HN | 28 |
|
|
331
|
-
| Hungary | HU | 28 |
|
|
332
|
-
| Iceland | IS | 26 |
|
|
333
|
-
| Iran | IR | 26 |
|
|
334
|
-
| Iraq | IQ | 23 |
|
|
335
|
-
| Ireland | IE | 22 |
|
|
336
|
-
| Israel | IL | 23 |
|
|
337
|
-
| Italy | IT | 27 |
|
|
338
|
-
| Ivory Coast | CI | 28 |
|
|
339
|
-
| Jordan | JO | 30 |
|
|
340
|
-
| Kazakhstan | KZ | 20 |
|
|
341
|
-
| Kosovo | XK | 20 |
|
|
342
|
-
| Kuwait | KW | 30 |
|
|
343
|
-
| Latvia | LV | 21 |
|
|
344
|
-
| Lebanon | LB | 28 |
|
|
345
|
-
| Libya | LY | 25 |
|
|
346
|
-
| Liechtenstein | LI | 21 |
|
|
347
|
-
| Lithuania | LT | 20 |
|
|
348
|
-
| Luxembourg | LU | 20 |
|
|
349
|
-
| Madagascar | MG | 27 |
|
|
350
|
-
| Mali | ML | 28 |
|
|
351
|
-
| Malta | MT | 31 |
|
|
352
|
-
| Mauritania | MR | 27 |
|
|
353
|
-
| Mauritius | MU | 30 |
|
|
354
|
-
| Moldova | MD | 24 |
|
|
355
|
-
| Monaco | MC | 27 |
|
|
356
|
-
| Mongolia | MN | 20 |
|
|
357
|
-
| Montenegro | ME | 22 |
|
|
358
|
-
| Morocco | MA | 28 |
|
|
359
|
-
| Mozambique | MZ | 25 |
|
|
360
|
-
| Netherlands | NL | 18 |
|
|
361
|
-
| Nicaragua | NI | 28 |
|
|
362
|
-
| Niger | NE | 28 |
|
|
363
|
-
| North Macedonia | MK | 19 |
|
|
364
|
-
| Norway | NO | 15 |
|
|
365
|
-
| Pakistan | PK | 24 |
|
|
366
|
-
| Palestine | PS | 29 |
|
|
367
|
-
| Poland | PL | 28 |
|
|
368
|
-
| Portugal | PT | 25 |
|
|
369
|
-
| Qatar | QA | 29 |
|
|
370
|
-
| Romania | RO | 24 |
|
|
371
|
-
| Russia | RU | 33 |
|
|
372
|
-
| Saint Lucia | LC | 32 |
|
|
373
|
-
| San Marino | SM | 27 |
|
|
374
|
-
| Sao Tome and Principe | ST | 25 |
|
|
375
|
-
| Saudi Arabia | SA | 24 |
|
|
376
|
-
| Senegal | SN | 28 |
|
|
377
|
-
| Serbia | RS | 22 |
|
|
378
|
-
| Seychelles | SC | 31 |
|
|
379
|
-
| Slovak Republic | SK | 24 |
|
|
380
|
-
| Slovenia | SI | 19 |
|
|
381
|
-
| Somalia | SO | 23 |
|
|
382
|
-
| Spain | ES | 24 |
|
|
383
|
-
| Sudan | SD | 18 |
|
|
384
|
-
| Sultanate of Oman | OM | 23 |
|
|
385
|
-
| Sweden | SE | 24 |
|
|
386
|
-
| Switzerland | CH | 21 |
|
|
387
|
-
| Timor-Leste | TL | 23 |
|
|
388
|
-
| Togo | TG | 28 |
|
|
389
|
-
| Tunisia | TN | 24 |
|
|
390
|
-
| Turkey | TR | 26 |
|
|
391
|
-
| Ukraine | UA | 29 |
|
|
392
|
-
| United Arab Emirates | AE | 23 |
|
|
393
|
-
| United Kingdom | GB | 22 |
|
|
394
|
-
| Virgin Islands, British | VG | 24 |
|
|
283
|
+
| No | Country | Country Code | Length |
|
|
284
|
+
| --- | ------------------------ | ------------ | ------ |
|
|
285
|
+
| 1 | Albania | AL | 28 |
|
|
286
|
+
| 2 | Algeria | DZ | 26 |
|
|
287
|
+
| 3 | Andorra | AD | 24 |
|
|
288
|
+
| 4 | Angola | AO | 25 |
|
|
289
|
+
| 5 | Austria | AT | 20 |
|
|
290
|
+
| 6 | Azerbaijan | AZ | 28 |
|
|
291
|
+
| 7 | Bahrain | BH | 22 |
|
|
292
|
+
| 8 | Belarus | BY | 28 |
|
|
293
|
+
| 9 | Belgium | BE | 16 |
|
|
294
|
+
| 10 | Benin | BJ | 28 |
|
|
295
|
+
| 11 | Bosnia and Herzegovina | BA | 20 |
|
|
296
|
+
| 12 | Brazil | BR | 29 |
|
|
297
|
+
| 13 | Bulgaria | BG | 22 |
|
|
298
|
+
| 14 | Burundi | BI | 27 |
|
|
299
|
+
| 15 | Burkina Faso | BF | 28 |
|
|
300
|
+
| 16 | Cameroon | CM | 27 |
|
|
301
|
+
| 17 | Cape Verde | CV | 25 |
|
|
302
|
+
| 18 | Central African Republic | CF | 27 |
|
|
303
|
+
| 19 | Chad | TD | 27 |
|
|
304
|
+
| 20 | Comoros | KM | 27 |
|
|
305
|
+
| 21 | Congo | CG | 27 |
|
|
306
|
+
| 22 | Costa Rica | CR | 22 |
|
|
307
|
+
| 23 | Croatia | HR | 21 |
|
|
308
|
+
| 24 | Cyprus | CY | 28 |
|
|
309
|
+
| 25 | Czech Republic | CZ | 24 |
|
|
310
|
+
| 26 | Denmark | DK | 18 |
|
|
311
|
+
| 27 | Djibouti | DJ | 27 |
|
|
312
|
+
| 28 | Dominican Republic | DO | 28 |
|
|
313
|
+
| 29 | Egypt | EG | 29 |
|
|
314
|
+
| 30 | El Salvador | SV | 28 |
|
|
315
|
+
| 32 | Equatorial Guinea | GQ | 27 |
|
|
316
|
+
| 33 | Estonia | EE | 20 |
|
|
317
|
+
| 34 | Falkland Islands | FK | 18 |
|
|
318
|
+
| 35 | Faroe Islands | FO | 18 |
|
|
319
|
+
| 36 | Finland | FI | 18 |
|
|
320
|
+
| 37 | France | FR | 27 |
|
|
321
|
+
| 38 | Gabon | GA | 27 |
|
|
322
|
+
| 39 | Georgia | GE | 22 |
|
|
323
|
+
| 40 | Germany | DE | 22 |
|
|
324
|
+
| 41 | Gibraltar | GI | 23 |
|
|
325
|
+
| 42 | Greece | GR | 27 |
|
|
326
|
+
| 43 | Greenland | GL | 18 |
|
|
327
|
+
| 44 | Guatemala | GT | 28 |
|
|
328
|
+
| 45 | Guinea-Bissau | GW | 25 |
|
|
329
|
+
| 46 | Vatican | VA | 22 |
|
|
330
|
+
| 47 | Honduras | HN | 28 |
|
|
331
|
+
| 48 | Hungary | HU | 28 |
|
|
332
|
+
| 49 | Iceland | IS | 26 |
|
|
333
|
+
| 50 | Iran | IR | 26 |
|
|
334
|
+
| 51 | Iraq | IQ | 23 |
|
|
335
|
+
| 52 | Ireland | IE | 22 |
|
|
336
|
+
| 53 | Israel | IL | 23 |
|
|
337
|
+
| 54 | Italy | IT | 27 |
|
|
338
|
+
| 55 | Ivory Coast | CI | 28 |
|
|
339
|
+
| 56 | Jordan | JO | 30 |
|
|
340
|
+
| 57 | Kazakhstan | KZ | 20 |
|
|
341
|
+
| 58 | Kosovo | XK | 20 |
|
|
342
|
+
| 59 | Kuwait | KW | 30 |
|
|
343
|
+
| 60 | Latvia | LV | 21 |
|
|
344
|
+
| 61 | Lebanon | LB | 28 |
|
|
345
|
+
| 62 | Libya | LY | 25 |
|
|
346
|
+
| 63 | Liechtenstein | LI | 21 |
|
|
347
|
+
| 64 | Lithuania | LT | 20 |
|
|
348
|
+
| 65 | Luxembourg | LU | 20 |
|
|
349
|
+
| 66 | Madagascar | MG | 27 |
|
|
350
|
+
| 67 | Mali | ML | 28 |
|
|
351
|
+
| 68 | Malta | MT | 31 |
|
|
352
|
+
| 69 | Mauritania | MR | 27 |
|
|
353
|
+
| 70 | Mauritius | MU | 30 |
|
|
354
|
+
| 71 | Moldova | MD | 24 |
|
|
355
|
+
| 72 | Monaco | MC | 27 |
|
|
356
|
+
| 73 | Mongolia | MN | 20 |
|
|
357
|
+
| 74 | Montenegro | ME | 22 |
|
|
358
|
+
| 75 | Morocco | MA | 28 |
|
|
359
|
+
| 76 | Mozambique | MZ | 25 |
|
|
360
|
+
| 77 | Netherlands | NL | 18 |
|
|
361
|
+
| 78 | Nicaragua | NI | 28 |
|
|
362
|
+
| 79 | Niger | NE | 28 |
|
|
363
|
+
| 80 | North Macedonia | MK | 19 |
|
|
364
|
+
| 81 | Norway | NO | 15 |
|
|
365
|
+
| 82 | Pakistan | PK | 24 |
|
|
366
|
+
| 83 | Palestine | PS | 29 |
|
|
367
|
+
| 84 | Poland | PL | 28 |
|
|
368
|
+
| 85 | Portugal | PT | 25 |
|
|
369
|
+
| 86 | Qatar | QA | 29 |
|
|
370
|
+
| 87 | Romania | RO | 24 |
|
|
371
|
+
| 88 | Russia | RU | 33 |
|
|
372
|
+
| 89 | Saint Lucia | LC | 32 |
|
|
373
|
+
| 90 | San Marino | SM | 27 |
|
|
374
|
+
| 91 | Sao Tome and Principe | ST | 25 |
|
|
375
|
+
| 92 | Saudi Arabia | SA | 24 |
|
|
376
|
+
| 93 | Senegal | SN | 28 |
|
|
377
|
+
| 94 | Serbia | RS | 22 |
|
|
378
|
+
| 95 | Seychelles | SC | 31 |
|
|
379
|
+
| 96 | Slovak Republic | SK | 24 |
|
|
380
|
+
| 97 | Slovenia | SI | 19 |
|
|
381
|
+
| 98 | Somalia | SO | 23 |
|
|
382
|
+
| 99 | Spain | ES | 24 |
|
|
383
|
+
| 100 | Sudan | SD | 18 |
|
|
384
|
+
| 101 | Sultanate of Oman | OM | 23 |
|
|
385
|
+
| 102 | Sweden | SE | 24 |
|
|
386
|
+
| 103 | Switzerland | CH | 21 |
|
|
387
|
+
| 104 | Timor-Leste | TL | 23 |
|
|
388
|
+
| 105 | Togo | TG | 28 |
|
|
389
|
+
| 106 | Tunisia | TN | 24 |
|
|
390
|
+
| 107 | Turkey | TR | 26 |
|
|
391
|
+
| 108 | Ukraine | UA | 29 |
|
|
392
|
+
| 109 | United Arab Emirates | AE | 23 |
|
|
393
|
+
| 110 | United Kingdom | GB | 22 |
|
|
394
|
+
| 111 | Virgin Islands, British | VG | 24 |
|
|
395
|
+
| 112 | Yemen | YE | 30 |
|
|
395
396
|
|
|
396
397
|
</details>
|
|
397
398
|
|
|
@@ -419,6 +420,12 @@ npx tsc
|
|
|
419
420
|
|
|
420
421
|
# Changelog
|
|
421
422
|
|
|
423
|
+
## v 1.2.2
|
|
424
|
+
|
|
425
|
+
- Added Support for Yemen
|
|
426
|
+
- Updated validate function to not return countryUnsupported error if input is for example 'YE' country is supported but length is invalid so instead codeLengthInvalid error will be returned
|
|
427
|
+
- Updated tests and docs
|
|
428
|
+
|
|
422
429
|
## v 1.2.1
|
|
423
430
|
|
|
424
431
|
- Updated Burundi (BI) length 16 -> 27
|
package/dist/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# IBAN Validator
|
|
2
2
|
|
|
3
|
-
IBAN Validator for your web application forms ([Angular](#angular), [React](#react), Vue, ...), comes without any dependencies and can be used as a standalone function in any JS project. It can perform format, digit and length IBAN validations. Currently [
|
|
3
|
+
IBAN Validator for your web application forms ([Angular](#angular), [React](#react), Vue, ...), comes without any dependencies and can be used as a standalone function in any JS project. It can perform format, digit and length IBAN validations. Currently [112 countries](#supported-countries) are supported.
|
|
4
4
|
|
|
5
5
|
## Content
|
|
6
6
|
|
|
@@ -280,118 +280,119 @@ Check demo applications for usage examples:
|
|
|
280
280
|
Click here to expand list of supported countries
|
|
281
281
|
</summary>
|
|
282
282
|
|
|
283
|
-
| Country | Country Code | Length |
|
|
284
|
-
| ------------------------ | ------------ | ------ |
|
|
285
|
-
| Albania | AL | 28 |
|
|
286
|
-
| Algeria | DZ | 26 |
|
|
287
|
-
| Andorra | AD | 24 |
|
|
288
|
-
| Angola | AO | 25 |
|
|
289
|
-
| Austria | AT | 20 |
|
|
290
|
-
| Azerbaijan | AZ | 28 |
|
|
291
|
-
| Bahrain | BH | 22 |
|
|
292
|
-
| Belarus | BY | 28 |
|
|
293
|
-
| Belgium | BE | 16 |
|
|
294
|
-
| Benin | BJ | 28 |
|
|
295
|
-
| Bosnia and Herzegovina | BA | 20 |
|
|
296
|
-
| Brazil | BR | 29 |
|
|
297
|
-
| Bulgaria | BG | 22 |
|
|
298
|
-
| Burundi | BI | 27 |
|
|
299
|
-
| Burkina Faso | BF | 28 |
|
|
300
|
-
| Cameroon | CM | 27 |
|
|
301
|
-
| Cape Verde | CV | 25 |
|
|
302
|
-
| Central African Republic | CF | 27 |
|
|
303
|
-
| Chad | TD | 27 |
|
|
304
|
-
| Comoros | KM | 27 |
|
|
305
|
-
| Congo | CG | 27 |
|
|
306
|
-
| Costa Rica | CR | 22 |
|
|
307
|
-
| Croatia | HR | 21 |
|
|
308
|
-
| Cyprus | CY | 28 |
|
|
309
|
-
| Czech Republic | CZ | 24 |
|
|
310
|
-
| Denmark | DK | 18 |
|
|
311
|
-
| Djibouti | DJ | 27 |
|
|
312
|
-
| Dominican Republic | DO | 28 |
|
|
313
|
-
| Egypt | EG | 29 |
|
|
314
|
-
| El Salvador | SV | 28 |
|
|
315
|
-
| Equatorial Guinea | GQ | 27 |
|
|
316
|
-
| Estonia | EE | 20 |
|
|
317
|
-
| Falkland Islands | FK | 18 |
|
|
318
|
-
| Faroe Islands | FO | 18 |
|
|
319
|
-
| Finland | FI | 18 |
|
|
320
|
-
| France | FR | 27 |
|
|
321
|
-
| Gabon | GA | 27 |
|
|
322
|
-
| Georgia | GE | 22 |
|
|
323
|
-
| Germany | DE | 22 |
|
|
324
|
-
| Gibraltar | GI | 23 |
|
|
325
|
-
| Greece | GR | 27 |
|
|
326
|
-
| Greenland | GL | 18 |
|
|
327
|
-
| Guatemala | GT | 28 |
|
|
328
|
-
| Guinea-Bissau | GW | 25 |
|
|
329
|
-
| Vatican | VA | 22 |
|
|
330
|
-
| Honduras | HN | 28 |
|
|
331
|
-
| Hungary | HU | 28 |
|
|
332
|
-
| Iceland | IS | 26 |
|
|
333
|
-
| Iran | IR | 26 |
|
|
334
|
-
| Iraq | IQ | 23 |
|
|
335
|
-
| Ireland | IE | 22 |
|
|
336
|
-
| Israel | IL | 23 |
|
|
337
|
-
| Italy | IT | 27 |
|
|
338
|
-
| Ivory Coast | CI | 28 |
|
|
339
|
-
| Jordan | JO | 30 |
|
|
340
|
-
| Kazakhstan | KZ | 20 |
|
|
341
|
-
| Kosovo | XK | 20 |
|
|
342
|
-
| Kuwait | KW | 30 |
|
|
343
|
-
| Latvia | LV | 21 |
|
|
344
|
-
| Lebanon | LB | 28 |
|
|
345
|
-
| Libya | LY | 25 |
|
|
346
|
-
| Liechtenstein | LI | 21 |
|
|
347
|
-
| Lithuania | LT | 20 |
|
|
348
|
-
| Luxembourg | LU | 20 |
|
|
349
|
-
| Madagascar | MG | 27 |
|
|
350
|
-
| Mali | ML | 28 |
|
|
351
|
-
| Malta | MT | 31 |
|
|
352
|
-
| Mauritania | MR | 27 |
|
|
353
|
-
| Mauritius | MU | 30 |
|
|
354
|
-
| Moldova | MD | 24 |
|
|
355
|
-
| Monaco | MC | 27 |
|
|
356
|
-
| Mongolia | MN | 20 |
|
|
357
|
-
| Montenegro | ME | 22 |
|
|
358
|
-
| Morocco | MA | 28 |
|
|
359
|
-
| Mozambique | MZ | 25 |
|
|
360
|
-
| Netherlands | NL | 18 |
|
|
361
|
-
| Nicaragua | NI | 28 |
|
|
362
|
-
| Niger | NE | 28 |
|
|
363
|
-
| North Macedonia | MK | 19 |
|
|
364
|
-
| Norway | NO | 15 |
|
|
365
|
-
| Pakistan | PK | 24 |
|
|
366
|
-
| Palestine | PS | 29 |
|
|
367
|
-
| Poland | PL | 28 |
|
|
368
|
-
| Portugal | PT | 25 |
|
|
369
|
-
| Qatar | QA | 29 |
|
|
370
|
-
| Romania | RO | 24 |
|
|
371
|
-
| Russia | RU | 33 |
|
|
372
|
-
| Saint Lucia | LC | 32 |
|
|
373
|
-
| San Marino | SM | 27 |
|
|
374
|
-
| Sao Tome and Principe | ST | 25 |
|
|
375
|
-
| Saudi Arabia | SA | 24 |
|
|
376
|
-
| Senegal | SN | 28 |
|
|
377
|
-
| Serbia | RS | 22 |
|
|
378
|
-
| Seychelles | SC | 31 |
|
|
379
|
-
| Slovak Republic | SK | 24 |
|
|
380
|
-
| Slovenia | SI | 19 |
|
|
381
|
-
| Somalia | SO | 23 |
|
|
382
|
-
| Spain | ES | 24 |
|
|
383
|
-
| Sudan | SD | 18 |
|
|
384
|
-
| Sultanate of Oman | OM | 23 |
|
|
385
|
-
| Sweden | SE | 24 |
|
|
386
|
-
| Switzerland | CH | 21 |
|
|
387
|
-
| Timor-Leste | TL | 23 |
|
|
388
|
-
| Togo | TG | 28 |
|
|
389
|
-
| Tunisia | TN | 24 |
|
|
390
|
-
| Turkey | TR | 26 |
|
|
391
|
-
| Ukraine | UA | 29 |
|
|
392
|
-
| United Arab Emirates | AE | 23 |
|
|
393
|
-
| United Kingdom | GB | 22 |
|
|
394
|
-
| Virgin Islands, British | VG | 24 |
|
|
283
|
+
| No | Country | Country Code | Length |
|
|
284
|
+
| --- | ------------------------ | ------------ | ------ |
|
|
285
|
+
| 1 | Albania | AL | 28 |
|
|
286
|
+
| 2 | Algeria | DZ | 26 |
|
|
287
|
+
| 3 | Andorra | AD | 24 |
|
|
288
|
+
| 4 | Angola | AO | 25 |
|
|
289
|
+
| 5 | Austria | AT | 20 |
|
|
290
|
+
| 6 | Azerbaijan | AZ | 28 |
|
|
291
|
+
| 7 | Bahrain | BH | 22 |
|
|
292
|
+
| 8 | Belarus | BY | 28 |
|
|
293
|
+
| 9 | Belgium | BE | 16 |
|
|
294
|
+
| 10 | Benin | BJ | 28 |
|
|
295
|
+
| 11 | Bosnia and Herzegovina | BA | 20 |
|
|
296
|
+
| 12 | Brazil | BR | 29 |
|
|
297
|
+
| 13 | Bulgaria | BG | 22 |
|
|
298
|
+
| 14 | Burundi | BI | 27 |
|
|
299
|
+
| 15 | Burkina Faso | BF | 28 |
|
|
300
|
+
| 16 | Cameroon | CM | 27 |
|
|
301
|
+
| 17 | Cape Verde | CV | 25 |
|
|
302
|
+
| 18 | Central African Republic | CF | 27 |
|
|
303
|
+
| 19 | Chad | TD | 27 |
|
|
304
|
+
| 20 | Comoros | KM | 27 |
|
|
305
|
+
| 21 | Congo | CG | 27 |
|
|
306
|
+
| 22 | Costa Rica | CR | 22 |
|
|
307
|
+
| 23 | Croatia | HR | 21 |
|
|
308
|
+
| 24 | Cyprus | CY | 28 |
|
|
309
|
+
| 25 | Czech Republic | CZ | 24 |
|
|
310
|
+
| 26 | Denmark | DK | 18 |
|
|
311
|
+
| 27 | Djibouti | DJ | 27 |
|
|
312
|
+
| 28 | Dominican Republic | DO | 28 |
|
|
313
|
+
| 29 | Egypt | EG | 29 |
|
|
314
|
+
| 30 | El Salvador | SV | 28 |
|
|
315
|
+
| 32 | Equatorial Guinea | GQ | 27 |
|
|
316
|
+
| 33 | Estonia | EE | 20 |
|
|
317
|
+
| 34 | Falkland Islands | FK | 18 |
|
|
318
|
+
| 35 | Faroe Islands | FO | 18 |
|
|
319
|
+
| 36 | Finland | FI | 18 |
|
|
320
|
+
| 37 | France | FR | 27 |
|
|
321
|
+
| 38 | Gabon | GA | 27 |
|
|
322
|
+
| 39 | Georgia | GE | 22 |
|
|
323
|
+
| 40 | Germany | DE | 22 |
|
|
324
|
+
| 41 | Gibraltar | GI | 23 |
|
|
325
|
+
| 42 | Greece | GR | 27 |
|
|
326
|
+
| 43 | Greenland | GL | 18 |
|
|
327
|
+
| 44 | Guatemala | GT | 28 |
|
|
328
|
+
| 45 | Guinea-Bissau | GW | 25 |
|
|
329
|
+
| 46 | Vatican | VA | 22 |
|
|
330
|
+
| 47 | Honduras | HN | 28 |
|
|
331
|
+
| 48 | Hungary | HU | 28 |
|
|
332
|
+
| 49 | Iceland | IS | 26 |
|
|
333
|
+
| 50 | Iran | IR | 26 |
|
|
334
|
+
| 51 | Iraq | IQ | 23 |
|
|
335
|
+
| 52 | Ireland | IE | 22 |
|
|
336
|
+
| 53 | Israel | IL | 23 |
|
|
337
|
+
| 54 | Italy | IT | 27 |
|
|
338
|
+
| 55 | Ivory Coast | CI | 28 |
|
|
339
|
+
| 56 | Jordan | JO | 30 |
|
|
340
|
+
| 57 | Kazakhstan | KZ | 20 |
|
|
341
|
+
| 58 | Kosovo | XK | 20 |
|
|
342
|
+
| 59 | Kuwait | KW | 30 |
|
|
343
|
+
| 60 | Latvia | LV | 21 |
|
|
344
|
+
| 61 | Lebanon | LB | 28 |
|
|
345
|
+
| 62 | Libya | LY | 25 |
|
|
346
|
+
| 63 | Liechtenstein | LI | 21 |
|
|
347
|
+
| 64 | Lithuania | LT | 20 |
|
|
348
|
+
| 65 | Luxembourg | LU | 20 |
|
|
349
|
+
| 66 | Madagascar | MG | 27 |
|
|
350
|
+
| 67 | Mali | ML | 28 |
|
|
351
|
+
| 68 | Malta | MT | 31 |
|
|
352
|
+
| 69 | Mauritania | MR | 27 |
|
|
353
|
+
| 70 | Mauritius | MU | 30 |
|
|
354
|
+
| 71 | Moldova | MD | 24 |
|
|
355
|
+
| 72 | Monaco | MC | 27 |
|
|
356
|
+
| 73 | Mongolia | MN | 20 |
|
|
357
|
+
| 74 | Montenegro | ME | 22 |
|
|
358
|
+
| 75 | Morocco | MA | 28 |
|
|
359
|
+
| 76 | Mozambique | MZ | 25 |
|
|
360
|
+
| 77 | Netherlands | NL | 18 |
|
|
361
|
+
| 78 | Nicaragua | NI | 28 |
|
|
362
|
+
| 79 | Niger | NE | 28 |
|
|
363
|
+
| 80 | North Macedonia | MK | 19 |
|
|
364
|
+
| 81 | Norway | NO | 15 |
|
|
365
|
+
| 82 | Pakistan | PK | 24 |
|
|
366
|
+
| 83 | Palestine | PS | 29 |
|
|
367
|
+
| 84 | Poland | PL | 28 |
|
|
368
|
+
| 85 | Portugal | PT | 25 |
|
|
369
|
+
| 86 | Qatar | QA | 29 |
|
|
370
|
+
| 87 | Romania | RO | 24 |
|
|
371
|
+
| 88 | Russia | RU | 33 |
|
|
372
|
+
| 89 | Saint Lucia | LC | 32 |
|
|
373
|
+
| 90 | San Marino | SM | 27 |
|
|
374
|
+
| 91 | Sao Tome and Principe | ST | 25 |
|
|
375
|
+
| 92 | Saudi Arabia | SA | 24 |
|
|
376
|
+
| 93 | Senegal | SN | 28 |
|
|
377
|
+
| 94 | Serbia | RS | 22 |
|
|
378
|
+
| 95 | Seychelles | SC | 31 |
|
|
379
|
+
| 96 | Slovak Republic | SK | 24 |
|
|
380
|
+
| 97 | Slovenia | SI | 19 |
|
|
381
|
+
| 98 | Somalia | SO | 23 |
|
|
382
|
+
| 99 | Spain | ES | 24 |
|
|
383
|
+
| 100 | Sudan | SD | 18 |
|
|
384
|
+
| 101 | Sultanate of Oman | OM | 23 |
|
|
385
|
+
| 102 | Sweden | SE | 24 |
|
|
386
|
+
| 103 | Switzerland | CH | 21 |
|
|
387
|
+
| 104 | Timor-Leste | TL | 23 |
|
|
388
|
+
| 105 | Togo | TG | 28 |
|
|
389
|
+
| 106 | Tunisia | TN | 24 |
|
|
390
|
+
| 107 | Turkey | TR | 26 |
|
|
391
|
+
| 108 | Ukraine | UA | 29 |
|
|
392
|
+
| 109 | United Arab Emirates | AE | 23 |
|
|
393
|
+
| 110 | United Kingdom | GB | 22 |
|
|
394
|
+
| 111 | Virgin Islands, British | VG | 24 |
|
|
395
|
+
| 112 | Yemen | YE | 30 |
|
|
395
396
|
|
|
396
397
|
</details>
|
|
397
398
|
|
|
@@ -419,6 +420,12 @@ npx tsc
|
|
|
419
420
|
|
|
420
421
|
# Changelog
|
|
421
422
|
|
|
423
|
+
## v 1.2.2
|
|
424
|
+
|
|
425
|
+
- Added Support for Yemen
|
|
426
|
+
- Updated validate function to not return countryUnsupported error if input is for example 'YE' country is supported but length is invalid so instead codeLengthInvalid error will be returned
|
|
427
|
+
- Updated tests and docs
|
|
428
|
+
|
|
422
429
|
## v 1.2.1
|
|
423
430
|
|
|
424
431
|
- Updated Burundi (BI) length 16 -> 27
|
package/dist/code-lengths.js
CHANGED
package/dist/iban.validator.js
CHANGED
|
@@ -12,7 +12,7 @@ function mod97(digital) {
|
|
|
12
12
|
function validate(value, control) {
|
|
13
13
|
const iban = value.toUpperCase().replace(/[^A-Z0-9]/g, "");
|
|
14
14
|
const code = iban.match(/^([A-Z]{2})(\d{2})([A-Z\d]+)$/);
|
|
15
|
-
if (
|
|
15
|
+
if (code && code[1] && typeof codeLengths[code[1]] === "undefined") {
|
|
16
16
|
return {
|
|
17
17
|
ibanInvalid: true,
|
|
18
18
|
error: {
|
|
@@ -22,7 +22,7 @@ function validate(value, control) {
|
|
|
22
22
|
},
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
if (iban.length !== codeLengths[code[1]]) {
|
|
25
|
+
if (!code || (iban && iban.length !== codeLengths[code[1]])) {
|
|
26
26
|
return {
|
|
27
27
|
ibanInvalid: true,
|
|
28
28
|
error: {
|
|
@@ -30,6 +30,16 @@ describe("validateIBAN", () => {
|
|
|
30
30
|
patternInvalid: true,
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
|
+
it("should return invalid result when country is supported but length is invalid", () => {
|
|
34
|
+
const control = { value: "YE" };
|
|
35
|
+
const result = validateIBAN(control);
|
|
36
|
+
expect(result.ibanInvalid).toBe(true);
|
|
37
|
+
expect(result.error).toEqual({
|
|
38
|
+
countryUnsupported: false,
|
|
39
|
+
codeLengthInvalid: true,
|
|
40
|
+
patternInvalid: false,
|
|
41
|
+
});
|
|
42
|
+
});
|
|
33
43
|
it("should return valid result when IBAN is valid", () => {
|
|
34
44
|
const control = { value: "AT611904300234573201" };
|
|
35
45
|
const result = validateIBAN(control);
|
|
@@ -370,4 +380,7 @@ describe("validateIBAN", () => {
|
|
|
370
380
|
it("validateIBAN for Virgin Islands, British VG21PACG0000000123456789 should return null", () => {
|
|
371
381
|
expect(validateIBAN({ value: "VG21PACG0000000123456789" })).toBe(null);
|
|
372
382
|
});
|
|
383
|
+
it("validateIBAN for Yemen YE09CBKU0000000000001234560101 should return null", () => {
|
|
384
|
+
expect(validateIBAN({ value: "YE09CBKU0000000000001234560101" })).toBe(null);
|
|
385
|
+
});
|
|
373
386
|
});
|