validatorjs / validator.js

String validation
MIT License
23.01k stars 2.29k forks source link

Is it possible to use `normalizeEmail` with a custom domain #1571

Open sarincasm opened 3 years ago

sarincasm commented 3 years ago

I have an app where most users are on a custom domain (the underlying account is google, so it follows the same rules). Can I use normalizeEmail to get a canonical version of such emails.

For Eg: normalizeEmail('me+1@gmail.com') -> returns me@gmail.com

I want: normalizeEmail('my+1@custom.com') -> should return my@custom.com

Maybe the custom domain that should be treated as same to a google email can be passed to normalizeEmail as an option

saharme commented 3 years ago

I added a PR with the change: https://github.com/validatorjs/validator.js/pull/1667