index.js
function performParallel(pool, queries, callback) {
  let count   = 0,
      results = new Array(queries.length);

  queries.forEach((query, index) => {
    pool.query(query, (error, result) => {
      if (error) {
        return callback(error, results);
      }

      results[index] = result;

      if (++count === queries.length) {
        return callback(null, results);
      }
    });
  });
}
function performParallel(pool, queries, callback) {
  let count   = 0,
      results = new Array(queries.length);

  queries.forEach((query, index) => {
    pool.query(query, (error, result) => {
      if (error) {
        return callback(error, results);
      }

      results[index] = result;

      if (++count === queries.length) {
        return callback(null, results);
      }
    });
  });
}
function performParallel ( pool , queries , callback ) { let count = 0 , results = new Array ( queries . length ) ; queries . forEach ( ( query , index ) => { pool . query ( query , ( error , result ) => { if ( error ) { return callback ( error , results ) ; } results [ index ] = result ; if ( ++ count === queries . length ) { return callback ( null , results ) ; } } ) ; } ) ; }
Using the specified connection pool, performs a series of specified queries
in parallel, executing a specified callback function once all queries have
successfully completed.
@param  {BoundPool}      pool
@param  {Array.<Object>} queries
@param  {Function}       callback
@private
Using the specified connection pool performs a series of specified queries in parallel executing a specified callback function once all queries have successfully completed .