educhk 2026.2.8 → 2026.2.10

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 ADDED
@@ -0,0 +1,45 @@
1
+ # educhk
2
+
3
+ Lightweight academic domain checker for edge workers. O(1) lookups across 25,000+ educational institution domains sourced from [JetBrains Swot](https://github.com/JetBrains/swot).
4
+
5
+ Zero dependencies. Works in Node.js, Cloudflare Workers, Deno, Bun, and browsers.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install educhk
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```js
16
+ import { isAcademic, isAbused } from 'educhk';
17
+
18
+ isAcademic('stanford.edu'); // true
19
+ isAcademic('cs.stanford.edu'); // true (walks up subdomains)
20
+ isAcademic('gmail.com'); // false
21
+ isAcademic('alumni.stanford.edu'); // false (stoplist excluded)
22
+
23
+ isAbused('gmail.com'); // true
24
+ isAbused('stanford.edu'); // false
25
+ ```
26
+
27
+ ## API
28
+
29
+ | Export | Description |
30
+ |---|---|
31
+ | `isAcademic(domain)` | `true` if the domain is a known academic institution. Automatically excludes stoplist domains (e.g. alumni emails). Walks up subdomains. |
32
+ | `isAbused(domain)` | `true` if the domain is flagged as commonly abused for fake signups. |
33
+ | `academicDomains` | `ReadonlySet<string>` — 25k+ academic domains |
34
+ | `abusedDomains` | `ReadonlySet<string>` — abused domains |
35
+ | `stoplistDomains` | `ReadonlySet<string>` — stoplist domains |
36
+
37
+ ## How it works
38
+
39
+ Three flat JSON arrays are loaded into `Set` objects at import time for O(1) lookups. `isAcademic` walks up subdomains — `cs.stanford.edu` checks `cs.stanford.edu`, then `stanford.edu`, then `edu` — and excludes stoplist entries.
40
+
41
+ Data is synced daily from [JetBrains Swot](https://github.com/JetBrains/swot) via GitHub Actions.
42
+
43
+ ## License
44
+
45
+ MIT