npm.io
2020.4.16 • Published 6 years ago

@webb/validate-email

Licence
MIT
Version
2020.4.16
Deps
1
Size
4 kB
Vulns
0
Weekly
0
Stars
3

@webb/validate-email

Pretty good email validation

Install

$ npm i @webb/validate-email

Usage

import validateEmail from "@webb/validate-email";

// You would obviously have this wrapped in an async function
// This example is extremely pared down

if (!validateEmail("l0l you gez h@x0r3d!")) {
  return "Email validation failed";
}
// You can also import the raw regex this module is using...
// But like, why?
import { emailRegex } from "@webb/validate-email";

if (!emailRegex.test("you@example.com")) {
  return "Email validation failed";
}

API

validateEmail(suppliedEmail)
suppliedEmail

Type: string

Pass any input into this function and you will find out if it is valid or not.

emailRegex

You better know what you are doing.