-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
validator.normalizeEmail improvements #320
Conversation
…lexibility, improved googlemail.com support
Actually, I'm also thinking (after reading comments to the pull request that created normalizeEmail) that it would be a good idea to create a flag to enable and disable host-specific normalizations, one for each host. Suppose this scenario.
So, my suggestion is to not apply host-specific normalizations by default. For each host that exists or is added, a new option flag has to be added. |
I agree with 1, 2 and 3. In fact I think it should always normalize googlemail.com => gmail.com without needing an option since AFAIK both are interchangeable. I think being able to enable/disable host-specific migrations is getting too complicated. The situation you described is really outside the scope of the library. |
Ok I will change the flag to automatically normalize googlemail.com . Please let me know if you need anything more to accept the pull request. Speaking about the other issue, I understand your point and I agree that enabling/disabling each host could be complicated. However, I don't see the situation I described as outside the scope of the library; au contraire is exactly what I would use normalizeEmail() for. I can bring three different proposals for this issue:
Now it's your call :) |
Thanks. I'd still prefer to keep it simple and use the same strategy that I use when I introduce any other breaking change: bump the major, as per semver. If you could fix up a few things:
|
Ok. So, shall I also rename the method to "normalizeGMail"?Anyways, it's thanksgiving weekend in Canada. I'll fix the patch on Monday On Sat, Oct 11, 2014 at 3:18 AM, chriso [email protected] wrote:
|
Leave it as |
Done |
Perfect, thanks! |
validator.normalizeEmail improvements
Available in |
I made some improvements to validator.normalizeEmail:
However: the hostname is always lowercased and the local part of hosts known for being case-insensitive (currently, only gmail/googlemail) is always lowercased.
Please note: per issue #258 I had to remove a couple of existing test cases, as they were failing on validator.isEmail.