node package manager

email-js

An immutable value - object for email addresses

email-js

npm install --save email-js
EmailAddress('<email>')
const EmailAddress = require('email-js');
 
console.log(EmailAddress('ruby@fog.im')); // => EmailAddress(ruby@fog.im) 
EmailAddress('a') // => TypeError 

Returns true if the email is valid. The email address is validated on construction by Webkit's regex.

console.log(EmailAddress.isValid('root@localhost')) // => true 

Returns the domain part of the email.

console.log(EmailAddress('root@localhost').getDomain()) // => 'localhost' 

Returns the local part of the email.

console.log(EmailAddress('root@localhost').getLocal()) // => 'root' 

Converts the email address back to a string.

console.log(EmailAddress('root@localhost').toString()) // => 'root@localhost' 

Returns the email's length.

console.log(EmailAddress('root@localhost').length) // => 14