node package manager


An immutable value - object for email addresses


npm install --save email-js
const EmailAddress = require('email-js');
console.log(EmailAddress('')); // => EmailAddress( 
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