1.0.1 โข Published 12 months ago
@iocium/throwaway-lookup v1.0.1
@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>
| Parameter | Type | Description |
|---|---|---|
subject | string | An email address or domain name to query |
options | LookupOptions | Optional 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 testIncludes 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 docsOutput is placed in the docs/ directory and includes all exported types and functions.
๐ License
MIT
1.0.1
12 months ago