UNPKG

polish-validators

Version:

A set of validator functions that check common polish numbers.

46 lines (45 loc) 2 kB
/** * Validates an International Bank Account Number (IBAN). The function checks for * proper length, format, and passes the IBAN checksum requirements. In the case of * IBANs starting with `PL` (or with no country code), the 3rd-5th digits are validated * against a list of Polish banks. Any whitespace is ignored, but other characters will * result in the IBAN being invalid. * * @param {string} iban - The IBAN number as a string, with or without spaces. * @returns {boolean} `true` if the IBAN is valid; `false` otherwise. */ export declare function isIbanValid(iban: string): boolean; /** * Returns true if the IBAN is invalid; false otherwise. * * @param {string} iban - The IBAN number as a string. * @returns {boolean} */ export declare const isIbanInvalid: (iban: string) => boolean; /** * Extracts country-specific information from the IBAN. * * @param {string} iban - The IBAN number as a string. * @returns {{ country: string; length: number } | null} An object containing the country name * and IBAN length for the given IBAN, or `null` if not valid. */ export declare function getCountryIbanDataFromIban(iban: string): { country: string; length: number; } | null; /** * Fetches the bank name based on the IBAN, specifically for Polish IBANs. * If a non-Polish IBAN is supplied, it will always return `null`. * * @param {string} iban - The IBAN number as a string. * @returns {string | null} The bank name as a string, or `null` if not available. */ export declare function getBankNameFromIban(iban: string): string | null; /** * Fetches the full bank name based on the IBAN, specifically for Polish IBANs. * If a non-Polish IBAN is supplied, it will always return `null`. * * @param {string} iban - The IBAN number as a string. * @returns {string | null} The full bank name as a string, or `null` if not available. */ export declare function getFullBankNameFromIban(iban: string): string | null;