From 12b159de89f4fb7a03c0bd9e1571591d7e79ce94 Mon Sep 17 00:00:00 2001 From: Brendan C <30474072+brendan-c@users.noreply.github.com> Date: Sat, 9 Oct 2021 18:12:16 -0400 Subject: [PATCH] feat(isMobilePhone): add Palestine ar-PS locale Add isMobilePhone test for ar-PS Add ar-PS to isMobilePhone readme Correct ar-PS validation Update ar-PS isMobible tests --- src/lib/isMobilePhone.js | 1 + test/validators.js | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index 6877fe01e..732dc2fa2 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -14,6 +14,7 @@ const phones = { 'ar-LY': /^((\+?218)|0)?(9[1-6]\d{7}|[1-8]\d{7,9})$/, 'ar-MA': /^(?:(?:\+|00)212|0)[5-7]\d{8}$/, 'ar-OM': /^((\+|00)968)?(9[1-9])\d{6}$/, + 'ar-PS': /^(\+?970|0)5[6|9](\d{7})$/, 'ar-SA': /^(!?(\+?966)|0)?5\d{8}$/, 'ar-SY': /^(!?(\+?963)|0)?9\d{8}$/, 'ar-TN': /^(\+?216)?[2459]\d{7}$/, diff --git a/test/validators.js b/test/validators.js index 346fe6071..4ae88acde 100644 --- a/test/validators.js +++ b/test/validators.js @@ -6027,6 +6027,26 @@ describe('Validators', () => { '02122333', ], }, + { + locale: 'ar-PS', + valid: [ + '+970563459876', + '970592334218', + '0566372345', + '0598273583', + ], + invalid: [ + '+9759029487', + '97059123456789', + '598372348', + '97058aaaafjd', + '', + '05609123484', + '+97059', + '+970', + '97056', + ], + }, { locale: 'ar-SY', valid: [