2.0.3 • Published 25 days ago
email-js v2.0.3
email-js
Installation
npm install --save email-js
Usage
const { isValidEmail, getDomainPart, getLocalPart } = require('email-js');
console.log(isValidEmail('robot@example.com')); // => true
console.log(getDomainPart('robot@example.com')); // => example.com
console.log(getLocalPart('robot@example.com')); // => 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'