fakeout 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,51 +1,197 @@
1
+ <div align="center">
2
+
1
3
  # fakeout
2
4
 
3
- [![npm version](https://img.shields.io/npm/v/fakeout.svg)](https://www.npmjs.com/package/fakeout)
4
- [![license](https://img.shields.io/npm/l/fakeout.svg)](./LICENSE)
5
+ **Catch disposable emails before they catch you.**
6
+
7
+ [![npm version](https://img.shields.io/npm/v/fakeout?color=cb3837&label=npm&logo=npm)](https://www.npmjs.com/package/fakeout)
8
+ [![bundle size](https://img.shields.io/bundlephobia/minzip/fakeout?color=364fc7&label=size)](https://bundlephobia.com/package/fakeout)
9
+ [![license](https://img.shields.io/github/license/Manas1820/fakeout?color=22863a)](./LICENSE)
10
+ [![CI](https://img.shields.io/github/actions/workflow/status/Manas1820/fakeout/release.yml?label=CI&logo=github)](https://github.com/Manas1820/fakeout/actions)
11
+
12
+ A tiny, zero-dependency library that detects disposable (burner) email domains.
13
+ The blocklist auto-updates daily — no manual maintenance required.
14
+
15
+ [Install](#install) · [Usage](#usage) · [API](#api) · [Staying up to date](#staying-up-to-date) · [How it works](#how-it-works)
16
+
17
+ </div>
18
+
19
+ ---
5
20
 
6
- Detect disposable (burner) email domains. Zero dependencies, auto-updated dataset.
21
+ ## Why?
22
+
23
+ Disposable email services like Mailinator, Guerrilla Mail, and thousands of others let users sign up with throwaway addresses. This means fake accounts, abused trials, and wasted resources. **fakeout** lets you detect them with a single function call.
24
+
25
+ - **5,000+ domains** tracked and growing
26
+ - **Zero dependencies** — just a `Set` lookup
27
+ - **Auto-updated** — new domains added daily via CI
28
+ - **TypeScript-first** — full type safety and JSDoc
7
29
 
8
30
  ## Install
9
31
 
10
32
  ```bash
33
+ # npm
11
34
  npm install fakeout
35
+
36
+ # pnpm
37
+ pnpm add fakeout
38
+
39
+ # yarn
40
+ yarn add fakeout
12
41
  ```
13
42
 
43
+ > Requires Node.js 18+
44
+
14
45
  ## Usage
15
46
 
16
47
  ```ts
17
48
  import { isDisposableEmail, isDisposableDomain, getDisposableDomains } from "fakeout";
18
49
 
19
- isDisposableEmail("user@mailinator.com"); // true
20
- isDisposableEmail("user@gmail.com"); // false
21
- isDisposableEmail("not-an-email"); // false
50
+ // Check a full email address
51
+ isDisposableEmail("user@mailinator.com"); // true
52
+ isDisposableEmail("user@gmail.com"); // false
53
+ isDisposableEmail("not-an-email"); // false (invalid → false)
22
54
 
23
- isDisposableDomain("guerrillamail.com"); // true
24
- isDisposableDomain("outlook.com"); // false
55
+ // Check a bare domain
56
+ isDisposableDomain("guerrillamail.com"); // true
57
+ isDisposableDomain("outlook.com"); // false
25
58
 
26
- const domains = getDisposableDomains(); // string[] sorted, ~5000+ entries
59
+ // Get the full list
60
+ const domains = getDisposableDomains(); // string[] — sorted, ~5000+ entries
61
+ ```
62
+
63
+ ### Common patterns
64
+
65
+ **Express middleware:**
66
+
67
+ ```ts
68
+ import { isDisposableEmail } from "fakeout";
69
+
70
+ app.post("/signup", (req, res) => {
71
+ if (isDisposableEmail(req.body.email)) {
72
+ return res.status(422).json({ error: "Disposable emails are not allowed" });
73
+ }
74
+ // proceed with signup...
75
+ });
76
+ ```
77
+
78
+ **Form validation:**
79
+
80
+ ```ts
81
+ import { isDisposableEmail } from "fakeout";
82
+
83
+ function validateEmail(email: string): string | null {
84
+ if (isDisposableEmail(email)) {
85
+ return "Please use a permanent email address";
86
+ }
87
+ return null;
88
+ }
27
89
  ```
28
90
 
29
91
  ## API
30
92
 
31
93
  ### `isDisposableEmail(email: string): boolean`
32
94
 
33
- Returns `true` if the email's domain is a known disposable email provider. Returns `false` for invalid emails.
95
+ Checks if an email address belongs to a known disposable provider.
96
+
97
+ | Input | Output |
98
+ |-------|--------|
99
+ | `"user@mailinator.com"` | `true` |
100
+ | `"user@gmail.com"` | `false` |
101
+ | `"bad-input"` | `false` |
102
+
103
+ Returns `false` for invalid emails rather than throwing.
34
104
 
35
105
  ### `isDisposableDomain(domain: string): boolean`
36
106
 
37
- Returns `true` if the bare domain is in the disposable blocklist. Handles uppercase and whitespace.
107
+ Checks if a bare domain is in the blocklist. Handles uppercase and extra whitespace.
108
+
109
+ | Input | Output |
110
+ |-------|--------|
111
+ | `"guerrillamail.com"` | `true` |
112
+ | `" YOPMAIL.COM "` | `true` |
113
+ | `"gmail.com"` | `false` |
38
114
 
39
115
  ### `getDisposableDomains(): string[]`
40
116
 
41
- Returns a sorted array of all known disposable domains. Each call returns a new copy.
117
+ Returns a sorted array of all known disposable domains. Each call returns a fresh copy, so mutations won't affect the internal dataset.
118
+
119
+ ## Staying up to date
120
+
121
+ Domain updates are published as **patch** releases (e.g. `1.0.1` → `1.0.2`), so the default npm semver range already keeps you current:
122
+
123
+ ```bash
124
+ npm install fakeout # saves "^1.x.x" — automatically resolves to the latest patch
125
+ ```
126
+
127
+ Every `npm install` (or `pnpm install` / `yarn install`) in a fresh CI environment or after deleting your lockfile will pull the newest patch. To update an existing lockfile:
128
+
129
+ ```bash
130
+ npm update fakeout
131
+ ```
132
+
133
+ ### Automated dependency updates
134
+
135
+ For hands-free updates, add [Renovate](https://github.com/renovatebot/renovate) or [Dependabot](https://docs.github.com/en/code-security/dependabot) to your repo. They'll open PRs whenever a new fakeout version is published.
136
+
137
+ <details>
138
+ <summary>Example Dependabot config</summary>
139
+
140
+ ```yaml
141
+ # .github/dependabot.yml
142
+ version: 2
143
+ updates:
144
+ - package-ecosystem: npm
145
+ directory: "/"
146
+ schedule:
147
+ interval: daily
148
+ ```
149
+
150
+ </details>
42
151
 
43
152
  ## How it works
44
153
 
45
- The domain dataset is sourced from [disposable-email-domains](https://github.com/disposable-email-domains/disposable-email-domains) and compiled into a `Set<string>` at build time — no file I/O at runtime.
154
+ ```
155
+ ┌─────────────────────────┐
156
+ │ Upstream blocklist │
157
+ │ (disposable-email- │
158
+ │ domains/disposable- │
159
+ │ email-domains) │
160
+ └────────────┬────────────┘
161
+ │ daily cron
162
+
163
+ ┌─────────────────────────┐
164
+ │ sync-domains script │
165
+ │ fetch → clean → hash │
166
+ │ → compare → generate │
167
+ └────────────┬────────────┘
168
+ │ if changed
169
+
170
+ ┌─────────────────────────┐
171
+ │ semantic-release │
172
+ │ patch bump → publish │
173
+ │ to npm │
174
+ └─────────────────────────┘
175
+ ```
176
+
177
+ 1. A GitHub Actions cron job runs daily
178
+ 2. It fetches the latest domain list from upstream
179
+ 3. If the list changed (SHA-256 comparison), tests run and a new **patch version** is auto-published to npm
180
+ 4. If nothing changed, the job exits silently
181
+
182
+ The domain list is compiled into a `ReadonlySet<string>` at build time — **zero file I/O at runtime**, just a fast hash lookup.
183
+
184
+ ## Credits
185
+
186
+ The disposable domain dataset is sourced from the community-maintained [disposable-email-domains](https://github.com/disposable-email-domains/disposable-email-domains) project. Huge thanks to all its contributors for keeping the list comprehensive and up to date.
187
+
188
+ ## Contributing
189
+
190
+ Contributions are welcome! If you find a domain that should be blocked:
46
191
 
47
- A GitHub Actions cron job syncs the upstream list daily. When domains change, tests run automatically and a new patch version is published to npm via [semantic-release](https://github.com/semantic-release/semantic-release).
192
+ - For **new disposable domains**, please submit them upstream to [disposable-email-domains](https://github.com/disposable-email-domains/disposable-email-domains/issues) — they'll be picked up automatically on the next sync
193
+ - For **bugs or feature requests** in fakeout itself, [open an issue](https://github.com/Manas1820/fakeout/issues)
48
194
 
49
195
  ## License
50
196
 
51
- MIT
197
+ [MIT](./LICENSE) — use it however you like.
@@ -1 +1 @@
1
- {"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../src/domains.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAmlKjD,CAAC"}
1
+ {"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../src/domains.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAkuKjD,CAAC"}