From def7f3e5657a7d1f47c0d5f9315336fed15325ff Mon Sep 17 00:00:00 2001 From: Nana Aboagye <96492466+NanaAb-116@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:29:39 +0000 Subject: [PATCH 1/2] feat(isMobilePhone): update phone regex for Ghana en-GH (#2362) Co-authored-by: Rubin Bhandari --- src/lib/isMobilePhone.js | 2 +- test/validators.test.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index 53c0e3717..393ee6fbd 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -41,7 +41,7 @@ const phones = { 'en-BS': /^(\+?1[-\s]?|0)?\(?242\)?[-\s]?\d{3}[-\s]?\d{4}$/, 'en-GB': /^(\+?44|0)7[1-9]\d{8}$/, 'en-GG': /^(\+?44|0)1481\d{6}$/, - 'en-GH': /^(\+233|0)(20|50|24|54|27|57|26|56|23|28|55|59)\d{7}$/, + 'en-GH': /^(\+233|0)(20|50|24|54|27|57|26|56|23|53|28|55|59)\d{7}$/, 'en-GY': /^(\+592|0)6\d{6}$/, 'en-HK': /^(\+?852[-\s]?)?[456789]\d{3}[-\s]?\d{4}$/, 'en-MO': /^(\+?853[-\s]?)?[6]\d{3}[-\s]?\d{4}$/, diff --git a/test/validators.test.js b/test/validators.test.js index 8335477a2..adf5d2cfe 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -8053,6 +8053,7 @@ describe('Validators', () => { '0502345671', '0242345671', '0542345671', + '0532345671', '0272345671', '0572345671', '0262345671', @@ -8063,6 +8064,7 @@ describe('Validators', () => { '+233502345671', '+233242345671', '+233542345671', + '+233532345671', '+233272345671', '+233572345671', '+233262345671', From f54599c8fbd43b1febb2cbc18190107417fbdd5e Mon Sep 17 00:00:00 2001 From: ticmaisdev <128381407+ticmaisdev@users.noreply.github.com> Date: Wed, 13 Nov 2024 10:56:22 -0400 Subject: [PATCH 2/2] refactor: make brazilian postal code separator optional (#2493) --- src/lib/isPostalCode.js | 2 +- test/validators.test.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/isPostalCode.js b/src/lib/isPostalCode.js index 103656205..cadf39346 100644 --- a/src/lib/isPostalCode.js +++ b/src/lib/isPostalCode.js @@ -14,7 +14,7 @@ const patterns = { BA: /^([7-8]\d{4}$)/, BE: fourDigit, BG: fourDigit, - BR: /^\d{5}-\d{3}$/, + BR: /^\d{5}-?\d{3}$/, BY: /^2[1-4]\d{4}$/, CA: /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i, CH: fourDigit, diff --git a/test/validators.test.js b/test/validators.test.js index adf5d2cfe..af170bf69 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -12742,6 +12742,9 @@ describe('Validators', () => { '39100-000', '22040-020', '39400-152', + '39100000', + '22040020', + '39400152', ], invalid: [ '79800A12',