`domain.com.ru` will be detected its suffix as `.ru`, but shall be `.com.ru`
xiaohuilam opened this issue · 2 comments
xiaohuilam commented
remusao commented
Hi @xiaohuilam,
This .com.ru
suffix is part of the "private section" of the public suffix list, which is disabled by default in tldts
to prevent surprises (having this behavior by default leads to lots of unexpected cases for users of the library).
You can enable it like so to get the results you expect:
const { parse } = require('tldts');
console.log(
parse('domain.com.ru', {
allowPrivateDomains: true,
}),
);
// Result:
// {
// domain: 'domain.com.ru',
// domainWithoutSuffix: 'domain',
// hostname: 'domain.com.ru',
// isIcann: false,
// isIp: false,
// isPrivate: true,
// publicSuffix: 'com.ru',
// subdomain: ''
// }
xiaohuilam commented
Thank you!