'use strict';

// MODULES //

var factory = require( './factory.js' );


// MAIN //

/**
* Executes functions in series, passing the results of one function as arguments to the next function.
*
* @param {FunctionArray} fcns - array of functions
* @param {Callback} clbk - callback to invoke upon completion
* @param {*} [thisArg] - function context
* @throws {TypeError} first argument must be an array of functions
* @throws {TypeError} callback argument must be a function
*
* @example
* function foo( next ) {
*     next( null, 'beep' );
* }
*
* function bar( str, next ) {
*     console.log( str );
*     // => 'beep'
*
*     next();
* }
*
* function done( error ) {
*     if ( error ) {
*         throw error;
*     }
* }
*
* var fcns = [ foo, bar ];
*
* waterfall( fcns, done );
*/
function waterfall( fcns, clbk, thisArg ) {
	factory( fcns, clbk, thisArg )();
} // end FUNCTION waterfall()


// EXPORTS //

module.exports = waterfall;

'use strict';

// MODULES //

var factory = require( './factory.js' );


// MAIN //

/**
* Executes functions in series, passing the results of one function as arguments to the next function.
*
* @param {FunctionArray} fcns - array of functions
* @param {Callback} clbk - callback to invoke upon completion
* @param {*} [thisArg] - function context
* @throws {TypeError} first argument must be an array of functions
* @throws {TypeError} second argument must be a function
*
* @example
* function foo( next ) {
*     next( null, 'beep' );
* }
*
* function bar( str, next ) {
*     console.log( str );
*     // => 'beep'
*
*     next();
* }
*
* function done( error ) {
*     if ( error ) {
*         throw error;
*     }
* }
*
* var fcns = [ foo, bar ];
*
* waterfall( fcns, done );
*/
function waterfall( fcns, clbk, thisArg ) {
	factory( fcns, clbk, thisArg )();
} // end FUNCTION waterfall()


// EXPORTS //

module.exports = waterfall;

Update description of throw annotation
Update description of throw annotation
