code: function parseURL(url) {
  
  	const endpoint = {};
  
  	const purl = urlParser.parse(url, true);
  
  	if (purl.protocol && purl.protocol.startsWith('http')) {
  		endpoint.protocol = purl.protocol.slice(0, -1);
  		if (purl.hostname) {
  			endpoint.hostname = purl.hostname;
  
  			if (purl.port) {
  				endpoint.port = parseInt(purl.port);
  			}
  
  		} else {
  			throw new Error('InvalidURL: missing hostname.');
  		}
  
  	} else {
  		throw new Error('InvalidURL: url must start with http or https.');
  	}
  
  	return endpoint;
  }
docs: Utility function which parses an HTTP URL into its component parts
  @param {string} url HTTP or HTTPS url including protocol, host and port
  @returns {HTTPEndpoint}
  @throws InvalidURL for malformed URLs
  @ignore