lanka-validations - v2.1.0
    Preparing search index...

    Function validateBankAccount

    • Validates a bank account number returning detailed ValidationResult.

      Parameters

      • acc: unknown

        Account number. Spaces and hyphens are ignored.

      • OptionalbankCode: unknown

        Optional CBSL bank code to validate and include.

      • OptionalbranchCode: unknown

        Optional three-digit branch code to validate and include.

      Returns ValidationResult<{ account: string; bank?: BankInfo; branchCode?: string }>

      { isValid: true, data } with the account, bank, and branch, or { isValid: false, error, errors, code }.

      validateBankAccount('1234567890', '7010').isValid; // true
      validateBankAccount('1234567890', '0000').code; // 'BANK_CODE_INVALID'