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 🙏

© 2025 – Pkg Stats / Ryan Hefner

stopreg-email-blocker

v0.1.0

Published

Lightweight StopReg API client for Node.js/TypeScript

Readme

StopReg Email Blocker (Node/TypeScript)

Lightweight client for the StopReg email validation API. Fetches isDisposable for an email, with sensible defaults for retries, timeouts, and caching. Built for server-side usage only (keep your API token secret).

Install

npm install stopreg-email-blocker

Requires Node.js 18+ (for built-in fetch).

Quick start

import { StopregClient } from 'stopreg-email-blocker';

const client = new StopregClient({
  apiToken: process.env.STOPREG_API_TOKEN,
  whitelistDomains: ['mycompany.com'] // optional shortcut: never disposable
});

const result = await client.check('[email protected]');

if (result.isDisposable) {
  // block signup or ask for a different email
} else {
  // proceed
}

Or a simple boolean helper:

const isDisposable = await client.isDisposable('[email protected]');

API

new StopregClient(options)

Options:

  • apiToken (string, required unless STOPREG_API_TOKEN env is set)
  • baseUrl (string, default https://api.stopreg.com)
  • timeoutMs (number, default 10000)
  • retry ({retries, factor, minTimeoutMs, maxTimeoutMs}) for 429/5xx/network
  • headers (record) extra headers
  • userAgent (string) to set User-Agent
  • fetch (function) custom fetch for tests/older runtimes
  • cache ({enabled, ttlMs, maxSize}, defaults to enabled, 5m TTL)
  • whitelistDomains (string[]) domains that short-circuit as non-disposable

check(email: string)

Returns { email, domain, isDisposable, raw }. Throws on HTTP errors with typed errors:

  • StopregBadRequestError (400)
  • StopregAuthError (401 or missing token)
  • StopregRateLimitError (429)
  • StopregServerError (>=500)
  • StopregError (network/parse/other)

isDisposable(email: string)

Returns a boolean convenience wrapper over check.

Publishing to npmjs.com

  1. Ensure you are logged in: npm login
  2. Build the package: npm run build
  3. Publish: npm publish

If you change the package name, update package.json accordingly. The published tarball includes dist/ via the files entry.

CLI / Integration tests

No CLI included. Add your own tiny wrapper if needed. Integration tests can be added easily by invoking check with a real token (STOPREG_API_TOKEN).

Development

npm install
npm test    # unit tests (vitest)
npm run build

Implementation notes

  • Uses built-in fetch; supply options.fetch if your runtime lacks it.
  • Retries only for 429/5xx and network failures, with exponential backoff.
  • Simple domain-level in-memory cache to reduce repeat lookups.
  • Whitelist short-circuits before any network call.

Security

  • Never expose your API token in client-side code.
  • Store tokens in env vars or a secret manager.
  • Rotate tokens if leaked.