lib/helper.js
function localhost(local, defaultPort) {
  // edge case when hostname:port is not informed via cli
  if (local === undefined || local === 'true') {
    local = [defaultPort];
  } else {
    local = local.toString().split(':');
  }

  return {
    hostname: reIp.test(local[0]) || isNaN(parseInt(local[0], 10)) &&
      local[0] ? local[0] : os.hostname(),
    port: parseInt(local[1] || (!reIp.test(local[0]) && local[0]), 10) ||
      defaultPort
  };
}
function localhost(local, defaultPort) {
  // edge case when hostname:port is not informed via cli
  if (local === undefined || local === 'true') {
    local = [defaultPort];
  } else {
    local = local.toString().split(':');
  }

  return {
    hostname: reIp.test(local[0]) || isNaN(parseInt(local[0], 10)) &&
      local[0] ? local[0] : os.hostname(),
    port: parseInt(local[1] || (!reIp.test(local[0]) && local[0]), 10) ||
      defaultPort
  };
}
function localhost ( local , defaultPort ) { // edge case when hostname:port is not informed via cli if ( local === undefined || local === 'true' ) { local = [ defaultPort ] ; } else { local = local . toString ( ) . split ( ':' ) ; } return { hostname : reIp . test ( local [ 0 ] ) || isNaN ( parseInt ( local [ 0 ] , 10 ) ) && local [ 0 ] ? local [ 0 ] : os . hostname ( ) , port : parseInt ( local [ 1 ] || ( ! reIp . test ( local [ 0 ] ) && local [ 0 ] ) , 10 ) || defaultPort } ; }
Normalize localhost and port
Normalize localhost and port