"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getLinkDomain = getLinkDomain;
// eslint-disable-next-line jsdoc/require-jsdoc
function getLinkDomain(url) {
  // Remove protocol and www., if either exists
  // Ignored via go/ees005
  // eslint-disable-next-line require-unicode-regexp
  var withoutProtocol = url.toLowerCase().replace(/^(.*):\/\//, '');
  // Ignored via go/ees005
  // eslint-disable-next-line require-unicode-regexp
  var withoutWWW = withoutProtocol.replace(/^(www\.)/, '');

  // Remove port, fragment, path, query string
  // Ignored via go/ees005
  // eslint-disable-next-line require-unicode-regexp
  return withoutWWW.replace(/[:\/?#](.*)$/, '');
}