File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -149,8 +149,12 @@ function checkIBAN(iban: string): boolean {
149
149
if (! / ([a-zA-Z ] {2} [0-9 ] {2} )([a-zA-Z ] {4} [0-9 ] {10} )/ .test (iban )){ // Check if the general format is OK
150
150
return false ;
151
151
}
152
- const numericIban = (iban .slice (4 ) + iban .slice (0 , 4 )).replace (/ [A-Z ] / g , char => (char .charCodeAt (0 ) - 55 ).toString ()); // 11-test
153
- const remainder = numericIban .split (' ' ).reduce ((acc , digit ) => (acc + digit ) % 97 , 0 );
152
+ const numericIban = (iban .slice (4 ) + iban .slice (0 , 4 ))
153
+ .replace (/ [A-Z ] / g , char => (char .charCodeAt (0 ) - 55 ).toString ()); // 11-test
154
+ const remainder = numericIban
155
+ .split (' ' )
156
+ .map ((acc , digit ) => (Number .parseInt (acc ), digit ))
157
+ .reduce ((acc , digit ) => (acc + digit ) % 97 , 0 );
154
158
return remainder === 1 ;
155
159
}
156
160
You can’t perform that action at this time.
0 commit comments