2.0.3 • Published 2 years ago
email-js v2.0.3
email-js
Installation
npm install --save email-jsUsage
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')); // => robotAPI
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') // => truegetDomainPart(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'