Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function starkIsBBAN(bban: string, countryCode: string = ""): boolean {
const strippedBban: string = typeof bban === "string" ? bban.replace(/\s/g, "") : bban;
if (isValidBBAN(strippedBban, countryCode.toUpperCase())) {
if (countryCode.match(/^BE/i)) {
const checkDigit: number = parseInt(strippedBban.substring(strippedBban.length - 2), 10);
const calculatedCheckDigit: number = calculateCheckDigit(strippedBban);
return checkDigit === calculatedCheckDigit;
}
return true;
}
return false;
}