ZooTools / email-spell-checker

📮 An ultratiny (1.9 KB) and fast JavaScript email checker to reduce users typing a wrong email. Written in TypeScript. Enterprise-grade.
https://zootools.co/tools/email-spell-checker
MIT License
164 stars 11 forks source link

An email was corrected while it shouldn't have #18

Open odedstr opened 1 year ago

odedstr commented 1 year ago

An email "example@actcom.net.il" was corrected to "example@actcomnet.it" even though I added "net.il" to the list of top level domains, and I added it before the default top level domains, so I think it shouldn't have been corrected.

Code:

let topLevelDomains = [...emailSpellChecker.POPULAR_TLDS, 'ir'];
const israel_tld = ['co.il', 'org.il', 'net.il', 'ac.il', 'gov.il', 'muni.il'];
topLevelDomains = [...israel_tld, ...topLevelDomains];

const suggestedEmail = emailSpellChecker.run({
        email: "example@actcom.net.il",
        secondLevelDomains: ['yahoo', 'hotmail', 'mail', 'live', 'outlook', 'walla', 'tau', '013', 'netvision',
            'bezeqint', '012', 'zahav', 'ccc'],
        topLevelDomains: topLevelDomains,
        domains: [...emailSpellChecker.POPULAR_DOMAINS, "yahoo.com"]
});

Environment: