@alphatr/publicsuffix
v2.0.0
Published
The Public Suffix List
Readme
@alphatr/publicsuffix
Parse domain names using the Public Suffix List.
Install
npm install @alphatr/publicsuffixUsage
import { extract } from '@alphatr/publicsuffix';
extract('www.example.com'); // 'example.com'
extract('sub.example.co.uk'); // 'example.co.uk'
extract('192.168.1.1'); // '192.168.1.1'extract(domain) accepts a domain/hostname string and returns the registrable domain as a string. URL parsing plus scheme/auth prefixes, ports, and paths should be handled by the caller before calling extract.
License
MIT
