From f7ff349b0c0429a2c41cc18bc86fc85e9224ab4d Mon Sep 17 00:00:00 2001 From: Angel Mendez Date: Sat, 16 Oct 2021 11:35:42 -0500 Subject: [PATCH] feat(isMobilePhone): add Frech Polynesia fr-PF locale Create validation for frech polynesia mobile phones according to wikipedia: https://en.wikipedia.org/wiki/Telephone_numbers_in_French_Polynesia#Mobile --- src/lib/isMobilePhone.js | 1 + test/validators.js | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index 70b032cf8..404d9b02c 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -85,6 +85,7 @@ const phones = { 'fr-GF': /^(\+?594|0|00594)[67]\d{8}$/, 'fr-GP': /^(\+?590|0|00590)[67]\d{8}$/, 'fr-MQ': /^(\+?596|0|00596)[67]\d{8}$/, + 'fr-PF': /^(\+?689)?8[789]\d{6}$/, 'fr-RE': /^(\+?262|0|00262)[67]\d{8}$/, 'he-IL': /^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/, 'hu-HU': /^(\+?36|06)(20|30|31|50|70)\d{7}$/, diff --git a/test/validators.js b/test/validators.js index e3c69f0a0..8b12c03df 100644 --- a/test/validators.js +++ b/test/validators.js @@ -6885,6 +6885,28 @@ describe('Validators', () => { '+26261245789', ], }, + { + locale: 'fr-PF', + valid: [ + '87123456', + '88123456', + '89123456', + '+68987123456', + '+68988123456', + '+68989123456', + '68987123456', + '68988123456', + '68989123456', + ], + invalid: [ + '7123456', + '86123456', + '87 12 34 56', + 'definitely not a number', + '01+68988123456', + '6898912345', + ], + }, { locale: 'ka-GE', valid: [