Skip to content

Commit a0288d9

Browse files
committed
Email Sentry npm packages used to validate, check disposable emails and normalize email to use in the production
0 parents  commit a0288d9

13 files changed

+6395
-0
lines changed

.github/workflows/test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Run Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: ⬇️ Checkout code
15+
uses: actions/checkout@v3
16+
17+
- name: ⚙️ Setup Node.js
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: 18
21+
22+
- name: 📦 Install dependencies
23+
run: npm install
24+
25+
- name: 🧪 Run tests
26+
run: npm run test

.gitignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Node modules
2+
node_modules/
3+
4+
# Build output
5+
dist/
6+
7+
# Test coverage
8+
coverage/
9+
10+
# Logs
11+
npm-debug.log*
12+
yarn-debug.log*
13+
yarn-error.log*
14+
15+
# OS-specific files
16+
.DS_Store
17+
Thumbs.db
18+
19+
# Env files (if used later)
20+
.env
21+
.env.*
22+
23+
# TypeScript cache
24+
*.tsbuildinfo
25+
26+
# IDE/editor files
27+
.vscode/
28+
.idea/
29+
30+
# GitHub workflow logs (optional)
31+
*.log

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# MIT License
2+
3+
Copyright (c) 2025 Yashraj Yadav
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# 📧 email-sentry
2+
3+
[![Author](https://img.shields.io/badge/Author-@ameghcoder-blue?logo=github)](https://github.com/ameghcoder)
4+
[![NPM version](https://img.shields.io/npm/v/email-sentry?color=blue&label=npm)](https://www.npmjs.com/package/email-sentry)
5+
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](./LICENSE)
6+
[![Tests](https://github.com/yourusername/email-sentry/actions/workflows/test.yml/badge.svg)](https://github.com/yourusername/email-sentry/actions/workflows/test.yml)
7+
8+
---
9+
10+
`email-sentry` is a lightweight and production-ready utility to:
11+
12+
- ✅ Validate email format
13+
- 🚫 Detect disposable/temp email domains
14+
- 📩 Normalize Gmail aliases (e.g. `user+promo@gmail.com``user@gmail.com`)
15+
16+
---
17+
18+
## ✨ Features
19+
20+
- ✅ Simple API
21+
- 📦 Tiny & dependency-light
22+
- 🛡️ Helps prevent spam/bots during user signups
23+
- 🔍 Supports thousands of disposable email providers
24+
- 🔧 Built in TypeScript (fully typed)
25+
26+
---
27+
28+
## 📦 Installation
29+
30+
```bash
31+
npm install email-sentry
32+
# or
33+
yarn add email-sentry
34+
```
35+
36+
---
37+
38+
## 🚀 Usage
39+
40+
```ts
41+
import { emailSentry } from "email-sentry";
42+
43+
const result = emailSentry("user+promo@mailinator.com", {
44+
validate: true,
45+
checkDisposable: true,
46+
normalizeGmailAliases: true,
47+
});
48+
49+
console.log(result);
50+
/*
51+
{
52+
inputEmail: 'user+promo@mailinator.com',
53+
success: true,
54+
isValid: true,
55+
isDisposable: true,
56+
outputEmail: 'user@gmail.com'
57+
}
58+
*/
59+
```
60+
61+
---
62+
63+
## ⚙️ Options
64+
65+
| Option | Type | Description |
66+
|------------------------|-----------|---------------------------------------------------|
67+
| `validate` | `boolean` | Validates email using the powerful email validator package |
68+
| `checkDisposable` | `boolean` | Checks against known disposable email domains, contains 5000+ disposable domains data |
69+
| `normalizeGmailAliases` | `boolean` | Removes `+something` from Gmail addresses and prevent the same email address to use to create account |
70+
71+
---
72+
73+
## 🧪 Testing
74+
75+
Run all tests with:
76+
77+
```bash
78+
npm test
79+
```
80+
81+
Or watch mode:
82+
83+
```bash
84+
npm run test:watch
85+
```
86+
87+
---
88+
89+
## 📄 License
90+
91+
MIT © [Yashraj](https://github.com/ameghcoder)
92+
93+
---
94+
95+
## 🙋‍♂️ Author
96+
97+
Made with ❤️ by [**Yashraj**](https://github.com/ameghcoder)
98+
99+
If you like this project, consider ⭐️ starring the repo or sharing it. It helps a lot!

0 commit comments

Comments
 (0)