Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
parse-domains
Advanced tools
Readme
This module is a complete rewrite of parse-domains version 1.x.x in order to make use of Mozilla's fantastic publicsuffix list.
It was written while benchmarking against tldts which is super fast but has to be updated with every new suffix added to the public suffix list.
Instead, this module automatically downloads the public list once a day only as recommended by publicsuffix.org. The new list is then loaded to memory once to keep the library super fast.
Generally, parsing most domains takes less than one millisecond. While not as fast as tldts, it parses in 1ms or less and you will never have to upgrade the module to a higher version just to get the latest suffixes.
async () => {
let parse = require('parse-domains');
// notice this method returns a promise
// So either use the async/await pattern or the Promise.then pattern
let resp = await parse('http://www.google.co.uk');
console.log(resp);
};
This will log:
{
tld: 'co.uk',
domain: 'google.co.uk',
subdomain: 'www',
siteName: 'google',
href: 'http://www.google.co.uk/',
hostname: 'www.google.co.uk',
protocol: 'http:'
}
FAQs
Domain parser that automatically updates its suffix lists from Mozilla's publicsuffix.org
The npm package parse-domains receives a total of 69 weekly downloads. As such, parse-domains popularity was classified as not popular.
We found that parse-domains demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.