parse-hostname
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

Parse Hostname

Parse a hostname into three parts: subdomain, domain and public suffix.

Installation

npm install --save parse-hostname

Usage

const parseHostname = require('parse-hostname')
 
console.log(parseHostname('www.google.com'))
//=> ['www', 'google', 'com']
 
console.log(parseHostname('mail.linusu.co.uk'))
//=> ['mail', 'linusu', 'co.uk']
 
console.log(parseHostname('example.se.eu.org'))
//=> ['', 'example', 'se.eu.org']

/parse-hostname/

    Package Sidebar

    Install

    npm i parse-hostname

    Weekly Downloads

    111

    Version

    1.2.0

    License

    MIT

    Unpacked Size

    101 kB

    Total Files

    4

    Last publish

    Collaborators

    • linusu