📜  normalizePort - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:50.877000             🧑  作者: Mango

代码示例1
/**
 * Normalize a port into a number, string, or false.
 */
function normalizePort(val) {
  var port = parseInt(val, 10);

  if (isNaN(port)) {
    // named pipe
    return val;
  }

  if (port >= 0) {
    // port number
    return port;
  }

  return false;
}