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 🙏

© 2026 – Pkg Stats / Ryan Hefner

email-guard

v1.0.0

Published

Email validation with syntax check, MX lookup and typo suggestions. No external dependencies.

Readme

email-guard

Email validation with syntax check, MX lookup and typo suggestions. Zero external dependencies.

npm version license

Features

  • Syntax validation – checks for valid email format
  • 🔍 MX record lookup – verifies the domain can receive emails
  • 💡 Typo suggestions – detects common misspellings (gmial.comgmail.com)
  • 🌍 Extended domain list – includes CZ, SK, DE and other European domains
  • 0️⃣ Zero dependencies – uses Node.js built-in dns module
  • 🔷 TypeScript first – full type definitions included

Install

npm install email-guard

Usage

import { validate } from 'email-guard'

const result = await validate('[email protected]')

// {
//   valid: false,
//   reason: 'mx',
//   suggestion: '[email protected]',
//   validators: {
//     regex: { valid: true },
//     typo:  { valid: true, suggestion: '[email protected]' },
//     mx:    { valid: false, reason: 'MX record not found.' }
//   }
// }

Options

const result = await validate('[email protected]', {
  validateRegex: true,   // default: true
  validateTypo: true,    // default: true
  validateMx: true,      // default: true
  dnsServers: ['8.8.8.8', '1.1.1.1'],  // default
})

Result

import { SyntaxError, TypoError, MxError } from 'email-guard'

interface EmailGuardResult {
    valid: boolean
    reason?: 'regex' | 'typo' | 'mx'          // which validator failed
    suggestion?: string                       // suggested correction
    validators: {
        regex: { valid: boolean; reason?: SyntaxError }
        typo:  { valid: boolean; reason?: TypoError; suggestion?: string }
        mx:    { valid: boolean; reason?: MxError }
    }
}

Error codes

enum SyntaxError {
  Empty        = 'EMAIL_EMPTY',
  MissingAt    = 'EMAIL_MISSING_AT',
  MultipleAt   = 'EMAIL_MULTIPLE_AT',
  MissingLocal = 'EMAIL_MISSING_LOCAL',
  MissingDomain= 'EMAIL_MISSING_DOMAIN',
  MissingTld   = 'EMAIL_MISSING_TLD',
  InvalidChars = 'EMAIL_INVALID_CHARS',
}

enum TypoError {
  TypoDetected = 'TYPO_DETECTED',
}

enum MxError {
  NotFound = 'MX_NOT_FOUND',
}

Examples

// Valid email
await validate('[email protected]')
// { valid: true, validators: { regex: { valid: true }, typo: { valid: true }, mx: { valid: true } } }

// Typo in domain
await validate('[email protected]')
// { valid: false, reason: 'mx', suggestion: '[email protected]', ... }

// TLD typo
await validate('[email protected]')
// { valid: false, reason: 'mx', suggestion: '[email protected]', ... }

// Invalid syntax
await validate('notanemail')
// { valid: false, reason: 'regex', validators: { regex: { valid: false, reason: 'EMAIL_MISSING_AT' } } }

// Skip MX check
await validate('[email protected]', { validateMx: false })
// { valid: true, ... }

// Switch on error codes
import { validate, SyntaxError } from 'email-guard'

const result = await validate(email)
if (result.reason === 'regex') {
    switch (result.validators.regex.reason) {
        case SyntaxError.Empty:      return 'Please enter an email.'
        case SyntaxError.MissingAt:  return 'Email must contain @.'
        case SyntaxError.MissingTld: return 'Domain is missing.'
    }
}

Supported domains for typo detection

Global: gmail.com, yahoo.com, hotmail.com, outlook.com, icloud.com, protonmail.com, proton.me and more.

European: seznam.cz, email.cz, centrum.cz (CZ), zoznam.sk, azet.sk, atlas.sk (SK), web.de, gmx.de (DE/AT).

Want to add more domains? Open a PR.

Node.js requirement

Node.js >= 18.0.0

License

MIT