rootdomain

0.0.2 • Public • Published

root-domain

This module determines the root domain for any domain or sub domain. It takes into account that certain 'second level domains' exist, like '.co.uk' or 'com.au'.

Usage

Install

npm i root-domain -S

Use

const rootDomain = require('root-domain');

console.log(rootDomain('example.com'));                 // prints example.com
console.log(rootDomain('a.b.c.sub.example.com.au'));    // print example.com.au

The domain name MUST NOT end with a '/'.

Warning

Use this module at your own risk.

/rootdomain/

    Package Sidebar

    Install

    npm i rootdomain

    Weekly Downloads

    2

    Version

    0.0.2

    License

    MIT

    Last publish

    Collaborators

    • sandyman