Like a while loop, but calls a callback each repetition. Returns a promise that resolves when the loop finishes if the callback is async, and runs normally if it is not async. Avoids stack overflow by using a loop, not recursive callbacks
The callback to call.
A function that returns true to keep the loop going, and false to stop it.
A promise if the function is async, or void if not
Like a while loop, but calls a callback each repetition. Returns a promise that resolves when the loop finishes if the callback is async, and runs normally if it is not async. Avoids stack overflow by using a loop, not recursive callbacks