email-misspelled
Advanced tools
Comparing version 2.0.1 to 2.0.2
{ | ||
"name": "email-misspelled", | ||
"description": "Check misspell email domain and return a matching domain suggestion", | ||
"description": "Check misspell email's domain and return a list of matching domain suggestions", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"dev": "webpack-dev-server --mode development --config webpack.dev.js", | ||
"demo": "yarn build:lib && webpack-dev-server --mode production --config webpack.prod.js", | ||
"test:ci": "yarn jest --config=./tests/jest.config.js", | ||
@@ -10,4 +12,2 @@ "test:watch": "yarn jest --config=./tests/jest.config.js --verbose --watchAll", | ||
"test:coverage:report": "codecov --token=$CODECOV_TOKEN", | ||
"dev": "webpack-dev-server --mode development --config webpack.dev.js", | ||
"demo": "yarn build:lib && webpack-dev-server --mode production --config webpack.prod.js", | ||
"build:all": "rimraf ./lib && yarn build:lib && yarn build:types", | ||
@@ -19,3 +19,5 @@ "build:lib": "webpack --config webpack.config.js", | ||
"files": [ | ||
"/lib" | ||
"/lib/index.js", | ||
"/lib/index.d.ts", | ||
"/lib/Result.interface.d.ts" | ||
], | ||
@@ -40,7 +42,8 @@ "repository": { | ||
"misspelled", | ||
"misspell", | ||
"misstype", | ||
"mailcheck", | ||
"validator", | ||
"checker", | ||
"autocorrect", | ||
"correct" | ||
"lightweight", | ||
"corrector" | ||
], | ||
@@ -71,3 +74,3 @@ "devDependencies": { | ||
}, | ||
"version": "2.0.1" | ||
"version": "2.0.2" | ||
} |
# email-misspelled | ||
**Lightweight 4ko lib** | ||
--- | ||
[](https://circleci.com/gh/Julien-Amblard/email-misspelled) | ||
@@ -9,4 +11,6 @@ [](https://codecov.io/gh/Julien-Amblard/email-misspelled) | ||
--- | ||
> Check misspell email's domain and return a list of matching domain suggestions | ||
String comparison is based on [this](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/string/levenshtein-distance) | ||
@@ -19,5 +23,5 @@ | ||
- [Options](#options) | ||
- [lengthDiffMax](#lengthDiffMax) | ||
- [maxMisspelled](#maxMisspelled) | ||
- [domainList](#domainList) | ||
- [lengthDiffMax](#lengthDiffMax) | ||
@@ -51,38 +55,4 @@ ## Install <a id="install"></a> | ||
### lengthDiffMax <a id="lengthDiffMax"></a> | ||
| Type | Default | Description | | ||
|:----|:----|:----| | ||
| `number` | `2` | max length difference between two string | | ||
```js | ||
import emailMisspelled from "email-misspelled" | ||
const emailChecker1 = emailMisspelled({ lengthDiffMax: 1 }) | ||
emailChecker1("user@otmail.com") | ||
/** | ||
* return : | ||
* [{ suggest: "hotmail.com", misspelledCount: 1, corrected:"user@hotmail.com"}] | ||
**/ | ||
emailChecker1("user@tmail.com") // undefined | ||
const emailChecker2 = emailMisspelled({ lengthDiffMax: 2 }) | ||
emailChecker2("user@otmail.com") | ||
/** | ||
* return : | ||
* [{ suggest: "hotmail.com", misspelledCount: 1, corrected:"user@hotmail.com"}] | ||
**/ | ||
emailChecker2("user@tmail.com") | ||
/** | ||
* return : | ||
* [ | ||
* { suggest: "gmail.com", misspelledCount: 1, corrected:"user@gmail.com"} | ||
* { suggest: "hotmail.com", misspelledCount: 2, corrected:"user@hotmail.com"}, | ||
* ] | ||
**/ | ||
``` | ||
--- | ||
### maxMisspelled <a id="maxMisspelled"></a> | ||
@@ -142,2 +112,39 @@ | ||
### lengthDiffMax <a id="lengthDiffMax"></a> | ||
| Type | Default | Description | | ||
|:----|:----|:----| | ||
| `number` | `2` | max length difference between two string | | ||
```js | ||
import emailMisspelled from "email-misspelled" | ||
const emailChecker1 = emailMisspelled({ lengthDiffMax: 1 }) | ||
emailChecker1("user@otmail.com") | ||
/** | ||
* return : | ||
* [{ suggest: "hotmail.com", misspelledCount: 1, corrected:"user@hotmail.com"}] | ||
**/ | ||
emailChecker1("user@tmail.com") // undefined | ||
const emailChecker2 = emailMisspelled({ lengthDiffMax: 2 }) | ||
emailChecker2("user@otmail.com") | ||
/** | ||
* return : | ||
* [{ suggest: "hotmail.com", misspelledCount: 1, corrected:"user@hotmail.com"}] | ||
**/ | ||
emailChecker2("user@tmail.com") | ||
/** | ||
* return : | ||
* [ | ||
* { suggest: "gmail.com", misspelledCount: 1, corrected:"user@gmail.com"} | ||
* { suggest: "hotmail.com", misspelledCount: 2, corrected:"user@hotmail.com"}, | ||
* ] | ||
**/ | ||
``` | ||
--- | ||
### Default domain list <a id="domainListDefault"></a> | ||
@@ -144,0 +151,0 @@ |
257
13806
6
21