promise-circuit
Create a circuit-type flow for Promise functions.
Create a series of Promise-returning functions (with prepared arguments):
const foo = ; for let item of something foo; foo;
Installation
$ npm install --save promise-circuit
Usage
;
new Circuit([series])
Create a circuit.
series
(Array
): Pre-provided series.
Series format:
fn args fn args;
Circuit#add(fn, [args])
Add a promise function to the circuit.
fn
(function
): A promse-returning (or thenable) function.args
(Array
): Arguments to be passed in once the circuit is ran.
Circuit#run()
Run the series of promise functions in a circuit-like flow.
Returns Promise
with all the results of the circuit.
Credits
Jamen Marzonie |