1.0.1 โ€ข Published 12 months ago

@iocium/throwaway-lookup v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

@iocium/throwaway-lookup

A lightweight, cross-platform client for querying the throwaway.cloud API โ€” compatible with browsers, Node.js, and serverless platforms like Cloudflare Workers.


โœจ Features

  • โœ… Simple API: lookup(emailOrDomain)
  • ๐ŸŒ Works in Node.js, browsers, and Cloudflare Workers
  • ๐Ÿง  Automatically sets a compliant User-Agent
  • ๐Ÿ”’ Lets you add custom headers (except User-Agent, which is enforced)
  • ๐Ÿšซ Detects disposable email addresses and domains
  • โœ… Written in TypeScript with full typings
  • ๐Ÿงช 100% test coverage with jest

๐Ÿš€ Installation

npm install @iocium/throwaway-lookup

๐Ÿง‘โ€๐Ÿ’ป Usage

import { lookup } from '@iocium/throwaway-lookup';

const result = await lookup('mailinator.com');

if (result.success && result.isDisposable) {
  console.log('Disposable detected!');
} else {
  console.log('Safe to use.');
}

๐Ÿ”ง API

lookup(subject: string, options?: LookupOptions): Promise<LookupResult>

ParameterTypeDescription
subjectstringAn email address or domain name to query
optionsLookupOptionsOptional object to supply custom headers (except User-Agent)

LookupOptions

interface LookupOptions {
  headers?: Record<string, string>; // Custom headers
}

LookupResult

interface LookupResult {
  success: boolean;
  isDisposable?: boolean;
  [key: string]: any; // May include additional fields
}

๐Ÿงช Testing

npm test

Includes a full test suite with coverage reports for:

  • Success paths
  • Disposable detection
  • Invalid input
  • API and network failures

๐Ÿ“˜ Documentation

Generate full docs using:

npm run docs

Output is placed in the docs/ directory and includes all exported types and functions.


๐Ÿ“œ License

MIT

1.0.1

12 months ago