Calls a function repeatedly while a condition returns true and then resolves the promise
- See Also
Installation
$ npm install --save promise-do-whilst
Usage
; let count = 0; ; // ... let max = 0; ;
API
promiseDoWhilst(action, condition)
Executes action
repeatedly while condition
returns true
and then resolves the promise. Rejects if action
returns a promise that rejects or if an error is thrown anywhere.
action
Type: function
Action to run for each iteration.
You can return a promise and it will be handled.
condition
Type: function
Should return a boolean of whether to continue.
License
ISC © Buster Collings