Test if a value is an email address.
var isEmail = require( '@stdlib/utils/is-email-address' );
Tests if a value
is an email address.
var bool = isEmail( 'beep@boop.com' );
// returns true
- Validation is not rigorous, nor should it be. 9 RFCs relate to email addresses, and accounting for all of them is a fool's errand. This module performs the simplest validation; i.e., requiring at least one
@
symbol. - For rigorous validation, send a confirmation email. If the email bounces, consider the email invalid.
var isEmail = require( '@stdlib/utils/is-email-address' );
var bool;
bool = isEmail( 'beep@boop.com');
// returns true
bool = isEmail( 'beep' );
// returns false
bool = isEmail( 'beep.com' );
// returns false
bool = isEmail( null );
// returns false
Usage: is-email [options] string
Options:
-h, --help Print this message.
-V, --version Print the package version.
$ is-email beep@boop.com
# => true