Skip to content

isPassportNumber does not work for all over the world countries #1948

Open
@kasir-barati

Description

@kasir-barati

Describe the bug
As you see here we do not support all over the world countries. I like to collaborate and add more countries regex to that list.

Examples

const validator = require('validator');
const passports = [
    { number: '1408611', country: 'AF' },
    { number: '0007699', country: 'AF' },
    { number: '02444826', country: 'AF' },
    { number: 'D0007699', country: 'AF' },
    { number: 'OA1408611', country: 'AF' },
    { number: 'P02444826', country: 'AF' },
    { number: '910239248', country: 'US' },
    { number: '442578947', country: 'US' },
    { number: '910239248', country: 'US' },
    { number: 'XS1234567', country: 'JP' },
    { number: 'TR4622130', country: 'JP' },
    { number: 'B7499678', country: 'ID' },
    { number: 'A04535897', country: 'ZA' },
    { number: '04535897', country: 'ZA' },
    { number: '04535897', country: 'ZA' },
    { number: '06764100', country: 'TR' },
    { number: 'U06764100', country: 'TR' },
    { number: 'HFF220608', country: 'AE' },
    { number: '220608', country: 'AE' },
];

for (const pass of passports) {
    const res1 = validator.isPassportNumber(
        pass.number,
        pass.country,
    );
    console.log(res1, pass);
}

Result

Additional context
Validator.js version: 13.7.0
Node.js version: 17.6.0
OS platform: Linux (Ubuntu)

Or please add more country yourself.

Question 🤔

Why you did not complete the list?

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