Skip to content

Commit

Permalink
feat(isMobilePhone): update phone regex for Cameroon fr-CM
Browse files Browse the repository at this point in the history
  • Loading branch information
2p4b committed Sep 16, 2024
1 parent ff56dcf commit 1c48f0e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const phones = {
'fr-BF': /^(\+226|0)[67]\d{7}$/,
'fr-BJ': /^(\+229)\d{8}$/,
'fr-CD': /^(\+?243|0)?(8|9)\d{8}$/,
'fr-CM': /^(\+?237)6[0-9]{8}$/,
'fr-CM': /^(\+?237)(6|2)[0-9]{8}$/,
'fr-FR': /^(\+?33|0)[67]\d{8}$/,
'fr-GF': /^(\+?594|0|00594)[67]\d{8}$/,
'fr-GP': /^(\+?590|0|00590)[67]\d{8}$/,
Expand Down
24 changes: 24 additions & 0 deletions test/validators.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10667,6 +10667,30 @@ describe('Validators', () => {
args: ['any'],
});


// strict mode
// isMobile fr-CM
test({
validator: 'isMobilePhone',
valid: [
// Camtel Fixed
'+237222222222',
// Mobile
'+237698765432',
'+237658765432',
'+237678765432',
'+237677465432',
],
invalid: [
'254728530234',
'0728530234',
'+728530234',
'766667206',
'0766670206',
],
args: ['any', { strictMode: true }],
});

// strict mode
test({
validator: 'isMobilePhone',
Expand Down

0 comments on commit 1c48f0e

Please sign in to comment.