@fixers/disposable-email
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

Disposable Email

npm version npm downloads License

Check if an email is from a disposable domain, pretty self-explanatory.

Explicit memory usage, no global constants!

This library to not uses global constants, memory is allocated only when you invoke the function.

Install

pnpm i @fixers/disposable-email
npm install @fixers/disposable-email

Usage

Note: each time you invoke this function, a new Set containing all the disposable domains is created.

To check if an email is from a disposable domain:

import { isDisposable } from '@fixers/disposable-email'

// check an email
if (isDisposable('bad@disposable-domain.com')) {
  //
}

// check a domain
if (isDisposable('disposable-domain.com')) {
  //
}

Bulk Validation

If you need to check a large volume of emails, you might want to allocate memory only once, create a factory function:

import { createDisposableFactory } from '@fixers/disposable-email'

// hold a reference to a Set
const isDisposable = createDisposableFactory()

// no memory allocation
isDisposable('bad@disposable-domain.com')

// no memory allocation
isDisposable('other@disposable-domain.com')

Readme

Keywords

Package Sidebar

Install

npm i @fixers/disposable-email

Weekly Downloads

1

Version

0.0.1

License

MIT

Unpacked Size

5.91 MB

Total Files

6

Last publish

Collaborators

  • lucacicada