While a condition returns true, calls a function repeatedly, and then resolves the promise
Think async version of the
$ npm install p-whilst
import pWhilst from 'p-whilst'; let count = 0; await pWhilst( () => count < 5, () => count++ ); console.log(count); //=> 5
action repeatedly, and then resolves the promise. Rejects if
action returns a promise that rejects or if an error is thrown anywhere.
Arguments: The value the
action function returns
Expected to return a boolean of whether to execute
Action to run for each iteration.
You can return a promise and it will be handled.