From dc05506da494bb67e6c254a53c4fce2200e0c337 Mon Sep 17 00:00:00 2001 From: annymosse Date: Wed, 4 Mar 2020 22:29:06 +0100 Subject: [PATCH 1/4] feat: Add Algeria Passport (DZ) --- src/lib/isPassportNumber.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/isPassportNumber.js b/src/lib/isPassportNumber.js index 304f72fae..5d28573f4 100644 --- a/src/lib/isPassportNumber.js +++ b/src/lib/isPassportNumber.js @@ -18,6 +18,7 @@ const passportRegexByCountryCode = { CZ: /^\d{8}$/, // CZECH REPUBLIC DE: /^[CFGHJKLMNPRTVWXYZ0-9]{9}$/, // GERMANY DK: /^\d{9}$/, // DENMARK + DZ: /^\d{9}$/, // ALGERIA EE: /^([A-Z]\d{7}|[A-Z]{2}\d{7})$/, // ESTONIA (K followed by 7-digits), e-passports have 2 UPPERCASE followed by 7 digits ES: /^[A-Z0-9]{2}([A-Z0-9]?)\d{6}$/, // SPAIN FI: /^[A-Z]{2}\d{7}$/, // FINLAND From 6e0b536df7a4f6203db23010dea0f702d60c96c8 Mon Sep 17 00:00:00 2001 From: annymosse Date: Thu, 5 Mar 2020 12:20:40 +0100 Subject: [PATCH 2/4] feat: add DZ(Algeria) Passport test add missing Algeria Country passport tester --- test/validators.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/validators.js b/test/validators.js index d87a1889e..5dccb1914 100644 --- a/test/validators.js +++ b/test/validators.js @@ -2009,6 +2009,23 @@ describe('Validators', () => { 'K01234567', ], }); + + test({ + validator: 'isPassportNumber', + args: ['DZ'], + valid: [ + '855609385', + '154472412', + '197025599', + ], + invalid: [ + 'AS0123456', + 'A012345678', + '012345678', + '123456789', + '98KK54321', + ], + }); test({ validator: 'isPassportNumber', From f00b61a3217ca05241d9715546a8e211df0baae4 Mon Sep 17 00:00:00 2001 From: annymosse Date: Thu, 5 Mar 2020 14:36:05 +0100 Subject: [PATCH 3/4] fix(isPassportNumber:"DZ"): Remove trailing spaces remove missing trailing spaces. --- test/validators.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/validators.js b/test/validators.js index 5dccb1914..6451d833d 100644 --- a/test/validators.js +++ b/test/validators.js @@ -2009,7 +2009,7 @@ describe('Validators', () => { 'K01234567', ], }); - + test({ validator: 'isPassportNumber', args: ['DZ'], From d69c7bbb01edbfecf45b9cbf3e4977998cd1eb62 Mon Sep 17 00:00:00 2001 From: annymosse Date: Thu, 5 Mar 2020 14:44:54 +0100 Subject: [PATCH 4/4] fix(isPassport"DZ"):update the invalid rare cases remove the rare invalid cases to be fully invalid cases instead of them. --- test/validators.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/validators.js b/test/validators.js index 6451d833d..9762d84de 100644 --- a/test/validators.js +++ b/test/validators.js @@ -2021,8 +2021,8 @@ describe('Validators', () => { invalid: [ 'AS0123456', 'A012345678', - '012345678', - '123456789', + '0123456789', + '12345678', '98KK54321', ], });