polish-validators
Version:
A set of validator functions that check common polish numbers.
71 lines (70 loc) • 3.02 kB
TypeScript
export declare const BankName: {
readonly NBP: "Narodowy Bank Polski";
readonly PKOBP: "PKO BP";
readonly BankHandlowy: "Bank Handlowy (Citi Handlowy)";
readonly ING: "ING Bank Śląski";
readonly SantanderBankPolska: "Santander Bank Polska";
readonly BGK: "BGK";
readonly mBank: "mBank";
readonly Millenium: "Bank Millennium";
readonly PekaoSA: "Pekao SA";
readonly BankPocztowy: "Bank Pocztowy";
readonly BOSBank: "BOŚ Bank";
readonly MercedezBenzBank: "Mercedes-Benz Bank Polska";
readonly SGB: "SGB - Bank";
readonly RBSBank: "RBS Bank (Polska)";
readonly PlusBank: "Plus Bank";
readonly SocieteGenerale: "Societe Generale";
readonly NestBank: "Nest Bank";
readonly BankPolskiejSpoldzielczosci: "Bank Polskiej Spółdzielczości";
readonly CreditAgricole: "Credit Agricole Bank Polska";
readonly BNPParibas: "BNP Paribas";
readonly StantanderConsumerBank: "Santander Consumer Bank";
readonly ToyotaBank: "Toyota Bank";
readonly DNB: "DNB Bank Polska";
readonly GetinNobleBank: "Getin Noble Bank";
readonly AliorBank: "Alior Bank";
readonly FCE: "FCE Bank Polska";
readonly Inbank: "Inbank";
readonly VolksvagenBank: "Volkswagen Bank";
readonly HSBC: "HSBC";
readonly AionBank: "Aion Bank";
};
export type BankName = (typeof BankName)[keyof typeof BankName];
/**
* 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;