lib/multi.js
function resultsCallback() {
    
    var args = slice.call(arguments, 0);
    var err = args.shift();
        
    if (err) {
      if (config.interrupt === true) {
        errors.push(err);
        results.push(null);
        callback.call(self, errors, results);
        return;
      } else {
         errored = true; 
         args = null;
      }
    } else if (args.length === 0) {
      args = 'OK';
    } else if (args.length == 1) {
      args = args[0];
    }
    
    errors.push(err);
    results.push(args);
    
    self.emit('each', err, counter, args);
    
    if (config.parallel) {
      
      // Parallel

      if (++counter == stack.length) {
        self.promise.emit('finished');
      }

    } else {
      
      // Sequential
      
      if (++counter == stack.length) {
        var preparedArgs = setInitialState(true); // Reset state, then return
        self.emit('post_exec');
        callback.apply(self, preparedArgs);
      } else {
        var next = stack[counter];
        context[next.caller].apply(context, next.args);
      }

    }

  }
function resultsCallback() {
    
    var args = slice.call(arguments, 0);
    var err = args.shift();
        
    if (err) {
      if (config.interrupt === true) {
        errors.push(err);
        results.push(null);
        callback.call(self, errors, results);
        return;
      } else {
         errored = true; 
         args = null;
      }
    } else if (args.length === 0) {
      args = 'OK';
    } else if (args.length == 1) {
      args = args[0];
    }
    
    errors.push(err);
    results.push(args);
    
    self.emit('each', err, counter, args);
    
    if (config.parallel) {
      
      // Parallel

      if (++counter == stack.length) {
        self.promise.emit('finished');
      }

    } else {
      
      // Sequential
      
      if (++counter == stack.length) {
        var preparedArgs = setInitialState(true); // Reset state, then return
        self.emit('post_exec');
        callback.apply(self, preparedArgs);
      } else {
        var next = stack[counter];
        context[next.caller].apply(context, next.args);
      }

    }

  }
function resultsCallback ( ) { var args = slice . call ( arguments , 0 ) ; var err = args . shift ( ) ; if ( err ) { if ( config . interrupt === true ) { errors . push ( err ) ; results . push ( null ) ; callback . call ( self , errors , results ) ; return ; } else { errored = true ; args = null ; } } else if ( args . length === 0 ) { args = 'OK' ; } else if ( args . length == 1 ) { args = args [ 0 ] ; } errors . push ( err ) ; results . push ( args ) ; self . emit ( 'each' , err , counter , args ) ; if ( config . parallel ) { // Parallel if ( ++ counter == stack . length ) { self . promise . emit ( 'finished' ) ; } } else { // Sequential if ( ++ counter == stack . length ) { var preparedArgs = setInitialState ( true ) ; // Reset state, then return self . emit ( 'post_exec' ) ; callback . apply ( self , preparedArgs ) ; } else { var next = stack [ counter ] ; context [ next . caller ] . apply ( context , next . args ) ; } } }
Handles the internal async execution loop in order
Handles the internal async execution loop in order