email-address-util
Utilities for working with email addresses
Usage
# Install the package npm install email-address-util
# Require it in your JS fileconst EmailUtil = ;
Validate
Validate that the given string is a valid email address. This method uses the regular expression from W3, then validates the domain against IANA's list of valid TLDs.
EmailUtil # trueEmailUtil # false
Extract
Extract the first email address found in the given string. Uses the same regular
expression as validate
.
const strWithEmail = "My email address is jeff@jeff.com";const strWithoutEmail = "My email address is above";EmailUtil # "jeff@jeff.com"EmailUtil # false
Tests
Run tests with npm test
.