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

phone validation for malawi ('en-MW') #1823

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

rohitnairtech
Copy link

@rohitnairtech rohitnairtech commented Oct 23, 2021

Checklist

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

@rohitnairtech
Copy link
Author

@tux-tn another one, is this right?

@codecov
Copy link

codecov bot commented Oct 23, 2021

Codecov Report

Merging #1823 (d586e26) into master (13651ea) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #1823   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          102       102           
  Lines         2029      2029           
  Branches       457       457           
=========================================
  Hits          2029      2029           
Impacted Files Coverage Δ
src/lib/isMobilePhone.js 100.00% <ø> (ø)
src/lib/isURL.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 13651ea...d586e26. Read the comment docs.

@rohitnairtech
Copy link
Author

Copy link
Member

@rubiin rubiin left a comment

Choose a reason for hiding this comment

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

Looks good

Copy link
Member

@rubiin rubiin left a comment

Choose a reason for hiding this comment

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

Please add tests too

@rohitnairtech
Copy link
Author

@tux-tn done! Tests added and passed.

Copy link
Author

@rohitnairtech rohitnairtech left a comment

Choose a reason for hiding this comment

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

Hi can we add this?

@rohitnairtech
Copy link
Author

@rubiin have added the test cases

Copy link
Member

@tux-tn tux-tn left a comment

Choose a reason for hiding this comment

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

@rohitnairtech Thank you for PR! Sorry for the review delay 😅

Can you please address my 2 comments below?

if (!isIP(host) && !isFQDN(host, options) && (!ipv6 || !isIP(ipv6, 6))) {
return false;
}

host = host || ipv6;

if (options.host_whitelist && !checkHost(host, options.host_whitelist)) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you please revert those unrelated changes?

@@ -117,6 +117,7 @@ const phones = {
'vi-VN': /^((\+?84)|0)((3([2-9]))|(5([25689]))|(7([0|6-9]))|(8([1-9]))|(9([0-9])))([0-9]{7})$/,
'zh-CN': /^((\+|00)86)?1([3456789][0-9]|4[579]|6[2567]|7[01235678]|9[012356789])[0-9]{8}$/,
'zh-TW': /^(\+?886\-?|0)?9\d{8}$/,
'en-MW': /^(\+?265|0)(\d{7}|\d{9})$/,
Copy link
Member

Choose a reason for hiding this comment

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

According to ITU Document and Wikipedia there is some carrier prefixes for mobile phones in both old and new malawi number plan. Can you take those prefixes into consideration please?

@tux-tn tux-tn added 🎉 first-pr 🧹 needs-update For PRs that need to be updated before landing labels Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎉 first-pr 🧹 needs-update For PRs that need to be updated before landing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants