1.0.0 • Published 11 years ago
email-split v1.0.0
email-split 
Split an email address into its local and domain parts
This was built to grab the name used off of an email address. This library does not perform validation as we retrieve our email addresses from a trusted source.
Getting Started
Install the module with: npm install email-split
var emailSplit = require('email-split');
emailSplit('todd@underdog.io'); /*
{
local: 'todd',
domain: 'underdog.io'
}
*/Documentation
We expose the function emailSplit as our module.exports.
emailSplit(email)
Function that extracts local and domain parts of email address.
- email
String- Email address to break down
Returns:
- retVal
Object|null- If the email does not contain an@, then we returnnull. Otherwise, we return anObject.- An
@is required in a valid email address. We have decided to returnnullfor consistency withArray.matchandString.splitbehaviors. - local
String- Leading portion of email address- For example,
toddintodd@underdog.io
- For example,
- domain
String- Tailing portion of email address- For example,
underdog.iointodd@underdog.io
- For example,
- An
We chose the names
localanddomainbased off of the RFC specification formailto.
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint via npm run lint and test via npm test.
License
Copyright (c) 2015 Underdog.io
Licensed under the MIT license.
1.0.0
11 years ago