Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(isMobilePhone): fix 'ms-MY' matching invalid numbers #2155

Merged
merged 1 commit into from
Jan 29, 2023

Conversation

pano9000
Copy link
Contributor

refactoredthe regexp:

  • removed meaningless {1} quantifiers
  • simplified regexp a bit (removing useless escape character)

and most importantly:

tests

  • added tests for invalid numbers

fixes #1066

  • PR contains only changes related; no stray files, etc.
  • [ ] README updated (where applicable)
  • Tests written (where applicable)

@codecov
Copy link

codecov bot commented Jan 23, 2023

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage 👍

Coverage data is based on head (a260c5f) compared to base (f97e8d4).
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2155   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          105       105           
  Lines         2335      2335           
  Branches       586       586           
=========================================
  Hits          2335      2335           
Impacted Files Coverage Δ
src/lib/isMobilePhone.js 100.00% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

WikiRik
WikiRik previously approved these changes Jan 23, 2023
rubiin
rubiin previously approved these changes Jan 24, 2023
@profnandaa profnandaa added the mc-to-land Just merge-conflict standing between the PR and landing. label Jan 28, 2023
refactored the regexp:
---
* removed meaningless {1} quantifiers
* simplified regexp a bit (removing useless escape character)
* fixed the bug that would cause it to match invalid numbers

tests
---
* added tests for invalid numbers

fixes validatorjs#1066
@pano9000 pano9000 dismissed stale reviews from rubiin, Santhosh-Kumar-99, and WikiRik via a260c5f January 28, 2023 23:14
@pano9000 pano9000 force-pushed the fix_isMobilePhone_#1066 branch from e3bd52d to a260c5f Compare January 28, 2023 23:14
@rubiin rubiin removed the mc-to-land Just merge-conflict standing between the PR and landing. label Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

isMobilePhone returns true for +01112353576 when passing any as locale. Is this a bug?
5 participants