https://github.com/wefixers/disposable-email
Check if an email is from a disposable domain
https://github.com/wefixers/disposable-email
Last synced: 3 months ago
JSON representation
Check if an email is from a disposable domain
- Host: GitHub
- URL: https://github.com/wefixers/disposable-email
- Owner: wefixers
- License: mit
- Created: 2023-07-28T20:08:08.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-28T20:17:00.000Z (almost 2 years ago)
- Last Synced: 2025-02-26T23:16:54.517Z (4 months ago)
- Language: TypeScript
- Homepage:
- Size: 44.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Disposable Email
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![License][license-src]][license-href]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.
- [✨ Release Notes](/CHANGELOG.md)
- [Install](#install)
- [Usage](#usage)
- [Bulk Validation](#bulk-validation)## Install
```sh
pnpm i @fixers/disposable-email
``````sh
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:
```ts
import { isDisposable } from '@fixers/disposable-email'// check an email
if (isDisposable('[email protected]')) {
//
}// 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:
```ts
import { createDisposableFactory } from '@fixers/disposable-email'// hold a reference to a Set
const isDisposable = createDisposableFactory()// no memory allocation
isDisposable('[email protected]')// no memory allocation
isDisposable('[email protected]')
```[npm-version-src]: https://img.shields.io/npm/v/@fixers/disposable-email/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
[npm-version-href]: https://npmjs.com/package/@fixers/disposable-email[npm-downloads-src]: https://img.shields.io/npm/dm/@fixers/disposable-email.svg?style=flat&colorA=18181B&colorB=28CF8D
[npm-downloads-href]: https://npmjs.com/package/@fixers/disposable-email[license-src]: https://img.shields.io/npm/l/@fixers/disposable-email.svg?style=flat&colorA=18181B&colorB=28CF8D
[license-href]: https://npmjs.com/package/@fixers/disposable-email