1.0.0 • Published 4 years ago

check-email v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

check-email

Build Status NPM version

Testing and Checking email regex

Getting Started

Install the module with

$ npm install --save check-email

Usage

var checkEmail = require('check-email');

var regex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;

checkEmail(regex, function (err, data) {

    console.log(data);
    // do anything, especially for testing

    /*
    {
        pass:[{
                value: 'huei90@gmail.com',
                description: 'normal case (this should be pass)'
            },
            {
                value: '123@gmail.com',
                description: 'email with number name'
            },
            {
                value: 'asdfaksjdfkl2j3kfjasdfk2kklasdfjklasdflkj2lk234lkjasfdlk2j@gmail.com',
                description: 'very long email'
            }],
        fail:[{
                value: 12312312312,
                description: 'number (should fail)'
            },
            {
                value: 'Hello World',
                description: 'String (should fail)'
            },
            {
                value: 'h u e i @gmail.com',
                description: 'email with blank (should fail)'
            }
        ]
    };
    */
});

CLI

$ npm install -g check-email
$ checkemail -h

License

Copyright (c) 2014 Huei Tan. Licensed under the MIT license.

1.0.0

4 years ago

0.1.1

5 years ago

0.1.0

5 years ago