hellewhile
v1.0.2
Published
An awesome while loop implementation for promises.
Downloads
2
Readme
Hellewhile
An awesome while loop implementation for promises.
Usage
Hellewhile is a UMD module, therefore is compatible with both AMD and CommonJS:
import hellewhile from 'hellewhile';
const hellewhile = require('hellewhile');
Example Usage
See tests!
hellewhile
An awesome while loop implementation for promises.
- hellewhile
- static
- inner
- ~predicate(results, context) ⇒ Boolean
- ~asyncFn(context) ⇒ Promise.<*>
hellewhile
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. |
hellewhile~predicate(results, context) ⇒ Boolean
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. |
hellewhile~asyncFn(context) ⇒ Promise.<*>
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. |