Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/johno/normalize-email

Normalize + and . emails -- [email protected] => [email protected]
https://github.com/johno/normalize-email

Last synced: 3 months ago
JSON representation

Normalize + and . emails -- [email protected] => [email protected]

Awesome Lists containing this project

README

        

# normalize-email [![Build Status](https://secure.travis-ci.org/johnotander/normalize-email.png?branch=master)](https://travis-ci.org/johnotander/normalize-email)

Normalize emails for uniqueness validation. This will convert the email to lowercase, remove dots (`.`), and plus signs
followed by arbitrary strings (`+foobar`).

Based on [normailize](https://github.com/soundcloud/normailize).

## Installation

```bash
npm install --save normalize-email
```

## Usage

```javascript
var normalizeEmail = require('normalize-email')

normalizeEmail('[email protected]') // => '[email protected]'
normalizeEmail('[email protected]') // => '[email protected]'
normalizeEmail('[email protected]') // => '[email protected]'
normalizeEmail('[email protected]') // => '[email protected]'
normalizeEmail('[email protected]') // => '[email protected]'
```

## Normalization Rules

Normalization rules vary by domain. The rules implemented by this package are:
1. "plus" — remove first `+` mark and anything after it
1. "dot" — remove all `.` marks
1. "none" — do nothing

Emails are normalized by domain as follows:
1. `gmail.com` — plus and dot
1. `googlemail.com` (alias of gmail.com) — plus and dot
1. hotmail.com — plus only
1. live.com — plus and dot
1. outlook.com — plus only
1. all other domains — none

## License

MIT

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Crafted with <3 by John Otander ([@4lpine](https://twitter.com/4lpine)).

***

> This package was initially generated with [yeoman](http://yeoman.io) and the [p generator](https://github.com/johnotander/generator-p.git).