packages/slate-tools/tools/utilities/index.js
function getAvailablePortSeries(start, quantity, increment = 1) {
  const startPort = start;
  const endPort = start + (quantity - 1);

  return findAPortInUse(startPort, endPort, '127.0.0.1').then((port) => {
    if (typeof port === 'number') {
      return getAvailablePortSeries(port + increment, quantity);
    }

    const ports = [];

    for (let i = startPort; i <= endPort; i += increment) {
      ports.push(i);
    }

    return ports;
  });
}
function getAvailablePortSeries(start, quantity, increment = 1) {
  const startPort = start;
  const endPort = start + (quantity - 1);

  return findAPortInUse(startPort, endPort, '127.0.0.1').then((port) => {
    if (typeof port === 'number') {
      return getAvailablePortSeries(port + increment, quantity);
    }

    const ports = [];

    for (let i = startPort; i <= endPort; i += increment) {
      ports.push(i);
    }

    return ports;
  });
}
function getAvailablePortSeries ( start , quantity , increment = 1 ) { const startPort = start ; const endPort = start + ( quantity - 1 ) ; return findAPortInUse ( startPort , endPort , '127.0.0.1' ) . then ( ( port ) => { if ( typeof port === 'number' ) { return getAvailablePortSeries ( port + increment , quantity ) ; } const ports = [ ] ; for ( let i = startPort ; i <= endPort ; i += increment ) { ports . push ( i ) ; } return ports ; } ) ; }
Finds a series of available ports of length quantity, starting at a given port number and incrementing up. Returns an array of port numbers.
Finds a series of available ports of length quantity starting at a given port number and incrementing up . Returns an array of port numbers .