-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Describe the bug
A clear and concise description of what the bug is.
The isBIC validator uses the list of country codes in './isISO31661Alpha2' and that list of country codes does not include "XK" (Republic of Kosovo).
However, on the ISO 9362 page, Wikipedia says that the country code in a SWIFT/BIC code is "a ISO 3166-1 alpha-2 country code (exceptionally, SWIFT has assigned the code XK to Republic of Kosovo, which does not have an ISO 3166-1 country code)".
Kosovo's code is not in the ISO 3166-1 alpha-2, but for assigning BIC country codes, it is a valid code.
Because isBIC only uses the list of country codes on the ISO 3166-1 alpha-2 format, a BIC code with "XK" as the country code would not pass.
Lines 12 to 14 in 86a07ba
| if (!CountryCodes.has(str.slice(4, 6).toUpperCase())) { | |
| return false; | |
| } |
We should change the check above in isBIC.js to this to account for "XK" being an allowed country code:
if (!CountryCodes.has(str.slice(4, 6).toUpperCase()) && str.slice(4, 6).toUpperCase() !== "XK" ) {
return false;
}Examples
If applicable, add screenshots to help explain your problem.
Additional context
Validator.js version: 13.7.0
Node.js version: 16
OS platform: [windows, linux, macOS, etc]: Linux