parse-hostname
v1.2.0
Published
Parse a hostname into three parts: subdomain, domain and public suffix.
Downloads
8
Readme
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']