
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
tlds2 is an npm module that provides a comprehensive list of top-level domains (TLDs) from ICANN. It also includes subdomain and registrar identification for better domain control and parsing.
To access the complete TLD and registrar list, visit this link.
npm install tlds2
const tlds = require('tlds2');
console.log(tlds.top);
//=> ['aaa', 'aarp', 'abarth', 'abb', 'abbott', 'abbvie', 'abc', ...]
You can obtain the detailed list of registrars that make up the ICANN domains. This allows you to identify domains like *.co.uk when the ICANN list only includes *.uk.
const tlds = require('tlds2');
console.log(tlds.list);
//=> ['aaa', 'aarp', 'abarth', 'abb', 'abbott', 'abbvie', 'abc', ...]
Feel free to explore the full capabilities of the tlds2 module to enhance your domain management and parsing functionalities.
Combines the usage of checkDomain() and checkTLD() to perform comprehensive domain validation.
domain (string): The domain name to check.An object with the following properties:
error (string|null): Error message if the domain is invalid, null if valid.punycode (boolean): Indicates whether the domain contains punycode encoding.org (string|null): The organization/domain part of the fully qualified domain name (FQDN) returned by checkTLD().tld (string): The top-level domain (TLD) labels in reverse order, joined by a dot ('.') returned by checkTLD().subDomain (string): The subdomain labels in reverse order, joined by a dot ('.') returned by `checkTLD().const {check} = require("./tlds2")
const result = check('example.com');
console.log(result);
// Output: { error: null, punycode: false, org: "example", tld: "com", subDomain: "" }
In the example above, the check() function is used to validate the domain name "example.com". The result object contains information about any errors, punycode encoding, organization/domain, TLD labels, and subdomain labels returned by checkTLD().
Checks the top-level domain (TLD) and subdomain of a fully qualified domain name (FQDN).
fqdn (string): The fully qualified domain name to check.An object with the following properties:
error (string | null): Error message if the TLD/subdomain is invalid, null if valid.punycode (boolean): Indicates whether the TLD/subdomain contains punycode encoding.validTLD (boolean): Indicates whether a valid TLD is present.org (string | null): Organization/domain part of the FQDN.tld (string): TLD labels in reverse order, joined with periods.subDomain (string): Subdomain labels in reverse order, joined with periods.const {checkTLD} = require("./tlds2")
const fqdn = "sub.domain.example.com";
const result = checkTLD(fqdn);
console.log(result);
Output:
{
error: null,
punycode: false,
validTLD: true,
org: "example",
tld: "com",
subDomain: "sub.domain"
}
Checks a domain name for validity.
domain (string): The domain name to check.An object with the following properties:
error (string | null): An error message if the domain is invalid, or null if the domain is valid.punycode (boolean): Indicates whether the domain contains punycode encoding.info (string | undefined): Additional information about the error, if any.const {checkDomain} = require("./tlds2")
const domainInfo = checkDomain('example.com');
console.log(domainInfo);
// Output: { error: null, punycode: false }
const invalidDomain = checkDomain('-invalid.domain');
console.log(invalidDomain);
// Output: { error: 'Invalid domain', punycode: false, info: 'Invalid label encoding' }
FAQs
Comprehensive list of TLDs and subdomain registrars
The npm package tlds2 receives a total of 4,753 weekly downloads. As such, tlds2 popularity was classified as popular.
We found that tlds2 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.