@zootools/email-spell-checker
Advanced tools
Comparing version 1.4.0 to 1.5.0
@@ -0,5 +1,6 @@ | ||
import run from './lib/run'; | ||
declare const MailSpellChecker: { | ||
run: any; | ||
run: typeof run; | ||
POPULAR_DOMAINS: string[]; | ||
}; | ||
export default MailSpellChecker; |
@@ -6,8 +6,8 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const check_mail_1 = __importDefault(require("./lib/check-mail")); | ||
const run_1 = __importDefault(require("./lib/run")); | ||
const config_1 = require("./lib/config"); | ||
const MailSpellChecker = { | ||
run: check_mail_1.default, | ||
run: run_1.default, | ||
POPULAR_DOMAINS: config_1.POPULAR_DOMAINS, | ||
}; | ||
exports.default = MailSpellChecker; |
@@ -1,2 +0,2 @@ | ||
import sift3Distance from '../helpers/sift3Distance'; | ||
import sift3Distance from '../fuzzy-detection/sift3-distance'; | ||
/*** | ||
@@ -3,0 +3,0 @@ * Default list of popular emails for 2022 and onwards. |
@@ -8,3 +8,3 @@ "use strict"; | ||
exports.POPULAR_TLDS = exports.POPULAR_DOMAINS = exports.DEFAULT_CONFIG = void 0; | ||
const sift3Distance_1 = __importDefault(require("../helpers/sift3Distance")); | ||
const sift3_distance_1 = __importDefault(require("../fuzzy-detection/sift3-distance")); | ||
/*** | ||
@@ -140,4 +140,4 @@ * Default list of popular emails for 2022 and onwards. | ||
topLevelDomains: POPULAR_TLDS, | ||
distanceFunction: sift3Distance_1.default, | ||
distanceFunction: sift3_distance_1.default, | ||
}; | ||
exports.DEFAULT_CONFIG = DEFAULT_CONFIG; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const asser_valid_user_options_1 = __importDefault(require("./helpers/asser-valid-user-options")); | ||
const assert_valid_user_options_1 = __importDefault(require("./helpers/assert-valid-user-options")); | ||
const suggest_email_1 = __importDefault(require("./suggest-email")); | ||
@@ -12,3 +12,3 @@ const get_options_1 = __importDefault(require("./helpers/get-options")); | ||
const options = get_options_1.default(userOptions); | ||
asser_valid_user_options_1.default(options || {}); | ||
assert_valid_user_options_1.default(options || {}); | ||
const email = suggest_email_1.default(options); | ||
@@ -15,0 +15,0 @@ if (!email && userOptions.empty) { |
{ | ||
"private": false, | ||
"name": "@zootools/email-spell-checker", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "mailSpellChecker.js (mail spell checker) is a lightweight module that suggests a right domain when your users misspell it in an email address", | ||
@@ -6,0 +6,0 @@ "main": "./dist/index.js", |
@@ -12,3 +12,3 @@ <p align="center"> | ||
<p align="center"> | ||
<b>Email Spell Checker</b> is the <strong>easiest way to reduce misspelled email addresses in your web apps and server</strong>. Used in production by companies to validate thousands of mispelled emails daily. | ||
<b>Email Spell Checker</b> is the <strong>easiest way to reduce misspelled email addresses in your web apps and server</strong>. Used in production daily by top companies to validate thousands of mispelled emails. | ||
</p> | ||
@@ -28,4 +28,2 @@ </a> | ||
[![Commitizen Friendly][commitizen-img]][commitizen-url] | ||
[![Downloads][downloads-img]][downloads-url] | ||
[![Semantic Release][semantic-release-img]][semantic-release-url] | ||
@@ -56,5 +54,12 @@ <b>Email Spell Checker</b> is a lightweight JavaScript module written in TypeScript that suggests a right domain when your users misspell it in an email address. | ||
- [⚛️ React example: Validating email spell in React](./docs/React.md) | ||
- [✅ Node example: Validating email spell in Node](./docs/Node.md) | ||
Adding Email Spell Checker to your project takes you less than 5 minutes. | ||
It works on any JavaScript framework (Vue, React, Next.JS, Angular, Svelte, etc) as well as the your backend server. | ||
Here some highly-requested tutorials. If you want to write a tutorial [send a PR](https://github.com/zootools/email-spell-checker/pulls) or [create an issue](https://github.com/zootools/email-spell-checker/issues) if you want to ask for one: | ||
- JavaScript (Continue reading this README.md) | ||
- [⚛️ React: Validating email spell in React](./docs/React.md) | ||
- [✅ Node: Validating email spell in Node](./docs/Node.md) | ||
### Installation | ||
@@ -76,4 +81,8 @@ | ||
**Email Spell Checker** works with any JavaScript framework: Vue, React, Next.JS, Angular, Svelte, etc. | ||
Using the library is really easy: | ||
* Import it. | ||
* Call `run` function with the email you want to validate. | ||
* Get the suggested email, and prompt your user to accept suggestion. | ||
```js | ||
@@ -99,33 +108,48 @@ import emailSpellChecker from '@zootools/email-spell-checker'; | ||
### Advanced example (extending defaults) | ||
Extending Domains | ||
------- | ||
If you are looking for example codes with React and Node.js, check this links: | ||
EmailSpellChecker has inbuilt defaults if the `domains`, `secondLevelDomains` or `topLevelDomains` options aren't provided. | ||
- [⚛️ React example: Validating email spell in React](./docs/React.md) | ||
- [✅ Node example: Validating email spell in Node](./docs/Node.md) | ||
The out-of-the-box configuration is the best for 99% of cases. If you are that 1%, here is how you can extend the configuration :). | ||
#### Adding your own Domains #### | ||
You can replace EmailSpellChecker's default domain/TLD suggestions by supplying replacements to `EmailSpellChecker.run`: | ||
```js | ||
import emailSpellChecker from '@zootools/email-spell-checker'; | ||
// Extend any of these properties with your custom lists | ||
// Note: Default configuration is really solid. | ||
// It's very rare you really want to do this. | ||
const suggestedEmail = emailSpellChecker.run({ | ||
email: 'jorge@gmaik.co', | ||
domains: [ | ||
...emailSpellChecker.POPULAR_DOMAINS, | ||
'customdomain.com' | ||
], | ||
topLevelDomains: ['com', 'org', 'xyz'], | ||
emailSpellChecker.run({ | ||
domains: [...emailSpellChecker.POPULAR_DOMAINS, 'customdomain.com'], // replaces existing domains | ||
secondLevelDomains: ['domain', 'yetanotherdomain'], // replaces existing SLDs | ||
topLevelDomains: ['com.au', 'ru'] // replaces existing TLDs | ||
}); | ||
``` | ||
## How does it work? | ||
Tests | ||
----- | ||
TODO: Put screenshot of it in action | ||
EmailSpellChecker is tested with [Jest](https://jestjs.io/), a popular JavaScript testing framework from Facebook with a focus on simplicity. | ||
## Companies using this library in production | ||
Run `npm test` from the command line to run the test suite. | ||
We're collecting a list of companies | ||
Who uses EmailSpellChecker? | ||
----------------------- | ||
We're putting together a list of happy users of EmailSpellChecker. | ||
Tweet [@ZooToolsHQ](https://twitter.com/ZooToolsHQ) and [@JGFerreiro](https://twitter.com/JGFerreiro) if you are interested to appear. | ||
Customer support & updates | ||
----------------------- | ||
* 🎯 Major updates: [Join our mailing lists to get useful information](https://form.waitlistpanda.com/go/8H98mVOzZhwGMalf8nfb) about this and other useful open source libraries: https://form.waitlistpanda.com/go/8H98mVOzZhwGMalf8nfb | ||
* 📆 Updates: Click "Watch repo" on Github and ⭐️ the repo to get useful information. | ||
* 🤝 Do you have bugs or issues? Email [github@zootools.co](github@zootools.co) and create an [create an issue](https://github.com/zootools/email-spell-checker/issues) | ||
Socials: | ||
* [@ZooToolsHQ](https://twitter.com/ZooToolsHQ) | ||
* [@EmailSpellChecker](https://twitter.com/EmailSpellChecker) | ||
* [@JGFerreiro](https://twitter.com/JGFerreiro) | ||
## Maintainers | ||
@@ -139,9 +163,9 @@ | ||
[downloads-img]: https://img.shields.io/npm/dt/@zootools/email-spell-checker | ||
[downloads-img]: https://img.shields.io/npm/dt/@zootools/email-spell-checker?labelColor=475873&color=6ead0a | ||
[downloads-url]: https://www.npmtrends.com/@zootools/email-spell-checker | ||
[npm-img]: https://img.shields.io/npm/v/@zootools/email-spell-checker | ||
[npm-img]: https://img.shields.io/npm/v/@zootools/email-spell-checker?labelColor=475873&color=6ead0a | ||
[npm-url]: https://www.npmjs.com/package/@zootools/email-spell-checker | ||
[bundlephobia-img]: https://badgen.net/bundlephobia/minzip/@zootools/email-spell-checker | ||
[bundlephobia-url]: https://badgen.net/bundlephobia/minzip/@zootools/email-spell-checker | ||
[issues-img]: https://img.shields.io/github/issues/zootools/email-spell-checker | ||
[bundlephobia-img]: https://badgen.net/bundlephobia/minzip/@zootools/email-spell-checker?labelColor=475873&color=6ead0a | ||
[bundlephobia-url]: https://bundlephobia.com/package/@zootools/email-spell-checker | ||
[issues-img]: https://img.shields.io/github/issues/zootools/email-spell-checker?labelColor=475873&color=6ead0a | ||
[issues-url]: https://github.com/zootools/email-spell-checker/issues | ||
@@ -148,0 +172,0 @@ [codecov-img]: https://codecov.io/gh/zootools/@zootools/email-spell-checker/branch/main/graph/badge.svg |
31871
33
601
172