From 21a483221b1d1383a68d8da3187b11a79b74b333 Mon Sep 17 00:00:00 2001 From: tech-and-avinash Date: Mon, 4 Aug 2025 15:58:36 +0530 Subject: [PATCH 1/9] fix(isMobilePhone): restrict mk-MK locale to valid mobile numbers only --- src/lib/isMobilePhone.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index b00391ea6..ccecb6afa 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -161,7 +161,8 @@ const phones = { 'ar-YE': /^(((\+|00)9677|0?7)[0137]\d{7}|((\+|00)967|0)[1-7]\d{6})$/, 'ar-EH': /^(\+?212|0)[\s\-]?(5288|5289)[\s\-]?\d{5}$/, 'fa-AF': /^(\+93|0)?(2{1}[0-8]{1}|[3-5]{1}[0-4]{1})(\d{7})$/, - 'mk-MK': /^(\+?389|0)?((?:2[2-9]\d{6}|(?:3[1-4]|4[2-8])\d{6}|500\d{5}|5[2-9]\d{6}|7[0-9][2-9]\d{5}|8[1-9]\d{6}|800\d{5}|8009\d{4}))$/, + // 'mk-MK': /^(\+?389|0)?((?:2[2-9]\d{6}|(?:3[1-4]|4[2-8])\d{6}|500\d{5}|5[2-9]\d{6}|7[0-9][2-9]\d{5}|8[1-9]\d{6}|800\d{5}|8009\d{4}))$/, + 'mk-MK': /^(\+3897[01256789]|07[01256789])[0-9]{6}$/ }; /* eslint-enable max-len */ From edd5342374c5cb683c66d4f6deedad08e7af6651 Mon Sep 17 00:00:00 2001 From: tech-and-avinash Date: Mon, 4 Aug 2025 16:03:46 +0530 Subject: [PATCH 2/9] Includes tests for valid and invalid examples. --- test/validators.test.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/validators.test.js b/test/validators.test.js index 299af27d8..305dee116 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -10551,6 +10551,19 @@ describe('Validators', () => { '9603412345', ], }, + { + locale: 'mk-MK', + valid: [ + '+38971234567', + '071234567', + ], + invalid: [ + '031234567', + '099999999', + '023456789', + '80001234', + ], + }, { locale: 'ar-YE', valid: [ From 8528a27537154cd2853603db5bffd76b1ad94af7 Mon Sep 17 00:00:00 2001 From: Rubin Bhandari Date: Mon, 4 Aug 2025 16:42:49 +0545 Subject: [PATCH 3/9] Update src/lib/isMobilePhone.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/lib/isMobilePhone.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index ccecb6afa..b321ca632 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -162,7 +162,7 @@ const phones = { 'ar-EH': /^(\+?212|0)[\s\-]?(5288|5289)[\s\-]?\d{5}$/, 'fa-AF': /^(\+93|0)?(2{1}[0-8]{1}|[3-5]{1}[0-4]{1})(\d{7})$/, // 'mk-MK': /^(\+?389|0)?((?:2[2-9]\d{6}|(?:3[1-4]|4[2-8])\d{6}|500\d{5}|5[2-9]\d{6}|7[0-9][2-9]\d{5}|8[1-9]\d{6}|800\d{5}|8009\d{4}))$/, - 'mk-MK': /^(\+3897[01256789]|07[01256789])[0-9]{6}$/ + 'mk-MK': /^(\+3897[01256789]|07[01256789])[0-9]{6}$/ }; /* eslint-enable max-len */ From b16eda26ef6bcfb1809ca5f1609407b9fe400ad1 Mon Sep 17 00:00:00 2001 From: tech-and-avinash Date: Mon, 4 Aug 2025 16:31:00 +0530 Subject: [PATCH 4/9] removed commented details --- src/lib/isMobilePhone.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index ccecb6afa..1a41cbe03 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -161,7 +161,6 @@ const phones = { 'ar-YE': /^(((\+|00)9677|0?7)[0137]\d{7}|((\+|00)967|0)[1-7]\d{6})$/, 'ar-EH': /^(\+?212|0)[\s\-]?(5288|5289)[\s\-]?\d{5}$/, 'fa-AF': /^(\+93|0)?(2{1}[0-8]{1}|[3-5]{1}[0-4]{1})(\d{7})$/, - // 'mk-MK': /^(\+?389|0)?((?:2[2-9]\d{6}|(?:3[1-4]|4[2-8])\d{6}|500\d{5}|5[2-9]\d{6}|7[0-9][2-9]\d{5}|8[1-9]\d{6}|800\d{5}|8009\d{4}))$/, 'mk-MK': /^(\+3897[01256789]|07[01256789])[0-9]{6}$/ }; /* eslint-enable max-len */ From 9f47e191bf401f6ec9cf5725313e15564200a9ae Mon Sep 17 00:00:00 2001 From: tech-and-avinash Date: Mon, 4 Aug 2025 16:36:50 +0530 Subject: [PATCH 5/9] added trailing comma --- src/lib/isMobilePhone.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index 143b9546d..661ee2bc2 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -161,7 +161,7 @@ const phones = { 'ar-YE': /^(((\+|00)9677|0?7)[0137]\d{7}|((\+|00)967|0)[1-7]\d{6})$/, 'ar-EH': /^(\+?212|0)[\s\-]?(5288|5289)[\s\-]?\d{5}$/, 'fa-AF': /^(\+93|0)?(2{1}[0-8]{1}|[3-5]{1}[0-4]{1})(\d{7})$/, - 'mk-MK': /^(\+3897[01256789]|07[01256789])[0-9]{6}$/ + 'mk-MK': /^(\+3897[01256789]|07[01256789])[0-9]{6}$/, }; /* eslint-enable max-len */ From 6e39cd6e4de9b56d92a7c88e272e895e1f147e44 Mon Sep 17 00:00:00 2001 From: tech-and-avinash Date: Mon, 4 Aug 2025 16:53:10 +0530 Subject: [PATCH 6/9] removed old valid and invalid phone numbers --- test/validators.test.js | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/test/validators.test.js b/test/validators.test.js index 305dee116..5c95944ba 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -10673,34 +10673,6 @@ describe('Validators', () => { '+50281234567', ], }, - { - locale: 'mk-MK', - valid: [ - '+38923234567', - '38931234567', - '022123456', - '22234567', - '71234567', - '31234567', - '+38923091500', - '80091234', - '81123456', - '54123456', - ], - invalid: [ - '38912345678', - '+389123456789', - '21234567', - '123456789', - '+3891234567', - '700012345', - '510123456', - 'This should fail', - '+389123456', - '389123456', - '80912345', - ], - }, { locale: 'ar-QA', valid: ['+97435551234', '+97455551234', '+97465551234', '+97475551234', '35551234', '55551234', '65551234', '75551234'], From 12e9a10d0d8ec2d43174e2f45eb13346ee283fc9 Mon Sep 17 00:00:00 2001 From: tech-and-avinash <45698249+tech-and-avinash@users.noreply.github.com> Date: Tue, 5 Aug 2025 17:49:05 +0530 Subject: [PATCH 7/9] Update src/lib/isMobilePhone.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/lib/isMobilePhone.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index 661ee2bc2..b5bb72d14 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -161,7 +161,7 @@ const phones = { 'ar-YE': /^(((\+|00)9677|0?7)[0137]\d{7}|((\+|00)967|0)[1-7]\d{6})$/, 'ar-EH': /^(\+?212|0)[\s\-]?(5288|5289)[\s\-]?\d{5}$/, 'fa-AF': /^(\+93|0)?(2{1}[0-8]{1}|[3-5]{1}[0-4]{1})(\d{7})$/, - 'mk-MK': /^(\+3897[01256789]|07[01256789])[0-9]{6}$/, + 'mk-MK': /^(\+3897[0123456789]|07[0123456789])[0-9]{6}$/, }; /* eslint-enable max-len */ From a3b5effc6cf616d4f152a1b6a1e1a8a57cdd7079 Mon Sep 17 00:00:00 2001 From: tech-and-avinash <45698249+tech-and-avinash@users.noreply.github.com> Date: Tue, 5 Aug 2025 17:51:45 +0530 Subject: [PATCH 8/9] Update src/lib/isMobilePhone.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/lib/isMobilePhone.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index b5bb72d14..80e1261de 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -161,7 +161,7 @@ const phones = { 'ar-YE': /^(((\+|00)9677|0?7)[0137]\d{7}|((\+|00)967|0)[1-7]\d{6})$/, 'ar-EH': /^(\+?212|0)[\s\-]?(5288|5289)[\s\-]?\d{5}$/, 'fa-AF': /^(\+93|0)?(2{1}[0-8]{1}|[3-5]{1}[0-4]{1})(\d{7})$/, - 'mk-MK': /^(\+3897[0123456789]|07[0123456789])[0-9]{6}$/, + 'mk-MK': /^(\+3897[0-9]|07[0-9])[0-9]{6}$/, }; /* eslint-enable max-len */ From aaf8d70c3a454aac14a7be6de3bc9a8ae484ac14 Mon Sep 17 00:00:00 2001 From: tech-and-avinash Date: Tue, 19 Aug 2025 12:15:35 +0530 Subject: [PATCH 9/9] refactor: improve regex pattern for North Macedonia phone numbers --- src/lib/isMobilePhone.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index 661ee2bc2..0af34c9c7 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -161,7 +161,7 @@ const phones = { 'ar-YE': /^(((\+|00)9677|0?7)[0137]\d{7}|((\+|00)967|0)[1-7]\d{6})$/, 'ar-EH': /^(\+?212|0)[\s\-]?(5288|5289)[\s\-]?\d{5}$/, 'fa-AF': /^(\+93|0)?(2{1}[0-8]{1}|[3-5]{1}[0-4]{1})(\d{7})$/, - 'mk-MK': /^(\+3897[01256789]|07[01256789])[0-9]{6}$/, + 'mk-MK': /^(\+3897[0-9]\d{6}|07[0-9]\d{6})$/, }; /* eslint-enable max-len */