-
Notifications
You must be signed in to change notification settings - Fork 55
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
getDomain('blogspot.co.uk') returns null… what's a domain? #25
Comments
What's the difference between a domain and a "reserved domain"? Shouldn't it not matter and be treated just like any other public suffix? On the specification on publicsuffix.org, I see no mention of any distinction and, indeed, the rules themselves appear to make no distinction... |
@myndzi yep you are right. The initial motivation to create this module was to be able to detect domain names with confidence, not only with a pattern but with TLD validation. I did not have in mind to check cookie domains or whatsoever; it just happened there was publicsuffixlist as an available tld provider, with some cool additional rules. |
This is also super confusing:
but
Can I suggest mentioning in the docs? I don't think the README mentions this :( Thanks for the public suffix method. |
Would you guys be open to making this feature configurable? I love TLDJS, but this "valid host" check is causing issues in my product, and unless I can disable it through a configuration, I'm gonna be forced to look for another library to use. I'm gonna make a fork to fix the problem for myself, however I doubt that I'm the only one having issues with this. Thoughts? |
Digging further I'm realizing that there is no distinction in |
Well, as the implementation was based on complying to the publicsuffix.org list, I guess confusion happens on what we are trying to do. import tld from 'tldjs'
tld.tldExists('google'); // true
tld.tldExists('maps.google'); // true
tld.tldExists('s3.amazonaws.com'); // true
tld.getDomain('s3.amazonaws.com'); // amazonaws.com
tld.getDomain('blogspot.co.uk'); // blogspot.co.uk
tld.getSubdomain('s3.amazonaws.com'); // s3
tld.getPublicSuffix('s3.amazonaws.com'); // s3.amazonaws.com Some clarity has to be added to
Depending on how people use the library for, some convenient methods could be added. |
Undergoing conversation about making things clearer in #124 |
Because PublicSuffix list contains rules, domains and "reserved domains", it's finally harsh again to detect what's a real domain from a TLD, an SLD or something else.
Back to zero?
The text was updated successfully, but these errors were encountered: