lib/Master.js
/**
   * Creates multiple remote slaves from a single location/path.
   * @param {Number} count The number of slaves to create.
   * @param {String} connectOptions The connection options that will be sent to the master proxy server.
   * @param {Object} slaveOptions Options to pass to the slave constructor.
   * @param {...*} rest The rest of the argument to pass to the Slave constructor.
   * @throws {TypeError} When the value passed to the count param is non-numeric.
   * @return {Array<Slave>} The newly created slave(s).
   */
Creates multiple remote slaves from a single location/path.
@param {Number} count The number of slaves to create.
@param {String} connectOptions The connection options that will be sent to the master proxy server.
@param {Object} slaveOptions Options to pass to the slave constructor.
@param {...*} rest The rest of the argument to pass to the Slave constructor.
@throws {TypeError} When the value passed to the count param is non-numeric.
@return {Array} The newly created slave(s).
Creates multiple remote slaves from a single location / path . @param { Number } count The number of slaves to create . @param { String } connectOptions The connection options that will be sent to the master proxy server . @param { Object } slaveOptions Options to pass to the slave constructor . @param { ... * } rest The rest of the argument to pass to the Slave constructor . @throws { TypeError } When the value passed to the count param is non - numeric . @return { Array } The newly created slave ( s ) .
createRemoteSlaves(count, connectOptions, slaveOptions, ...rest) {
    if (count === null || count === undefined) count = 0;
    const done = rest._.getAndStripCallback();
    const toCreate = count._.getNumeric();
    if (!toCreate._.isNumeric()) {
      throw new TypeError(`Master#createSlaves expected argument #0 (count) to be numeric, but got ${typeof count}`);
    }
    slaveOptions = typeof slaveOptions === 'object' ? slaveOptions : {};
    const optionsArray = [];
    for (let i = 0; i < count; i++) {
      optionsArray.push(slaveOptions._.clone());
      if (typeof slaveOptions.alias === 'string') {
        if (i !== 0) {
          optionsArray[i].alias = `${slaveOptions.alias}-${i}`;
        } else {
          optionsArray[i].alias = slaveOptions.alias;
        }
      }
    }
    const slaves = new SlaveArray();
    for (let i = 0; i < count; i++) slaves.push(this.createRemoteSlave(connectOptions, optionsArray[i]));
    done.call(slaves, slaves);
    return slaves;
  }
createRemoteSlaves ( count , connectOptions , slaveOptions , ... rest ) { if ( count === null || count === undefined ) count = 0 ; const done = rest . _ . getAndStripCallback ( ) ; const toCreate = count . _ . getNumeric ( ) ; if ( ! toCreate . _ . isNumeric ( ) ) { throw new TypeError ( ` ${ typeof count } ` ) ; } slaveOptions = typeof slaveOptions === 'object' ? slaveOptions : { } ; const optionsArray = [ ] ; for ( let i = 0 ; i < count ; i ++ ) { optionsArray . push ( slaveOptions . _ . clone ( ) ) ; if ( typeof slaveOptions . alias === 'string' ) { if ( i !== 0 ) { optionsArray [ i ] . alias = ` ${ slaveOptions . alias } ${ i } ` ; } else { optionsArray [ i ] . alias = slaveOptions . alias ; } } } const slaves = new SlaveArray ( ) ; for ( let i = 0 ; i < count ; i ++ ) slaves . push ( this . createRemoteSlave ( connectOptions , optionsArray [ i ] ) ) ; done . call ( slaves , slaves ) ; return slaves ; }
Creates multiple remote slaves from a single location/path.
Creates multiple remote slaves from a single location / path .