docs: function formatURL(xStartHost, xurl, url, replaceHash, resultHost) {
      if (typeof url !== 'string') {
          return 'badurl:' + url;
      };
  
      if (typeof xurl !== 'string') {
          xurl = xurl.href;
      };
  
      if (!/[\/\.\:]/.test(url)) {
          if (replaceHash && replaceHash !== true) {
              var x = replaceHash[url];
              if (x !== und) {
                  return !resultHost ? x.value : x;
              };
          };
      };
  
      var url = normalizeURL(url);
  
      if (/^\/([^\/]|$)/.test(url)) {
          if (xStartHost && xurl.indexOf(xStartHost) === 0) {
              url = xStartHost + url;
          };
      };
  
      url = aliasURL(URL.resolve(xurl, url), false);
  
      if (replaceHash && replaceHash !== true) {
          var und;
          var x = replaceHash[url];
          if (x !== und) {
              return !resultHost ? x.value : x;
          };
  
          var s = url.replace(/[^\/]+$/, '');
          for(; /^(file|https?):\/\/./.test(s);  s = s.replace(/[^\/]+\/+$/, '') ) {
              var x = replaceHash[s];
              if (x !== und) {
                  if (x.type === 'path') {
                      var value = x.value + url.substring(s.length);
                      return !resultHost ? value : {
                          value: value,
                          host: x.host,
                          type: x.type
                      };
  
                  } else {
                      return !resultHost ? x.value : x;
                  };
              };
          };
      };
  
      return !resultHost ? url : {
          type: 'path',
          host: xStartHost,
          value: url
      };
  }