Skip to content

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

Open
tranhoangtu-it wants to merge 1 commit into
validatorjs:masterfrom
tranhoangtu-it:feat/add-fr-ML-fr-TG-mobile-phone
Open

tranhoangtu-it wants to merge 1 commit into
validatorjs: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

Copilot AI review requested due to automatic review settings March 28, 2026 10:09
@codecov

codecov Bot commented Mar 28, 2026 •

Copy link
Copy Markdown

Codecov Report

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

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

☔ View full report in Codecov by Harness.
📢 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread src/lib/isMobilePhone.js Resolved
Comment thread README.md Resolved
@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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread README.md Resolved
@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
@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.

rubiin
rubiin previously approved these changes Mar 31, 2026
@tranhoangtu-it

Copy link
Copy Markdown
Author

Rebased onto master (78c301a); npm test (build, lint, and all 323 Mocha tests) passes cleanly and conflicts are resolved.

@tranhoangtu-it
tranhoangtu-it force-pushed the feat/add-fr-ML-fr-TG-mobile-phone branch from 78c301a to 1aac68a Compare November 29, 2026 19:01
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