email-js
TypeScript icon, indicating that this package has built-in type declarations

2.0.3 • Public • Published

email-js

npm version Coverage Status Inline docs

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'

Dependencies (0)

    Dev Dependencies (4)

    Package Sidebar

    Install

    npm i email-js

    Weekly Downloads

    181

    Version

    2.0.3

    License

    MIT

    Unpacked Size

    4.11 kB

    Total Files

    5

    Last publish

    Collaborators

    • tautropfli