Skip to content

Can we export IBAN countries to check if the country implements IBAN? #1570

@Poky85

Description

@Poky85

Issue
isIBAN() validator allows user to validate IBAN and it contains IBAN definitions as used in many countries world-wide. In my current project I validate account numbers and not all of them implement IBAN. So I need to check if the country implements IBAN or not.

In isIBAN() there are IBAN definitions per countries so maybe it could export the regular so user can check the country?

Examples
Many countries (for example Australia, Canada or US) doesn't implement IBAN.

Validator could export something like

const ibanRegexThroughCountryCode = {
  AD: /^(AD[0-9]{2})\d{8}[A-Z0-9]{12}$/,
  AE: /^(AE[0-9]{2})\d{3}\d{16}$/,}

export const ibanCountryCodes = Object.keys(ibanRegexThroughCountryCode)

So user can apply IBAN validator only when appropriate.

Additional context
Validator.js version: 13.5.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions