Skip to content

Commit

Permalink
feat(isPassportNumber): add indian locale (#1313)
Browse files Browse the repository at this point in the history
  • Loading branch information
parasg1999 authored May 26, 2020
1 parent 1cc189e commit bb2e585
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/isPassportNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const passportRegexByCountryCode = {
HR: /^\d{9}$/, // CROATIA
HU: /^[A-Z]{2}(\d{6}|\d{7})$/, // HUNGARY
IE: /^[A-Z0-9]{2}\d{7}$/, // IRELAND
IN: /^[A-Z]{1}-?\d{7}$/, // INDIA
IS: /^(A)\d{7}$/, // ICELAND
IT: /^[A-Z0-9]{2}\d{7}$/, // ITALY
JP: /^[A-Z]{2}\d{7}$/, // JAPAN
Expand Down
14 changes: 14 additions & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -2156,6 +2156,20 @@ describe('Validators', () => {
],
});

test({
validator: 'isPassportNumber',
args: ['IN'],
valid: [
'A-1234567',
'A1234567',
'X0019390',
],
invalid: [
'AB-1234567',
'0123456789',
],
});

test({
validator: 'isPassportNumber',
args: ['IS'],
Expand Down

0 comments on commit bb2e585

Please sign in to comment.