Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global domains configuration #19

Open
faelsoto opened this issue Jan 11, 2023 · 1 comment
Open

Global domains configuration #19

faelsoto opened this issue Jan 11, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@faelsoto
Copy link

Current Behavior

From the documentation:

emailSpellChecker.run({
  domains: [...emailSpellChecker.POPULAR_DOMAINS, 'customdomain.com'], // replaces existing domains
  secondLevelDomains: ['domain', 'yetanotherdomain'], // replaces existing SLDs
  topLevelDomains: ['com.au', 'ru'], // replaces existing TLDs
});

Running this snippet throws an Uncaught TypeError: opts.email is undefined exception.

Expected Behavior

A snippet provided in the readme shouldn't fail. Also, the domains, second level domains and top level domains list gets updated globally?

Steps to Reproduce the Problem

  1. Run snippet provided by readme

Environment

  • Version: 1.11.0
  • Platform: Linux
  • Node.js Version: v16.13.1

We've been using mailcheck but as you already know, it is quite outdated. So I thank your for this project, it was way overdue. The thing that I'm wondering is if it would not be best to let the config be overwritten globally, just as Mailcheck used to do it. If that's not the original idea that's fine, but maybe the docs should reflect it by not including a snippet that won't work.

@faelsoto faelsoto added the bug Something isn't working label Jan 11, 2023
@ferreiro
Copy link
Contributor

ferreiro commented Mar 8, 2023

Hey @faelsoto! Glad you are enjoying using the package and sorry you had issues.

Just fixed the code snippet. We were just missing passing an email to the code snippet. Here is the fix: https://github.com/ZooTools/email-spell-checker/blob/main/README.md#adding-your-own-domains

I think overrides global makes sense in case you just want to have custom ones. You can simply import the constant file POPULAR_TLDS and append that to your custom list.

What is missing is that we don't expose the default secondLevelDomains. Would it that be enough if you were having that? Also what's your use case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants