Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
tldts-core
Advanced tools
The tldts-core npm package is a library for working with top-level domains (TLDs). It provides functionalities to parse, validate, and manipulate domain names, making it useful for tasks such as extracting the root domain, subdomain, and TLD from a given URL.
Extract Root Domain
This feature allows you to extract the root domain from a given URL. In the example, the root domain 'example.co.uk' is extracted from the URL 'https://www.example.co.uk'.
const tldts = require('tldts-core');
const rootDomain = tldts.getDomain('https://www.example.co.uk');
console.log(rootDomain); // 'example.co.uk'
Extract Subdomain
This feature allows you to extract the subdomain from a given URL. In the example, the subdomain 'blog' is extracted from the URL 'https://blog.example.co.uk'.
const tldts = require('tldts-core');
const subdomain = tldts.getSubdomain('https://blog.example.co.uk');
console.log(subdomain); // 'blog'
Extract TLD
This feature allows you to extract the top-level domain (TLD) from a given URL. In the example, the TLD 'co.uk' is extracted from the URL 'https://www.example.co.uk'.
const tldts = require('tldts-core');
const tld = tldts.getPublicSuffix('https://www.example.co.uk');
console.log(tld); // 'co.uk'
Validate Domain
This feature allows you to validate whether a given domain is valid. In the example, the domain 'example.co.uk' is validated and returns true.
const tldts = require('tldts-core');
const isValid = tldts.isValid('example.co.uk');
console.log(isValid); // true
The psl (Public Suffix List) package is used to parse and validate domain names based on the public suffix list. It provides similar functionalities to tldts-core, such as extracting the root domain and validating domains. However, tldts-core offers a more comprehensive set of features for working with TLDs.
The parse-domain package is another library for parsing domain names. It provides functionalities to extract the subdomain, domain, and TLD from a given URL. While it offers similar features to tldts-core, it may not be as feature-rich or actively maintained.
The tldjs package is a library for working with TLDs and domain names. It provides functionalities to extract the root domain, subdomain, and TLD, similar to tldts-core. However, tldts-core is designed to be more lightweight and efficient.
tldts-core
core building blocks of tldts, used by both
tldts
andtldts-experimental
packages.
v5.6.12 (Sun Mar 15 2020)
tldts
FAQs
tldts core primitives (internal module)
We found that tldts-core 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.