How to use the ibantools.isValidBBAN function in ibantools

To help you get started, we’ve selected a few ibantools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NationalBankBelgium / stark / packages / stark-core / src / validation / validators / is-bban / is-bban.validator.fn.ts View on Github external
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;
}

ibantools

Validation, extraction and creation of IBAN, BBAN, BIC/SWIFT numbers plus some other helpful stuff like ISO 3136-1 alpha 2 country list

MIT or MPL-2.0
Latest version published 2 months ago

Package Health Score

86 / 100
Full package analysis