Skip to content

Webel-Technologies/webel_backend_library_email_normalize

 
 

Repository files navigation

normalize-email

Package deploy

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.

Installation

npm install --save normalize-email

Usage

var 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

Normalization rules vary by domain. The rules implemented by this package are:

  1. "plus" — remove first + mark and anything after it
  2. "dot" — remove all . marks
  3. "none" — do nothing

Emails are normalized by domain as follows:

  1. gmail.com — plus and dot
  2. googlemail.com (alias of gmail.com) — plus and dot
  3. hotmail.com — plus only
  4. live.com — plus and dot
  5. outlook.com — plus only
  6. all other domains — none

License

MIT


This package was initially generated with yeoman and the p generator.

About

Normalize + and . emails -- ex.ample+foobar@gmail.com => example@gmail.com

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%