Q+
Q+ is a utility add-on for the promise library Q. It adds flow-control methods to work with data between promises.
Examples
var Q = ; var africanMammalLocations = ;Animal;
Documentation ### Q(object).eachSeries(iterator)
// Typical 'forEach' usage:;// With a promise as iterator:;// Using an object instead of an array:;
### Q(object).mapSeries(iterator)
TODO
### Q(object).each(iterator)
TODO
### Q(object).map(iterator)
TODO
### Q.while(test, iterator) ### Q(value).while(test, iterator)
Repeatedly calls iterator
until test
returns false;
- test(
value
)function
: synchronous truth test to perform before each execution of iterator.value
is the return value of the last iterator. - iterator(
value
)function
: A function or promise which is called each time test passes.value
is the return value of the last iterator.
var count = 0;var arr = ; // Iterator can be a normal function or a promiseQ; // Can be used in a promise chain, passing the return// value of the last function/iterator to the next;
### Q.until(test, iterator) ### Q(value).until(test, iterator)
The inverse of while -- repeatedly calls iterator
until test
returns true.
### Q.times(n, iterator) ### Q(value).times(n, iterator)
Calls the iterator
n times, and accumulates results the same way you'd use map.
var { return Results;}; Q; ;