Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

psl

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

psl

Domain name parser based on the Public Suffix List

  • 1.11.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
36M
increased by6.14%
Maintainers
1
Weekly downloads
 
Created

What is psl?

The psl npm package is a domain parsing library that allows you to work with Public Suffix List (PSL). The Public Suffix List is a set of Internet domain name suffixes under which Internet users can directly register names. The psl package provides functionality to parse domain names, extract top-level domains (TLDs), check domain validity, and more.

What are psl's main functionalities?

Parsing domain names

This feature allows you to parse domain names and extract various parts such as the domain, subdomain, and top-level domain (TLD).

const psl = require('psl');
let parsed = psl.parse('www.example.co.uk');
console.log(parsed.domain); // 'example.co.uk'
console.log(parsed.subdomain); // 'www'
console.log(parsed.tld); // 'co.uk'

Checking if a domain is valid

This feature enables you to check if a given domain name is valid according to the rules of the Public Suffix List.

const psl = require('psl');
let isValid = psl.isValid('example.com');
console.log(isValid); // true

Getting domain from a URL

This feature is used to extract the domain from a full URL, which can be useful for applications that need to process or analyze web addresses.

const psl = require('psl');
let domain = psl.get('http://www.example.co.uk');
console.log(domain); // 'example.co.uk'

Other packages similar to psl

Keywords

FAQs

Package last updated on 21 Nov 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc