File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed
Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -126,21 +126,21 @@ function hasValidIbanFormat(str, options) {
126126
127127 if ( options . whitelist ) {
128128 if ( ! hasOnlyValidCountryCodes ( options . whitelist ) ) {
129- throw new Error ( 'One of the codes passed is invalid' ) ;
129+ return false ;
130130 }
131131
132132 const isoCountryCodeInWhiteList = options . whitelist . includes ( isoCountryCode ) ;
133133
134134 if ( ! isoCountryCodeInWhiteList ) {
135- throw new Error ( 'IBAN code does not belong to one of the countries listed on whitelist!' ) ;
135+ return false ;
136136 }
137137 }
138138
139139 if ( options . blacklist ) {
140140 const isoCountryCodeInBlackList = options . blacklist . includes ( isoCountryCode ) ;
141141
142142 if ( isoCountryCodeInBlackList ) {
143- throw new Error ( 'IBAN code belongs to one of the countries listed on blacklist!' ) ;
143+ return false ;
144144 }
145145 }
146146
Original file line number Diff line number Diff line change @@ -5257,7 +5257,7 @@ describe('Validators', () => {
52575257 'DK5000400440116243' ,
52585258 'GB29NWBK60161331926819' ,
52595259 ] ,
5260- error : [
5260+ invalid : [
52615261 'BE71 0961 2345 6769' ,
52625262 'FR76 3000 6000 0112 3456 7890 189' ,
52635263 'DE91 1000 0000 0123 4567 89' ,
@@ -5275,7 +5275,7 @@ describe('Validators', () => {
52755275 test ( {
52765276 validator : 'isIBAN' ,
52775277 args : [ { whitelist : [ 'XX' , 'AA' ] } ] ,
5278- error : [
5278+ invalid : [
52795279 'DK5000400440116243' ,
52805280 'GB29NWBK60161331926819' ,
52815281 'BE71 0961 2345 6769' ,
@@ -5318,15 +5318,13 @@ describe('Validators', () => {
53185318 'IR200170000000339545727003' ,
53195319 'MZ97123412341234123412341' ,
53205320 ] ,
5321- error : [
5322- 'IT60X0542811101000000123456' ,
5323- ] ,
53245321 invalid : [
53255322 'XX22YYY1234567890123' ,
53265323 'FR14 2004 1010 0505 0001 3' ,
53275324 'FR7630006000011234567890189@' ,
53285325 'FR7630006000011234567890189😅' ,
53295326 'FR763000600001123456!!🤨7890189@' ,
5327+ 'IT60X0542811101000000123456' ,
53305328 ] ,
53315329 } ) ;
53325330 } ) ;
You can’t perform that action at this time.
0 commit comments