Skip to content

Commit

Permalink
feat(isMobilePhone): regex for Burkina Faso fr-BF and Namibia en-NA l…
Browse files Browse the repository at this point in the history
…ocales

chore: squashed commits from #1834

feat(isMobilePhone): regex for Namibia locale

fix(isMobilePhone): removing telephone validation

fix(isMobliePhone): regex now validates as intended

fix(isMobilePhone): requiring phone number prefixes in validation

feat(isMobilePhone): regex for Burkina Faso locale

fix(isMobilePhone): removing code intended for a different branch

fix(isMobilePhone): Making plus sign optional

feat(isMobilePhone): regex for Burkina Faso locale
  • Loading branch information
ZeeMangena authored and profnandaa committed Oct 31, 2021
1 parent fc0fefc commit 5c2d69e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const phones = {
'en-KE': /^(\+?254|0)(7|1)\d{8}$/,
'en-MT': /^(\+?356|0)?(99|79|77|21|27|22|25)[0-9]{6}$/,
'en-MU': /^(\+?230|0)?\d{8}$/,
'en-NA': /^(\+?264|0)(6|8)\d{7}$/,
'en-NG': /^(\+?234|0)?[789]\d{9}$/,
'en-NZ': /^(\+?64|0)[28]\d{7,9}$/,
'en-PK': /^((00|\+)?92|0)3[0-6]\d{8}$/,
Expand Down Expand Up @@ -76,6 +77,7 @@ const phones = {
'fi-FI': /^(\+?358|0)\s?(4(0|1|2|4|5|6)?|50)\s?(\d\s?){4,8}\d$/,
'fj-FJ': /^(\+?679)?\s?\d{3}\s?\d{4}$/,
'fo-FO': /^(\+?298)?\s?\d{2}\s?\d{2}\s?\d{2}$/,
'fr-BF': /^(\+226|0)[67]\d{7}$/,
'fr-CM': /^(\+?237)6[0-9]{8}$/,
'fr-FR': /^(\+?33|0)[67]\d{8}$/,
'fr-GF': /^(\+?594|0|00594)[67]\d{8}$/,
Expand Down
46 changes: 46 additions & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -6733,6 +6733,31 @@ describe('Validators', () => {
'+3361245789',
],
},
{
locale: 'fr-BF',
valid: [
'+22661245789',
'+22665903092',
'+22672457898',
'+22673572346',
'061245789',
'071245783',
],
invalid: [
'0612457892',
'06124578980',
'0112457898',
'0212457898',
'0312457898',
'0412457898',
'0512457898',
'0812457898',
'0912457898',
'+22762457898',
'+226724578980',
'+22634523',
],
},
{
locale: 'fr-CA',
valid: ['19876543210', '8005552222', '+15673628910'],
Expand Down Expand Up @@ -7000,6 +7025,27 @@ describe('Validators', () => {
'66338855',
],
},
{
locale: ['en-NA'],
valid: [
'+26466189012',
'+26461555804',
'+26461434221',
'+26487555169',
'+26481555663',
],
invalid: [
'12345',
'',
'Vml2YW11cyBmZXJtZtesting123',
'+2641234567890',
'+2641234567',
'+2648143422',
'+264981234',
'4736338855',
'66338855',
],
},
{
locale: 'ru-RU',
valid: [
Expand Down

0 comments on commit 5c2d69e

Please sign in to comment.