index.js
function hostregexp (val) {
  var source = !isregexp(val)
    ? String(val).replace(ESCAPE_REGEXP, ESCAPE_REPLACE).replace(ASTERISK_REGEXP, ASTERISK_REPLACE)
    : val.source

  // force leading anchor matching
  if (source[0] !== '^') {
    source = '^' + source
  }

  // force trailing anchor matching
  if (!END_ANCHORED_REGEXP.test(source)) {
    source += '$'
  }

  return new RegExp(source, 'i')
}
function hostregexp (val) {
  var source = !isregexp(val)
    ? String(val).replace(ESCAPE_REGEXP, ESCAPE_REPLACE).replace(ASTERISK_REGEXP, ASTERISK_REPLACE)
    : val.source

  // force leading anchor matching
  if (source[0] !== '^') {
    source = '^' + source
  }

  // force trailing anchor matching
  if (!END_ANCHORED_REGEXP.test(source)) {
    source += '$'
  }

  return new RegExp(source, 'i')
}
function hostregexp ( val ) { var source = ! isregexp ( val ) ? String ( val ) . replace ( ESCAPE_REGEXP , ESCAPE_REPLACE ) . replace ( ASTERISK_REGEXP , ASTERISK_REPLACE ) : val . source // force leading anchor matching if ( source [ 0 ] !== '^' ) { source = '^' + source } // force trailing anchor matching if ( ! END_ANCHORED_REGEXP . test ( source ) ) { source += '$' } return new RegExp ( source , 'i' ) }
Generate RegExp for given hostname value.

@param (string|RegExp} val
@private
Generate RegExp for given hostname value .