Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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]
- Host: GitHub
- URL: https://github.com/johno/normalize-email
- Owner: johno
- License: mit
- Created: 2015-05-08T19:10:32.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-03-31T16:17:13.000Z (almost 5 years ago)
- Last Synced: 2024-04-13T17:29:32.633Z (10 months ago)
- Language: JavaScript
- Size: 11.7 KB
- Stars: 39
- Watchers: 4
- Forks: 12
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license
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 nothingEmails 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 RequestCrafted 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).