UNPKG

490 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3// We want only the final segment of a domain, without any
4// preceding subdomains. However, we do keep leading `.` when
5// subdomains exist.
6function getRootDomain(domain) {
7 var parts = domain.split('.');
8 var baseDomainOnly = parts.slice(-2).join('.');
9 return parts.length > 2 ? "." + baseDomainOnly : baseDomainOnly;
10}
11exports.getRootDomain = getRootDomain;
12function noop() { }
13exports.noop = noop;