time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

repl.txt (2208B)


      1 
      2 {{alias}}( fcns, clbk[, thisArg] )
      3     Executes functions in series, passing the results of one function as
      4     arguments to the next function.
      5 
      6     The last argument applied to each waterfall function is a callback. The
      7     callback should be invoked upon a series function completion. The first
      8     argument is reserved as an error argument (which can be `null`). Any results
      9     which should be passed to the next function in the series should be provided
     10     beginning with the second argument.
     11 
     12     If any function calls the provided callback with a truthy `error` argument,
     13     the waterfall suspends execution and immediately calls the completion
     14     callback for subsequent error handling.
     15 
     16     Execution is *not* guaranteed to be asynchronous. To ensure asynchrony, wrap
     17     the completion callback in a function which either executes at the end of
     18     the current stack (e.g., `nextTick`) or during a subsequent turn of the
     19     event loop (e.g., `setImmediate`, `setTimeout`).
     20 
     21     Parameters
     22     ----------
     23     fcns: Array<Function>
     24         Array of functions.
     25 
     26     clbk: Function
     27         Callback to invoke upon completion.
     28 
     29     thisArg: any (optional)
     30         Function context.
     31 
     32     Examples
     33     --------
     34     > function foo( next ) { next( null, 'beep' ); };
     35     > function bar( str, next ) { console.log( str ); next(); };
     36     > function done( error ) { if ( error ) { throw error; } };
     37     > var fcns = [ foo, bar ];
     38     > {{alias}}( fcns, done );
     39 
     40 
     41 {{alias}}.factory( fcns, clbk[, thisArg] )
     42     Returns a reusable waterfall function.
     43 
     44     Parameters
     45     ----------
     46     fcns: Array<Function>
     47         Array of functions.
     48 
     49     clbk: Function
     50         Callback to invoke upon completion.
     51 
     52     thisArg: any (optional)
     53         Function context.
     54 
     55     Returns
     56     -------
     57     fcn: Function
     58         Waterfall function.
     59 
     60     Examples
     61     --------
     62     > function foo( next ) { next( null, 'beep' ); };
     63     > function bar( str, next ) { console.log( str ); next(); };
     64     > function done( error ) { if ( error ) { throw error; } };
     65     > var fcns = [ foo, bar ];
     66     > var waterfall = {{alias}}.factory( fcns, done );
     67     > waterfall();
     68     > waterfall();
     69     > waterfall();
     70 
     71     See Also
     72     --------
     73