Skip to content

feat(isMobilePhone): add fr-ML (Mali) and fr-TG (Togo) locales#2691

Open
tranhoangtu-it wants to merge 5 commits intovalidatorjs:masterfrom
tranhoangtu-it:feat/add-fr-ML-fr-TG-mobile-phone
Open

feat(isMobilePhone): add fr-ML (Mali) and fr-TG (Togo) locales#2691
tranhoangtu-it wants to merge 5 commits intovalidatorjs:masterfrom
tranhoangtu-it:feat/add-fr-ML-fr-TG-mobile-phone

Conversation

@tranhoangtu-it
Copy link
Copy Markdown

Summary

Adds mobile phone number validation for two West African French-speaking countries, contributing to issue #1761.

Mali (fr-ML) — country code +223

Mobile operators and their prefixes:

  • Orange Mali: 7x
  • Malitel (Moov Africa): 6x, 9x

Regex: /^(\+?223)?[679]\d{7}$/

Reference: ITU-T Mali Numbering Plan

Togo (fr-TG) — country code +228

Mobile operators and their allocated prefixes:

  • Togocel: 70–73, 90–93
  • Moov: 78–79, 96–99
  • Prefixes 74–77 and 94–95 are not allocated

Regex: /^(\+?228)?(7([0-3]|[89])|9([0-3]|[6-9]))\d{6}$/

Reference: ITU-T Togo Numbering Plan

Files Changed

  • src/lib/isMobilePhone.js — added fr-ML and fr-TG entries in alphabetical order
  • test/validators.test.js — added valid and invalid test cases for both locales
  • README.md — added fr-ML and fr-TG to the supported locale list

Closes #1761

Add mobile phone number validation for Mali (fr-ML) and Togo (fr-TG).

Mali (+223):
- Mobile operators: Orange (7x), Malitel (6x, 9x)
- Pattern: /^(\+?223)?[679]\d{7}$/
- Based on ITU-T numbering plan for Mali

Togo (+228):
- Mobile operators: Togocel (70-73, 90-93), Moov (78-79, 96-99)
- Excludes non-existent prefixes 74-77 and 94-95
- Pattern: /^(\+?228)?(7([0-3]|[89])|9([0-3]|[6-9]))\d{6}$/
- Based on ITU-T numbering plan for Togo

Closes validatorjs#1761
Copilot AI review requested due to automatic review settings March 28, 2026 10:09
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (9fa1e3a) to head (b84d0f0).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2691   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          114       114           
  Lines         2595      2595           
  Branches       659       659           
=========================================
  Hits          2595      2595           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds isMobilePhone validation support for Mali (fr-ML) and Togo (fr-TG) and updates tests/docs accordingly (per #1761).

Changes:

  • Add fr-ML and fr-TG regexes to src/lib/isMobilePhone.js
  • Add valid/invalid test vectors for both locales in test/validators.test.js
  • Document the new locales in the README supported locale list

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/lib/isMobilePhone.js Adds regex patterns for fr-ML and fr-TG locales
test/validators.test.js Adds locale-specific valid/invalid cases for Mali and Togo
README.md Adds fr-ML / fr-TG to the documented locale list

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@tranhoangtu-it
Copy link
Copy Markdown
Author

Thanks for the review feedback! Addressing both issues:

  1. Locale ordering — Moving fr-ML to its correct alphabetical position (between fr-MQ and before fr-PF)
  2. README sync — Will update to match actual isMobilePhoneLocales

Pushing fix shortly.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tranhoangtu-it
Copy link
Copy Markdown
Author

@rubiin All review feedback has been addressed:

  1. Locale ordering — fr-ML and fr-TG are in correct alphabetical positions
  2. README fully synced — regenerated the entire locale list (171 locales) from src/lib/isMobilePhone.js, fixing am-AM, ro-MD casing and adding missing locales (ar-LB, ar-LY, ar-MA, ar-OM, ar-QA, en-NA, fr-CA, fr-CH, fr-CM, it-CH, lv-LV, etc.)

Ready for re-review.

rubiin
rubiin previously approved these changes Mar 28, 2026
@rubiin rubiin requested a review from WikiRik March 28, 2026 17:40
@tranhoangtu-it
Copy link
Copy Markdown
Author

Done! Synced the README \ locale list with the actual source (163 locales). The second locale list in README was missing several locales and had some that didn't exist in source — now both lists are in sync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mobile Phone validations - For The First Time Contributors

3 participants