A helle-awesome while loop implementation for promises.
Hellewhile is a UMD module, therefore is compatible with both AMD and CommonJS:
import hellewhile from 'hellewhile';
const hellewhile = require('hellewhile');
See tests!
An awesome while loop implementation for promises.
- hellewhile
- static
- inner
- ~predicate(results, context) ⇒
Boolean
- ~asyncFn(context) ⇒
Promise.<*>
- ~predicate(results, context) ⇒
While loop implementation for an asynchronous function.
Param | Type | Default | Description |
---|---|---|---|
asyncFn | asyncFn |
the asynchronous function run with the context object. | |
predicate | predicate |
the predicate function to be used as the while loop conditional. | |
[context] | Object |
null |
optional context object to be passed into the asyncFn and predicate functions. |
[tracker] | String |
null |
optional property to be set on the context object that will store the results of each individual asyncFn call. |
Predicate function to be applied to the results of the asyncFunc.
Returns: Boolean
- if true, ends the loop.
Param | Type | Description |
---|---|---|
results | * |
results returned from the asyncFn |
context | Object | null |
the context object, null if not passed in. |
Asynchronous function to loop over.
Returns: Promise.<*>
- results of the asynchronous call
Param | Type | Description |
---|---|---|
context | Object | null |
the context object, null if not passed in. |