ngx-iban-validator 1.2.0 → 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 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 [108 countries](#supported-countries) are supported.
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 | 16 |
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 | 32 |
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,17 @@ 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
+
429
+ ## v 1.2.1
430
+
431
+ - Updated Burundi (BI) length 16 -> 27
432
+ - Updated Nicaragua (NI) length 32 -> 28
433
+
422
434
  ## v 1.2.0
423
435
 
424
436
  - Updated documentation
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 [108 countries](#supported-countries) are supported.
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 | 16 |
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 | 32 |
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,17 @@ 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
+
429
+ ## v 1.2.1
430
+
431
+ - Updated Burundi (BI) length 16 -> 27
432
+ - Updated Nicaragua (NI) length 32 -> 28
433
+
422
434
  ## v 1.2.0
423
435
 
424
436
  - Updated documentation
@@ -10,7 +10,7 @@ export const codeLengths = {
10
10
  BF: 28,
11
11
  BG: 22,
12
12
  BH: 22,
13
- BI: 16,
13
+ BI: 27,
14
14
  BJ: 28,
15
15
  BR: 29,
16
16
  BY: 28,
@@ -77,7 +77,7 @@ export const codeLengths = {
77
77
  MU: 30,
78
78
  MZ: 25,
79
79
  NE: 28,
80
- NI: 32,
80
+ NI: 28,
81
81
  NL: 18,
82
82
  NO: 15,
83
83
  OM: 23,
@@ -109,4 +109,5 @@ export const codeLengths = {
109
109
  VA: 22,
110
110
  VG: 24,
111
111
  XK: 20,
112
+ YE: 30,
112
113
  };
@@ -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 (!code || typeof codeLengths[code[1]] === "undefined") {
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);
@@ -79,8 +89,8 @@ describe("validateIBAN", () => {
79
89
  it("validateIBAN for Bulgaria BG18RZBB91550123456789 should return null", () => {
80
90
  expect(validateIBAN({ value: "BG18RZBB91550123456789" })).toBe(null);
81
91
  });
82
- it("validateIBAN for Burundi BI43201011067444 should return null", () => {
83
- expect(validateIBAN({ value: "BI43201011067444" })).toBe(null);
92
+ it("validateIBAN for Burundi BI1320001100010000123456789 should return null", () => {
93
+ expect(validateIBAN({ value: "BI1320001100010000123456789" })).toBe(null);
84
94
  });
85
95
  it("validateIBAN for Burkina Faso BF42BF0840101300463574000390 should return null", () => {
86
96
  expect(validateIBAN({ value: "BF42BF0840101300463574000390" })).toBe(null);
@@ -268,8 +278,8 @@ describe("validateIBAN", () => {
268
278
  it("validateIBAN for Netherlands NL02ABNA0123456789 should return null", () => {
269
279
  expect(validateIBAN({ value: "NL02ABNA0123456789" })).toBe(null);
270
280
  });
271
- it("validateIBAN for Nicaragua NI92BAMC000000000000000003123123 should return null", () => {
272
- expect(validateIBAN({ value: "NI92BAMC000000000000000003123123" })).toBe(null);
281
+ it("validateIBAN for Nicaragua NI79BAMC00000000000003123123 should return null", () => {
282
+ expect(validateIBAN({ value: "NI79BAMC00000000000003123123" })).toBe(null);
273
283
  });
274
284
  it("validateIBAN for Niger NE58NE0380100100130305000268 should return null", () => {
275
285
  expect(validateIBAN({ value: "NE58NE0380100100130305000268" })).toBe(null);
@@ -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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-iban-validator",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/SKaDiZZ/ngx-iban-validator.git"