Normalize emails for uniqueness validation. This will convert the email to lowercase, remove dots (.), and plus signs
followed by arbitrary strings (+foobar).
Fork from normailize. Based on normailize.
npm install --save normalize-emailvar normalizeEmail = require('normalize-email')
normalizeEmail('johnotander@GMAIL.com') // => 'johnotander@gmail.com'
normalizeEmail('john.o.t.a.n.d.e.r@gmail.com') // => 'johnotander@gmail.com'
normalizeEmail('johnotander@googlemail.com') // => 'johnotander@gmail.com'
normalizeEmail('johnotander+foobar@gmail.com') // => 'johnotander@gmail.com'
normalizeEmail('JOHN.OTANDER+OHAI@gmail.com') // => 'johnotander@gmail.com'Normalization rules vary by domain. The rules implemented by this package are:
- "plus" — remove first
+mark and anything after it - "dot" — remove all
.marks - "none" — do nothing
Emails are normalized by domain as follows:
gmail.com— plus and dotgooglemail.com(alias of gmail.com) — plus and dot- hotmail.com — plus only
- live.com — plus and dot
- outlook.com — plus only
- all other domains — none
MIT
This package was initially generated with yeoman and the p generator.