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

is-email-maybe

v1.0.1

Published

Sort-of-strong, but also loose email address validator which uses the same regex as Angular 1.

Downloads

6,548

Readme

is-email-maybe

Hey, I just met you, and this is crazy, but here's my address. isEmailMaybe? Sort-of-strong, but also loose email address validator which uses the same regex as Angular 1.

Build Status Code Coverage version downloads MIT License All Contributors

PRs Welcome Donate Code of Conduct Roadmap

The problem

Email validation is hard. You'll probably always get it wrong. The most sure way to validate that an email is valid is by sending it something. Most of the time this works great. If someone wants to sign up for you newsletter, you just let them type whatever they want, then you send them an email and ask them to click on a link to validate they got your email.

However, there are some cases where you really need to protect from human error. In my specific scenario, if the user enters an incorrect email, they could send hundreds of dollars to the wrong person. Or think that they paid their bill on time, but find out too late that they made a typo in the email address.

When doing email validation, you should weigh the costs of getting it wrong. If your validation is over-ambitiously validating an email address, that could lead to some serious frustration on the part of the end user and they may not subscribe to your newsletter (for example), so you may as well make validation as loose as possible (don't use this). However, if you have a scenario like mine where a typo can lead to serious mistakes, then a more ambitious validation solution is probably good.

This solution

This is a direct copy/paste from the Angular 1 code here. It's not perfect, but it does a pretty good job of validating 99% of use cases. And it's definitely been battle tested across hundreds of thousands of Angular applications throughout the world.

Installation

This module is distributed via npm which is bundled with node and should be installed as one of your project's dependencies:

npm install --save is-email-maybe

You can also get it from npmcdn.com: https://npmcdn.com/is-email-maybe

Usage

const isEmailMaybe = require('is-email-maybe')
isEmailMaybe('[email protected]') // true
isEmailMaybe('a@@b.c') // false
isEmailMaybe.regex.test('[email protected]') // true

Other Solutions

Contributors

Thanks goes to these people (emoji key):

| Kent C. Dodds💻 📖 🚇 ⚠️ | | :---: |

This project follows the all-contributors specification. Contributions of any kind welcome!

LICENSE

MIT