validator.js
validator.js copied to clipboard
Mobile Phone validations - For The First Time Contributors
I would like to give this to the people who are new and would like to start contributing to validator.js.
The current version in isMobilePhone validation
, we have less than 195 phone validations i.e
In the code https://github.com/validatorjs/validator.js/blob/master/src/lib/isMobilePhone.js, the validations exist from line 5 to line 119, which means we have probably 119 - 5 countries phone validations. Where might be other countries? That is up to someone who would like to choose which country does not exist and create a new validation for the same.
When making this change, apart from the file above, also add tests and update the isMobilePhone section in the README.
Also, please check on existing PR's if the country you choose to validate mobile phone numbers does not have an already PR raised.
All Prs are welcomed and we will do a review on the same
Great catch, please do add @mairagee524 and reference your PR to this issue with the correct title such as
phone number for Mexico(code)
etc.
Thanks and looking forward to your PR. I will also double-check on the same.
It seems that Cuba is not on the list either, could I work on that ?
Sure, please do.
On Fri, Oct 8, 2021, 8:14 PM Pablo Salas Gelich @.***> wrote:
It seems that Cuba is not on the list either, could I work on that ?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/validatorjs/validator.js/issues/1761#issuecomment-938892563, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVWPH756XKT3WGXB4RZAELUF4RHDANCNFSM5FSXM3NQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Afghanistan is also missing, working on that...
Please do add and raise a Pr
On Sat, Oct 9, 2021, 3:15 PM Neel Deshmukh @.***> wrote:
Afghanistan is also missing, I belive
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/validatorjs/validator.js/issues/1761#issuecomment-939287602, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVWPH3HH5S7MKWFE26FRYLUGAW57ANCNFSM5FSXM3NQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Please do add and raise a Pr … On Sat, Oct 9, 2021, 3:15 PM Neel Deshmukh @.***> wrote: Afghanistan is also missing, I belive — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#1761 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVWPH3HH5S7MKWFE26FRYLUGAW57ANCNFSM5FSXM3NQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Yes, I did.
Btw, for new contributors, what i did was find list of the country code and their ISO codes, wrote simple program to filter non existing countries and wrote the code.
here are the resources : https://www.att.com/support_media/images/pdf/Country_Code_List.pdf https://countrycode.org/
@ezkemboi I'm not adding all the missing country code validations, i would like other people to contribute, but after October if still there are no contributions in this or we have missing validations, I would try to complete the list...
Sure thing.
On Sat, Oct 9, 2021, 3:49 PM Neel Deshmukh @.***> wrote:
Please do add and raise a Pr … <#m_7010722731381047102_> On Sat, Oct 9, 2021, 3:15 PM Neel Deshmukh @.***> wrote: Afghanistan is also missing, I belive — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#1761 (comment) https://github.com/validatorjs/validator.js/issues/1761#issuecomment-939287602>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVWPH3HH5S7MKWFE26FRYLUGAW57ANCNFSM5FSXM3NQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub .
Yes, I did.
Btw, for new contributors, what i did was find list of the country code and their ISO codes, wrote simple program to filter non existing countries and wrote the code.
here are the resources : https://www.att.com/support_media/images/pdf/Country_Code_List.pdf https://countrycode.org/
@ezkemboi https://github.com/ezkemboi I'm not adding all the missing codes as, i would like other people to contribute, but after October if still there are no contributions, I would try to complete the list...
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/validatorjs/validator.js/issues/1761#issuecomment-939291996, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVWPH46IX2ZGVOLK4A7SZTUGA25RANCNFSM5FSXM3NQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
I didn't see Botswana on the list. Could I add this validation?
@mgndolan please add that and raise a PR, I will review that.
It seems like Madagascar in not on the list. Could I add this validation?
looks like grenada is also not there in the list, should i add this a validation for this?
Please do add them.
On Sun, Oct 10, 2021, 11:20 AM Siddhant Sharma @.***> wrote:
looks like grenada is also not there in the list, should i add this a validation for this?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/validatorjs/validator.js/issues/1761#issuecomment-939429396, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVWPH3S2B3UKSG6BKHYNQ3UGFEGFANCNFSM5FSXM3NQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
It seems like Bhutan is not on the list, should I add validation for this? @ezkemboi
Yes @lakshayr003
It would we nice if we could write comment country name in front of each country code.
I was just poking around and noticed that there wasn't an entry for Cameroon. Should I work on this?
Opened PR #1772.
Good stuff @beckettnormington. Thanks all for opening PRs, let's keep them coming. I will spend this week reviewing them.
@ezkemboi Hi! I previously did a contribution to this project, by adding mobile phone number validation for Sri Lanka. I was inspired to participate in Hacktoberfest this time and reached out again.
Just noticed that the contribution I added to validate mobile numbers in Sri Lanka has been replaced by this:
en-SL': /^(\+?232|0)\d{8}$/
However, it does not validate mobile numbers in Sri Lanka correctly (sources: https://en.wikipedia.org/wiki/Telephone_numbers_in_Sri_Lanka).
Is there a specific reason for the change? If not, I can make the necessary changes to make it work correctly again. Thank you!
Please do make the changes @Madhavi96 . But, also, I will need to make sure why it was changed and if the changes made are also necessary. Thank you.
Thanks. Let me know if you find anything on the requirement for the change. Until then I'll do the changes and raise a PR.
@ezkemboi Found the validation for Sri Lanka, under 'si-LK': /^(?:0|94|\+94)?(7(0|1|2|5|6|7|8)( |-)?\d)\d{6}$/
, and that is correct
Apologies for the false alarm!
No worries
On Mon, Oct 11, 2021, 7:30 PM Ishara Madhavi @.***> wrote:
@ezkemboi https://github.com/ezkemboi Found the validation for Sri Lanka, under 'si-LK': /^(?:0|94|+94)?(7(0|1|2|5|6|7|8)( |-)?\d)\d{6}$/, and that is correct
Apologies for the false alarm!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/validatorjs/validator.js/issues/1761#issuecomment-940178995, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVWPH5QRBHWNFGD4W3X6YLUGMGKLANCNFSM5FSXM3NQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
@ezkemboi I created a pull request but the npm test
failed even though it runs successfully on my local machine, Im using node v14.18.0 and npm v6.14.15
PR:- added brunei (ms-BN)
Error- Unexpected token ) Referenced from: /home/runner/work/validator.js/validator.js/node_modules/eslint-config-airbnb-base/index.js Referenced from: /home/runner/work/validator.js/validator.js/.eslintrc.json /home/runner/work/validator.js/validator.js/node_modules/eslint-module-utils/parse.js:97 ); ^ npm ERR! Failed at the [email protected] lint script 'eslint src test'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the validator package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! eslint src test
Issue happens for test on Nodejs 6
PR code - #1776
Hi @ezkemboi , I have submitted the PR #1770, I am a first time contributor so it would be great if you could check if I have followed all the steps correctly?
It seems Croatia isn't on the list. could i work on that?
Good stuff
Hi, I have done an enhancement to the mobile number validation regex used for Sri Lanka and submitted the PR.
some business customer in Estonia may want to use +3726xxxxx for their phone nr, but validation does`t allows us to use it
'et-EE': /^(\+?372)?\s?(5|8[1-4])\s?([0-9]\s?){6,7}$/,
PS, im not from Estonia, got this information from my client
@borm thank you for your feedback ! Feel free to open a separate issue if you think it's a bug or if you can/want a new PR if you think you can fix it
It doesn't look like Haiti is on this list - I can add it?
El Salvador is not in the list. I will add it :D
El Salvador is not in the list. I will add it :D
Someone already opened a PR for Salvador
Looks like Argentina is not on the list. Can I add it?
Looks like Argentina is not on the list. Can I add it?
Argentina is on the list
Looks like Morocco is not on the list. Can I add it?
Hi, I did see India was not on the list. Added regex successfully. All tests passed #1805
Looks like Croatia is not on the list. Can I add it?
Looks like America Samoa is not there. Can i fix it?
@zolezzi I have already submitted PR for croatia #1779.
@atom19-i Thanks! I did not see your comment, sorry! Looking at the comments and validations, Qatar is not in the list, can I add it?
@atom19-i Thanks! I did not see your comment, sorry! Looking at the comments and validations, Qatar is not in the list, can I add it?
You can add any locale as long as it doesn't already exist and there is no open PR for it or someone that requested to add it before you!
I don't see Maldives in the list currently. I'll pick that up.
@ezkemboi I have updated Bangladesh and added Myanmar mobile number validation. Can you please approve.
Added Jamaica validation in #1819
Added Kiribati validation in #1820
Namibia validation needed?
There's already a regex for the Hungarian mobile numbers, but it is incomplete. It is missing the internal country code option (06 instead of +36), and there are also new area codes added in the past few years that are not included. It would also be nice if it was covered with a few test cases. Should this be an issue on its own, or could I raise a PR against this one and get it updated?
There's already a regex for the Hungarian mobile numbers, but it is incomplete. It is missing the internal country code option (06 instead of +36), and there are also new area codes added in the past few years that are not included. It would also be nice if it was covered with a few test cases. Should this be an issue on its own, or could I raise a PR against this one and get it updated?
Feel free to open a new PR. No need to create a new issue!
Many thanks to all the people that participated as part of Hacktoberfest. We had 28 Pull requests merged 🎉 !
Hello, I would like to add Burundi validation.
Hello, I would like to add Burundi validation.
Thank you @pavolmarc ! You can go ahead and open a PR
Hi, I'm a student in 4th year looking to start working on open-source projects, can I contribute by working on this issue, if there is any phone number that would need to be added ?
@LucasFab Welcome ! Feel free to choose any locale that doesn't already exist (you check the existing list in the readme file) or that don't have any open PR
@tux-tn Hello I opened a pull request ready to review - #1872
@tux-tn Hello, I have added one country in the list, please review #1880. Thanks.
@tux-tn Hello, I have added Iceland phone validation.(#1885)
hello, i would like to add validation for Lesotho!
hello, i don't see the validation for Trinidad and Tobago. May i add it?
Please add in separate PRs I case.
On Wed, Jan 19, 2022, 8:24 PM Teddy Yongo @.***> wrote:
hello, i don't see the validation for Trinidad and Tobago. May i add it?
— Reply to this email directly, view it on GitHub https://github.com/validatorjs/validator.js/issues/1761#issuecomment-1016693760, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVWPHYVBP6GC5NI7PVBSCDUW3XTHANCNFSM5FSXM3NQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you were mentioned.Message ID: @.***>
PR for adding Nicaragua https://github.com/validatorjs/validator.js/pull/1909
Hello, I still don't see validations for multiple countries. Can I work on it and add all of those ????
Yes please @Mustafiz04
Hello, I've found a couple more that can be added to the list - am I okay to work on those?
@savannahvaith go for it!
MONGOLIA is missing I am working on it
Hello saw Aruba was not on the list. Shared the PR.
Hi I fix MONGOLIA missing from list fixed issue please find PR: https://github.com/validatorjs/validator.js/pull/1993
I am working on country Benin
Hi I fix BENIN missing from list fixed issue Please review PR: https://github.com/validatorjs/validator.js/pull/1997/
@profnandaa , others Please review PR: https://github.com/validatorjs/validator.js/pull/1997
added mobile phone validation for Papua New Guinea. PR: #2002