4.2.2 • Published 1 month ago

email-misspelled v4.2.2

Weekly downloads
1,948
License
MIT
Repository
github
Last release
1 month ago

npm CircleCI Status codecov npm npm npm

Lightweight < 3ko lib

Check the misspelled email's domain and return a list of matching domain suggestions sorted by corrections needed

The string comparison is based on this algorithm

live codepen demo

example

Table of Contents

  1. Install
  2. Usages
  3. Options

Install with npm:

    npm i email-misspelled

Install with yarn:

    yarn add email-misspelled

import emailMisspelled, { top100 } from "email-misspelled"

const emailChecker = emailMisspelled({ domains: top100 })

emailChecker("user@otmail.com")
/**
 * [{ 
 *      suggest: "hotmail.com", 
 *      misspelledCount: 1, 
 *      corrected:"user@hotmail.com", 
 *      original: "user@otmail.com"
 * }]
 **/

domains

TypeRequiredDescription
string[] DomainListtruelist of domains to compare
import emailMisspelled from "email-misspelled"
const emailChecker = emailMisspelled({ domains: ["random.org"] })

emailChecker("user@hotmial.com") // []
emailChecker("user@randmo.org")
/**
 * return :
 * [
 *   { 
 *      suggest: "random.org", 
 *      misspelledCount: 1, 
 *      corrected:"user@random.org", 
 *      original: "user@randmo.org"
 *   }
 * ]
 **/

List of domains avaibles :

More details here

examples

import { top100, hotmail, live } from "email-misspelled"  

Feel free to contribute


maxMisspelled

TypeRequiredDefaultDescription
numberfalse2max possible misspelled
import emailMisspelled, { top100 } from "email-misspelled"
const emailChecker1 = emailMisspelled({ maxMisspelled: 1, domains: top100 })

emailChecker1("user@hotmial.com")
/**
 * return :
 * [{ 
 *      suggest: "hotmail.com",  
 *      misspelledCount: 1,  
 *      corrected:"user@hotmail.com",  
 *      original: "user@hotmial.com"
 * }]
 **/
emailChecker1("user@hotmia.com") // []

const emailChecker2 = emailMisspelled({ maxMisspelled: 3, domains: top100 })

emailChecker2("user@hotmial.com")
/**
 * return :
 * [{  
 *      suggest: "hotmail.com",  
 *      misspelledCount: 2,  
 *      corrected:"user@hotmail.com",  
 *      original: "user@hotmial.com"  
 * }]
 **/
emailChecker2("user@hotmia.com")
/**
 * return :
 * [{  
 *      suggest: "hotmail.com",  
 *      misspelledCount: 3,  
 *      corrected:"user@hotmail.com",  
 *      original: "user@hotmia.com"  
 * }]
 **/
emailChecker2("user@otmia.com") //4 misspelled, return []

lengthDiffMax

TypeRequiredDefaultDescription
numberfalse3max length difference between two string
import emailMisspelled, { top100 } from "email-misspelled"
const emailChecker1 = emailMisspelled({ lengthDiffMax: 1, domains: top100 })

emailChecker1("user@otmail.com")
/**
 * return :
 * [{  
 *      suggest: "hotmail.com",
 *      misspelledCount: 1,
 *      corrected:"user@hotmail.com",
 *      original: "user@otmail.com"
 * }]
 **/
emailChecker1("user@tmail.com") // []

const emailChecker2 = emailMisspelled({ lengthDiffMax: 2, domains: top100 })

emailChecker2("user@otmail.com")
/**
 * return :
 * [{ 
 *      suggest: "hotmail.com",
 *      misspelledCount: 1,
 *      corrected:"user@hotmail.com",
 *      original: "user@otmail.com"
 * }]
 **/
emailChecker2("user@tmail.com")
/**
 * return :
 * [{
 *      suggest: "gmail.com",
 *      misspelledCount: 1,
 *      corrected:"user@gmail.com",
 *      original: "user@tmail.com"
 * },
 * {
 *      suggest: "hotmail.com",
 *      misspelledCount: 2,
 *      corrected:"user@hotmail.com",
 *      original: "user@tmail.com"
 * }]
 **/

Top 100 domains list

ordered by number of existing email

  • gmail.com
  • yahoo.com
  • hotmail.com
  • aol.com
  • hotmail.co.uk
  • hotmail.fr
  • msn.com
  • yahoo.fr
  • wanadoo.fr
  • orange.fr
  • comcast.net
  • yahoo.co.uk
  • yahoo.com.br
  • yahoo.co.in
  • live.com
  • rediffmail.com
  • free.fr
  • gmx.de
  • web.de
  • yandex.ru
  • ymail.com
  • libero.it
  • outlook.com
  • uol.com.br
  • bol.com.br
  • mail.ru
  • cox.net
  • hotmail.it
  • sbcglobal.net
  • sfr.fr
  • live.fr
  • verizon.net
  • live.co.uk
  • googlemail.com
  • yahoo.es
  • ig.com.br
  • live.nl
  • bigpond.com
  • terra.com.br
  • yahoo.it
  • neuf.fr
  • yahoo.de
  • alice.it
  • rocketmail.com
  • att.net
  • laposte.net
  • facebook.com
  • bellsouth.net
  • yahoo.in
  • hotmail.es
  • charter.net
  • yahoo.ca
  • yahoo.com.au
  • rambler.ru
  • hotmail.de
  • tiscali.it
  • shaw.ca
  • yahoo.co.jp
  • sky.com
  • earthlink.net
  • optonline.net
  • freenet.de
  • t-online.de
  • aliceadsl.fr
  • virgilio.it
  • home.nl
  • qq.com
  • telenet.be
  • me.com
  • yahoo.com.ar
  • tiscali.co.uk
  • yahoo.com.mx
  • voila.fr
  • gmx.net
  • mail.com
  • planet.nl
  • tin.it
  • live.it
  • ntlworld.com
  • arcor.de
  • yahoo.co.id
  • frontiernet.net
  • hetnet.nl
  • live.com.au
  • yahoo.com.sg
  • zonnet.nl
  • club-internet.fr
  • juno.com
  • optusnet.com.au
  • blueyonder.co.uk
  • bluewin.ch
  • skynet.be
  • sympatico.ca
  • windstream.net
  • mac.com
  • centurytel.net
  • chello.nl
  • live.ca
  • aim.com
  • bigpond.net.au

4.2.2

1 month ago

4.2.1

1 month ago

4.2.0

2 months ago

4.0.0-alpha.1

2 months ago

4.0.0-alpha.0

2 months ago

4.1.0

2 months ago

4.0.0

2 months ago

4.1.0-alpha.0

2 months ago

3.4.2

1 year ago

3.4.1

1 year ago

3.4.0

2 years ago

3.3.9

2 years ago

3.3.8

3 years ago

3.3.7

3 years ago

3.3.6

3 years ago

3.3.5

3 years ago

3.3.4

3 years ago

3.3.3

3 years ago

3.3.2-canary.1

3 years ago

3.3.2

3 years ago

3.3.2-canary.0

3 years ago

3.3.1

4 years ago

3.3.0

4 years ago

3.3.0-canary.1

4 years ago

3.3.0-canary.2

4 years ago

3.2.3

4 years ago

3.2.2

4 years ago

3.2.1

4 years ago

3.2.1-canary.0

4 years ago

3.2.0

4 years ago

3.1.0

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.1.5

4 years ago

2.1.4

4 years ago

2.1.2

4 years ago

2.1.3

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago