disposable-domains 1.0.17 → 2.0.0

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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Ilya Volodarsky
4
+ Copyright (c) 2025 Thomas Petracco
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md CHANGED
@@ -1,46 +1,64 @@
1
1
  # Disposable Email Domains
2
2
 
3
+ A list of [disposable email domains](http://en.wikipedia.org/wiki/Disposable_email_address) (like `mailinator.com`) commonly used to create temporary accounts. Use this list to detect or block fake accounts during your signup process.
3
4
 
4
- A list of [disposable email domains](http://en.wikipedia.org/wiki/Disposable_email_address) like `mailinator.com`. You can use it to detect or block disposable accounts in your signup process. Exact domain matches are found in [index.json](https://github.com/tompec/disposable-email-domains/blob/main/index.json) and wildcard domains (ex: `*.33mail.com`) are in [wildcard.json](https://github.com/tompec/disposable-email-domains/blob/main/wildcard.json).
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install disposable-domains
9
+ ```
5
10
 
6
- ## Examples
11
+ ## Usage
12
+
13
+ This package exports an array of domains. You can check if an email domain exists in the list:
7
14
 
8
- ### Node.JS
9
15
  ```js
10
- var domains = require('disposable-domains');
11
- var wildcards = require('disposable-domains/wildcard.json');
16
+ const disposableDomains = require('disposable-domains');
17
+ const emailDomain = 'something.mailinator.com';
12
18
 
13
- // ... your code here
14
- ```
19
+ // Check if the exact domain OR the root domain is in the list
20
+ const isDisposable = disposableDomains.some(domain =>
21
+ emailDomain === domain || emailDomain.endsWith('.' + domain)
22
+ );
15
23
 
16
- ## Installation
17
-
18
- ```
19
- $ npm install disposable-domains
24
+ if (isDisposable) {
25
+ console.log('Blocked.');
26
+ }
20
27
  ```
21
28
 
29
+ ### How the list works
30
+
31
+ The entries in `index.json` should be treated as **domain suffixes**.
32
+
33
+ This means you should block the exact domain match **and** any subdomain to the left of it (a recursive wildcard match).
34
+
35
+ - **Matches:** `mailinator.com`
36
+ - **Also Matches:** `sub.mailinator.com`, `a.b.mailinator.com`
37
+
22
38
  ## Contributing
23
39
 
24
40
  1. Install dependencies:
25
- ```
41
+
42
+ ```bash
26
43
  npm install
27
44
  ```
28
45
 
29
- 2. Add your disposable domains to [contributions/index.txt](https://github.com/tompec/disposable-email-domains/blob/main/contributions/index.txt) (one domain per line, without any additional formatting)
46
+ 2. Add domains to [contributions/index.txt](https://github.com/tompec/disposable-email-domains/blob/main/contributions/index.txt):
47
+ - One domain per line
48
+ - No extra formatting
30
49
 
31
- 3. Run the [domain manager script](https://github.com/tompec/disposable-email-domains/blob/main/scripts/domain-manager.js):
32
- ```
50
+ 3. Build the list:
51
+
52
+ ```bash
33
53
  npm run process
34
54
  ```
35
- That script will:
36
- - Add your domains to index.json
37
- - Validate domains using the FQDN (Fully Qualified Domain Name) standard
38
- - Move domains to wildcard.json if they have 2 or more subdomains
39
- - Sort and deduplicate all entries
40
- - Run the tests to ensure everything is working correctly
55
+
56
+ This validates, sorts, and deduplicates your entries.
41
57
 
42
58
  ## License
43
59
 
60
+ MIT — see [LICENSE](LICENSE) for details.
61
+
44
62
  ```
45
63
  WWWWWW||WWWWWW
46
64
  W W W||W W W
@@ -53,11 +71,3 @@ WWWWWW||WWWWWW
53
71
  _||_|| _||_||
54
72
  (__|__|(__|__|
55
73
  ```
56
-
57
- THE SOFTWARE IS PROVIDED "AS IS" AND "AS AND WHEN AVAILABLE", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
58
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
59
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
60
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
61
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
62
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
63
- THE SOFTWARE.