Skip to content

Commit

Permalink
fix(isBIC): add XK to accepted BIC country codes (#2046)
Browse files Browse the repository at this point in the history
  • Loading branch information
import-brain authored Feb 2, 2023
1 parent 91c8bd9 commit a8e0005
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/isBIC.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ export default function isBIC(str) {

// toUpperCase() should be removed when a new major version goes out that changes
// the regex to [A-Z] (per the spec).
if (!CountryCodes.has(str.slice(4, 6).toUpperCase())) {
const countryCode = str.slice(4, 6).toUpperCase();

if (!CountryCodes.has(countryCode) && countryCode !== 'XK') {
return false;
}

Expand Down
2 changes: 2 additions & 0 deletions test/validators.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5183,6 +5183,7 @@ describe('Validators', () => {
'SBICKEN1',
'SBICKENY',
'SBICKEN1YYP',
'SBICXKN1YYP',
],
invalid: [
'SBIC23NXXX',
Expand All @@ -5191,6 +5192,7 @@ describe('Validators', () => {
'SBICKENXX9',
'SBICKEN13458',
'SBICKEN',
'SBICXK',
],
});
});
Expand Down

0 comments on commit a8e0005

Please sign in to comment.