Added support of custom email domain on normalizeEmail
{{ briefly describe what you have done in this PR }}
Checklist
- [X] PR contains only changes related; no stray files, etc.
- [X] README updated (where applicable)
- [X] Tests written (where applicable)
Resolves issue https://github.com/validatorjs/validator.js/issues/1571
Codecov Report
Attention: Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
Project coverage is 99.94%. Comparing base (
d1a9b6d) to head (3d53dfc). Report is 312 commits behind head on master.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/lib/normalizeEmail.js | 87.50% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #1667 +/- ##
===========================================
- Coverage 100.00% 99.94% -0.06%
===========================================
Files 101 101
Lines 1854 1861 +7
===========================================
+ Hits 1854 1860 +6
- Misses 0 1 +1
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@saharme -- thanks for your contrib! Please fix the coverage issue.
Hi @saharme
As far as I understand, is_custom_email_domain option is not compatible with the rest of the normalizers (gmail, yahoo, etc.) For example: if the is_custom_email_domain option is set true, the rest of the normalizers are ignored. In addition, this make it hard to use in the express-validator use case where you create the normalizer before knowing the value.
My suggestion is to add different options for custom domains. For example, adding custom_remove_subaddress, custom_remove_dots, etc. The option allow_custom_domains can be added in order to enable this normalizer.
cc: @profnandaa
ping @saharme