normalizeport

Solutions on MaxInterview for normalizeport by the best coders in the world

showing results for - "normalizeport"
Alyson
22 Aug 2020
1/**
2 * Normalize a port into a number, string, or false.
3 */
4function normalizePort(val) {
5  var port = parseInt(val, 10);
6
7  if (isNaN(port)) {
8    // named pipe
9    return val;
10  }
11
12  if (port >= 0) {
13    // port number
14    return port;
15  }
16
17  return false;
18}
19
similar questions
queries leading to this page
normalizeport