lib/router/index.js
function getProtohost(url) {
  if (typeof url !== 'string' || url.length === 0 || url[0] === '/') {
    return undefined
  }

  var searchIndex = url.indexOf('?')
  var pathLength = searchIndex !== -1
    ? searchIndex
    : url.length
  var fqdnIndex = url.substr(0, pathLength).indexOf('://')

  return fqdnIndex !== -1
    ? url.substr(0, url.indexOf('/', 3 + fqdnIndex))
    : undefined
}
function getProtohost(url) {
  if (typeof url !== 'string' || url.length === 0 || url[0] === '/') {
    return undefined
  }

  var searchIndex = url.indexOf('?')
  var pathLength = searchIndex !== -1
    ? searchIndex
    : url.length
  var fqdnIndex = url.substr(0, pathLength).indexOf('://')

  return fqdnIndex !== -1
    ? url.substr(0, url.indexOf('/', 3 + fqdnIndex))
    : undefined
}
function getProtohost ( url ) { if ( typeof url !== 'string' || url . length === 0 || url [ 0 ] === '/' ) { return undefined } var searchIndex = url . indexOf ( '?' ) var pathLength = searchIndex !== - 1 ? searchIndex : url . length var fqdnIndex = url . substr ( 0 , pathLength ) . indexOf ( '://' ) return fqdnIndex !== - 1 ? url . substr ( 0 , url . indexOf ( '/' , 3 + fqdnIndex ) ) : undefined }
Get get protocol + host for a URL
Get get protocol + host for a URL