-
Notifications
You must be signed in to change notification settings - Fork 162
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 Number Validation #277
Conversation
} | ||
|
||
/** Phone number validation for Gibraltar */ | ||
lazy val phoneNumberGI: Validation[String] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that this is a very common pattern, probably would worth moving into a method with parameters for the country code and maybe the min/max number of digits to reduce code duplication.
(or maybe a couple of such methods if there are other common cases shared by many countries)
The more unique cases could remain as they are, of course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question, the point here is that each specific country has its own dialing rules and its own prefixes, in fact, the original issue only asked for US, UK and Europe. For example, as it stands, we can add whatever rules we want to the US and UK individually, but I don't really know what they want the scope of this validation to be. I'm going to refactor the code, but adding new specific validations for each country would lead to the same problem.
What a massive undertaking! Would be nice at some point to factor out some common code, but I am so impressed by the scope of this PR and grateful for this contribution, I am happy to merge as-is. Thank you so much & congratulations on your PR! |
@uurl please don't just take other people's code without proper attribution. Not a nice thing to do. |
@uurl Proper attribution is extremely important in the ZIO community, and should either happen by officially basing your work off another person's pull request, so that they will receive "Github credit" for it, or in cases where this is not possible, crediting the developer with a note in the source code. Thanks for your work building on @subotic's pull request, and to ensure he receives proper credit, please submit a followup pull request that, in a comment, notes the lines of code that should be credited. Something like: // Thanks to @subotic for his work developing this code It might also be possible to git rewrite history, but I can't help you with that. @subotic Thanks for writing code that formed part of this pull request, and we'll make sure you receive full attribution for it! |
This PR solves #249, solves #250 and solves #251 with all the countries in the world