lib/port-manager.js
function normalize(from, to) {
  if (from && (isNaN(from) || from <= 0) || (to && (isNaN(to) || to <= 0))) {
    throw new Error('invalid port range: required > 0');
  }
  if ((from && from > MAX) || (to && to > MAX)) {
    throw new Error(f('invalid port range: required < %d', MAX));
  }
  if (to && to < from) {
    throw new Error('invalid port range: required max >= min');
  }
  if (!from) {
    from = min;
    to = to || max;
  } else {
    to = to || from;
  }
  return {
    from: from,
    to: to
  };
}
function normalize(from, to) {
  if (from && (isNaN(from) || from <= 0) || (to && (isNaN(to) || to <= 0))) {
    throw new Error('invalid port range: required > 0');
  }
  if ((from && from > MAX) || (to && to > MAX)) {
    throw new Error(f('invalid port range: required < %d', MAX));
  }
  if (to && to < from) {
    throw new Error('invalid port range: required max >= min');
  }
  if (!from) {
    from = min;
    to = to || max;
  } else {
    to = to || from;
  }
  return {
    from: from,
    to: to
  };
}
function normalize ( from , to ) { if ( from && ( isNaN ( from ) || from <= 0 ) || ( to && ( isNaN ( to ) || to <= 0 ) ) ) { throw new Error ( 'invalid port range: required > 0' ) ; } if ( ( from && from > MAX ) || ( to && to > MAX ) ) { throw new Error ( f ( 'invalid port range: required < %d' , MAX ) ) ; } if ( to && to < from ) { throw new Error ( 'invalid port range: required max >= min' ) ; } if ( ! from ) { from = min ; to = to || max ; } else { to = to || from ; } return { from : from , to : to } ; }
Normalize a TCP ports range

@param {Number} [from] Start port (included)
@param {Number} [to] End port (included)
@return {{from: {Number}, to: {Number}}}
@private
@ignore
Normalize a TCP ports range