hostNoBrackets = (host) => {
  if (host.length >= 2 && host.startsWith('[') && host.endsWith(']')) {
    return host.substring(1, host.length - 1);
  }
  return host;
}
Removes leading and trailing square brackets if present.
Adapted from https://github.com/chromium/chromium/blob/main/url/gurl.cc#L440-L448

@param {string} host
@returns {string}