index.js
function vhostof (req, regexp) {
  var host = req.headers.host
  var hostname = hostnameof(req)

  if (!hostname) {
    return
  }

  var match = regexp.exec(hostname)

  if (!match) {
    return
  }

  var obj = Object.create(null)

  obj.host = host
  obj.hostname = hostname
  obj.length = match.length - 1

  for (var i = 1; i < match.length; i++) {
    obj[i - 1] = match[i]
  }

  return obj
}
function vhostof (req, regexp) {
  var host = req.headers.host
  var hostname = hostnameof(req)

  if (!hostname) {
    return
  }

  var match = regexp.exec(hostname)

  if (!match) {
    return
  }

  var obj = Object.create(null)

  obj.host = host
  obj.hostname = hostname
  obj.length = match.length - 1

  for (var i = 1; i < match.length; i++) {
    obj[i - 1] = match[i]
  }

  return obj
}
function vhostof ( req , regexp ) { var host = req . headers . host var hostname = hostnameof ( req ) if ( ! hostname ) { return } var match = regexp . exec ( hostname ) if ( ! match ) { return } var obj = Object . create ( null ) obj . host = host obj . hostname = hostname obj . length = match . length - 1 for ( var i = 1 ; i < match . length ; i ++ ) { obj [ i - 1 ] = match [ i ] } return obj }
Get the vhost data of the request for RegExp

@param (object} req
@param (RegExp} regexp
@return {object}
@private
Get the vhost data of the request for RegExp