lib/step.js
function next() {
    counter = pending = 0;

    // Check if there are no steps left
    if (steps.length === 0) {
      // Throw uncaught errors
      if (arguments[0]) {
        throw arguments[0];
      }
      return;
    }

    // Get the next step to execute
    var fn = steps.shift();
    results = [];

    // Run the step in a try..catch block so exceptions don't get out of hand.
    try {
      lock = true;
      var result = fn.apply(next, arguments);
    } catch (e) {
      // Pass any exceptions on through the next callback
      next(e);
    }

    if (counter > 0 && pending == 0) {
      // If parallel() was called, and all parallel branches executed
      // synchronously, go on to the next step immediately.
      next.apply(null, results);
    } else if (result !== undefined) {
      // If a synchronous return is used, pass it to the callback
      next(undefined, result);
    }
    lock = false;
  }
function next() {
    counter = pending = 0;

    // Check if there are no steps left
    if (steps.length === 0) {
      // Throw uncaught errors
      if (arguments[0]) {
        throw arguments[0];
      }
      return;
    }

    // Get the next step to execute
    var fn = steps.shift();
    results = [];

    // Run the step in a try..catch block so exceptions don't get out of hand.
    try {
      lock = true;
      var result = fn.apply(next, arguments);
    } catch (e) {
      // Pass any exceptions on through the next callback
      next(e);
    }

    if (counter > 0 && pending == 0) {
      // If parallel() was called, and all parallel branches executed
      // synchronously, go on to the next step immediately.
      next.apply(null, results);
    } else if (result !== undefined) {
      // If a synchronous return is used, pass it to the callback
      next(undefined, result);
    }
    lock = false;
  }
function next ( ) { counter = pending = 0 ; // Check if there are no steps left if ( steps . length === 0 ) { // Throw uncaught errors if ( arguments [ 0 ] ) { throw arguments [ 0 ] ; } return ; } // Get the next step to execute var fn = steps . shift ( ) ; results = [ ] ; // Run the step in a try..catch block so exceptions don't get out of hand. try { lock = true ; var result = fn . apply ( next , arguments ) ; } catch ( e ) { // Pass any exceptions on through the next callback next ( e ) ; } if ( counter > 0 && pending == 0 ) { // If parallel() was called, and all parallel branches executed // synchronously, go on to the next step immediately. next . apply ( null , results ) ; } else if ( result !== undefined ) { // If a synchronous return is used, pass it to the callback next ( undefined , result ) ; } lock = false ; }
Define the main callback that's given as `this` to the steps.
Define the main callback that s given as this to the steps .