function resolveURL(url) {
  if (typeof url !== 'string') {
    return url;
  }
  const href = url;
  const urlParsingNode = document.createElement('a');
  urlParsingNode.setAttribute('href', href);

  // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  return {
    protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
    host: urlParsingNode.host,
  };
}
Parse a URL to discover its components

@param {String | {protocol: string, host: string }} url The URL to be parsed
@returns {{protocol: string, host: string }}