How to use ibantools - 6 common examples

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-iban / is-iban.validator.fn.ts View on Github external
export function starkIsIBAN(iban: string): boolean {
	if (typeof iban === "string") {
		// Since v2.0.0 of ibantools, isValidIBAN() is false if there is " " in the verified IBAN
		return isValidIBAN(electronicFormatIBAN(iban));
	}
	return false;
}
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 8 months ago

Package Health Score

80 / 100
Full package analysis