npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

email-validator-pro

v1.0.1

Published

Validate email address patterns that others don't. This project aims to support all common addresses along with many rare ones that are considered valid under RFC standards. It can be used in both client and server side environments.

Downloads

37

Readme

EmailValidatorPro

Support valid email address patterns that others don't (including unicode characters, IP address domains, quoted local parts, et al.).

Many validators — including the one that's baked into HTML5 — only support more common email addresses. This project aims to support all common addresses along with many rare ones that are considered valid under RFC standards. It works on both client and server side environments.

See the email address wiki page for more details on acceptable addresses. See some valid address examples below.

Usage

Node

npm i email-validator-pro -S

let EmailValidatorPro = require("email-validator-pro");

Minified version:

let EmailValidatorPro = require("email-validator-pro/dist/EmailValidatorPro.min");

npm

Browser

import EmailValidatorPro from "email-validator-pro";

Minified version:

import EmailValidatorPro from "email-validator-pro/dist/EmailValidatorPro.min";

Script tag:

<script src="node_modules/email-validator-pro/dist/EmailValidatorPro.min.js"></script>

Notes

  • This project is dependency free.
  • The source code is written in ES6 and transpiled with Babel.
  • If you need to create documentation for local use, run npm run doc. Otherwise, visit the online docs.
  • Some rare, but RFC compliant email addresses are not supported.
    • See the unit test lines labeled "Valid, but unsupported..." .
  • Pull requests are welcomed.

Samples

let evp = new EmailValidatorPro();

console.log(evp.isValidAddress("[email protected]"));  //true
console.log(evp.isValidAddress("[email protected]")); //false
let evp = new EmailValidatorPro(),
    parts = evp.getParts("[email protected]");

console.log(parts); //{local: "contact", domain: "email.com"}

See the full documentation.

Valid Addresses

Patterns like the below are RFC compliant and supported.

  • niceandsimple@example.com
  • very.common@example.com
  • a.little.lengthy.but.fine@dept.example.com
  • disposable.style.email.with+symbol@example.com
  • other.email-with-dash@example.com
  • "much.more unusual"@example.com
  • "[email protected]"@example.com
  • #!$%&\'*+-/=?^_{}|~@example.org
  • " "@example.org
  • üñîçøðé@üñîçøðé.com
  • admin@mailserver1
  • user@tt
  • "hi"@example.com
  • jsmith@[192.168.2.1]
  • jsmith@[IPv6:2001:db8::1]
  • email@123.123.123.123
  • "()<>[]:,;@\\\"!#$%&\'*+-/=?^_{}| ~.a"@example.org
  • abc."defghi".xyz@example.com
  • _______@example.com
  • very.unusual."@".unusual.com@example.com
  • john.smith(comment)@example.com
  • (comment)john.smith@example.com
  • "()<>[]:,;@\\\"!#$%&\'*+-/=?^_{}| ~.a"(comment)@example.org

Valid, But Unsupported Addresses

The below are valid (but rare) email addresses that are not supported.

  • "very.(),:;<>[]\".VERY.\"very@\\ \"very\".unusual"@strange.example.com
  • "()<>[]:,;@\"!#$%&\'*+-/=?^_{}| ~.a"@example.org
  • abc."d\"efghi".xyz@example.com
  • much."more\ unusual"@example.com

Unit Tests

See the unit tests.

License

Copyright (c) 2012, 2017 Leandro Silva (http://grafluxe.com)

Released under the MIT License.

See LICENSE.md for entire terms.