dnsDomainLevels.js
 1  "use strict";
 2  Object.defineProperty(exports, "__esModule", { value: true });
 3  /**
 4   * Returns the number (integer) of DNS domain levels (number of dots) in the
 5   * hostname.
 6   *
 7   * Examples:
 8   *
 9   * ``` js
10   * dnsDomainLevels("www")
11   *   // returns 0.
12   * dnsDomainLevels("www.netscape.com")
13   *   // returns 2.
14   * ```
15   *
16   * @param {String} host is the hostname from the URL.
17   * @return {Number} number of domain levels
18   */
19  function dnsDomainLevels(host) {
20      var match = String(host).match(/\./g);
21      var levels = 0;
22      if (match) {
23          levels = match.length;
24      }
25      return levels;
26  }
27  exports.default = dnsDomainLevels;
28  //# sourceMappingURL=dnsDomainLevels.js.map