email-js
v2.0.3
Published
A collection of helpers for email addresses
Downloads
2,779
Readme
email-js
Installation
npm install --save email-js
Usage
const { isValidEmail, getDomainPart, getLocalPart } = require('email-js');
console.log(isValidEmail('[email protected]')); // => true
console.log(getDomainPart('[email protected]')); // => example.com
console.log(getLocalPart('[email protected]')); // => robot
API
isValidEmail(email: string
) => boolean
Returns true if the email is valid. The address is validated on by the same regex used by Webkit.
isValidEmail('root@localhost') // => true
getDomainPart(email: string
) => string
Returns the domain part of the email.
getDomainPart('root@localhost') // => 'localhost'
getLocalPart(email: string
) => string
Returns the local part of the email.
getLocalPart('root@localhost') // => 'root'