code: function normalizePort(val, def=3000) {
      var port = parseInt(val, 10);
  
      // named pipe
      if (isNaN(port)) return val;
  
      // port number
      if (port >= 0) return port;
  
      return def;
  }
docs: Normalize a port into a number, string, or false.