Installations
npm install @geek/tld
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
16.2.0
NPM Version
7.13.0
Score
77.8
Supply Chain
93.8
Quality
77.6
Maintenance
100
Vulnerability
99.6
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
brentonhouse
Download Statistics
Total Downloads
86,965
Last Day
26
Last Week
192
Last Month
834
Last Year
16,739
GitHub Statistics
MIT License
30 Commits
1 Branches
1 Contributors
Updated on Jun 23, 2021
Bundle Size
143.30 kB
Minified
40.27 kB
Minified + Gzipped
Package Meta Information
Latest Version
2.0.1-1
Package Id
@geek/tld@2.0.1-1
Unpacked Size
203.79 kB
Size
44.61 kB
File Count
6
NPM Version
7.13.0
Node Version
16.2.0
Total Downloads
Cumulative downloads
Total Downloads
86,965
Last Day
8.3%
26
Compared to previous day
Last Week
1.6%
192
Compared to previous week
Last Month
6.4%
834
Compared to previous month
Last Year
-15.5%
16,739
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
4
Motivation
Extract the TLD/domain/subdomain parts of an URL/hostname against mozilla TLDs official listing.
API
var parser = require('tld-extract');
console.log( parser("http://www.google.com") );
console.log( parser("http://google.co.uk") );
/**
* >> { tld: 'com', domain: 'google.com', sub: 'www' }
* >> { tld: 'co.uk', domain: 'google.co.uk', sub: '' }
*/
Private TLDs
Private TLDs are supported, see chromium source code for specs
console.log( parser("http://jeanlebon.cloudfront.net"));
/**
* >> { tld : 'net', domain : 'cloudfront.net', sub : 'jeanlebon' };
*/
console.log( parser("http://jeanlebon.cloudfront.net", {allowPrivateTLD : true}));
/**
* >> { tld : 'cloudfront.net', domain : 'jeanlebon.cloudfront.net', sub : '' };
*/
Unknown TLDs (level0)
By default, unknown TLD throw an exception, you can allow them and use tld-extract as a parser using the allowUnknownTLD
option
parse("http://nowhere.local")
>> throws /Invalid TLD/
parse("http://nowhere.local", {allowUnknownTLD : true}))
>> { tld : 'local', domain : 'nowhere.local', sub : '' }
Why
- no dependencies
- really fast
- full code coverage
- easy to read (10 lines)
- easily updatable vs mozilla TLDs source list
Maintenance
You can update the remote hash table using npm run update
Not Invented Here
-
A port of a yks/PHP library
-
tldextract => bad API, (no need for async, "domain" property is wrong), no need for dependencies
-
tld => (nothing bad, a bit outdated )
-
tld.js => no sane way to prove/trust/update TLD listing
Credits

No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/brentonhouse/node-tld/publish.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/brentonhouse/node-tld/publish.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:7: update your workflow using https://app.stepsecurity.io/secureworkflow/brentonhouse/node-tld/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:8: update your workflow using https://app.stepsecurity.io/secureworkflow/brentonhouse/node-tld/test.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/brentonhouse/node-tld/test.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/publish.yml:17
- Warn: npmCommand not pinned by hash: .github/workflows/test.yml:12
- Info: 0 out of 4 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
- Info: 0 out of 2 npmCommand dependencies pinned
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/publish.yml:1
- Warn: no topLevel permission defined: .github/workflows/test.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
3.4
/10
Last Scanned on 2025-02-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More