diff --git a/index.js b/index.js index 065773c..01ce15a 100644 --- a/index.js +++ b/index.js @@ -44,6 +44,10 @@ class EmailValidation { type === 'blacklist' && result.errors.push(type) } else { let smallestDistance = result.domain.length + const match = /^(.+?)\.([^.]+)$/.exec(result.domain); + if (match) { + smallestDistance = match[1].length; + } for (const domain of popularDomains) { const distance = levenstein(domain, result.domain) if (distance > 0 && distance < maxDistance && distance < smallestDistance) {