Skip to content

Commit 13c05c7

Browse files
committed
feat(isPassportNumber): add validation for Dominican Republic passport numbers
1 parent 784e52a commit 13c05c7

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/lib/isPassportNumber.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ const passportRegexByCountryCode = {
6767
UA: /^[A-Z]{2}\d{6}$/, // UKRAINE
6868
US: /^\d{9}$|^[A-Z]\d{8}$/, // UNITED STATES
6969
ZA: /^[TAMD]\d{8}$/, // SOUTH AFRICA
70+
DO: /^([RD]{2}\d{7})|(\d{11})$/, // DOMINICAN REPUBLIC
7071
};
7172

7273
export const locales = Object.keys(passportRegexByCountryCode);

test/validators.test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4046,6 +4046,19 @@ describe('Validators', () => {
40464046
'Z12345678',
40474047
],
40484048
});
4049+
4050+
test({
4051+
validator: 'isPassportNumber',
4052+
args: ['DO'],
4053+
valid: [
4054+
'RD1234567',
4055+
'RD3234107',
4056+
],
4057+
invalid: [
4058+
'SD1234567',
4059+
'RH0254567',
4060+
],
4061+
});
40494062
});
40504063

40514064
it('should validate decimal numbers', () => {

0 commit comments

Comments
 (0)