Skip to content

Commit 81853d3

Browse files
committed
feat(isMobilePhone): improve validation regex for Côte d'Ivoire and add test cases
1 parent 3ee9c71 commit 81853d3

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

src/lib/isMobilePhone.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const phones = {
101101
'fr-BF': /^(\+226|0)[67]\d{7}$/,
102102
'fr-BJ': /^(\+229)\d{8}$/,
103103
'fr-CD': /^(\+?243|0)?(8|9)\d{8}$/,
104-
'fr-CI': /^(\+?225|0)[01|05|07]\d{8}$/,
104+
'fr-CI': /^(\+?225)?(01|05|07)[0-9]{8}$/,
105105
'fr-CM': /^(\+?237)6[0-9]{8}$/,
106106
'fr-FR': /^(\+?33|0)[67]\d{8}$/,
107107
'fr-GF': /^(\+?594|0|00594)[67]\d{8}$/,

test/validators.test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8404,6 +8404,26 @@ describe('Validators', () => {
84048404
'+243700723845',
84058405
],
84068406
},
8407+
{
8408+
locale: 'fr-CI',
8409+
valid: [
8410+
'+2250123456789',
8411+
'+2250589387561',
8412+
'+2250789387561',
8413+
'2250123456789',
8414+
'2250589387561',
8415+
'2250789387561',
8416+
'0123456789',
8417+
'0589387561',
8418+
'0789387561',
8419+
],
8420+
invalid: [
8421+
'225',
8422+
'+2250223456789',
8423+
'+22523456789',
8424+
'22523456789',
8425+
],
8426+
},
84078427
{
84088428
locale: 'fr-GF',
84098429
valid: [

0 commit comments

Comments
 (0)