- until(it, f): Promise<undefined>
Parameters
- it: AsyncIterable<any>
- f: (() => Promise<undefined> | Promise<boolean>)
- (): Promise<undefined> | Promise<boolean>
Returns Promise<undefined> | Promise<boolean>
Returns Promise<undefined>
- until(it, f): void
Parameters
- it: Iterable<any>
- f: (() => boolean)
- (): boolean
Returns boolean
Returns void
- until(it, f): Promise<undefined>
Parameters
- it: Iterable<any>
- f: (() => Promise<boolean>)
- (): Promise<boolean>
Returns Promise<boolean>
Returns Promise<undefined>
Loops over a generator until it finishes, calling
callback
. Useful if you don't care about the value generator produces, just the number of loops.If you want the value from the generator, use a
for of
loop as usual. Ifcallback
explicitly returns false, the generator is aborted.This does not work for infinite generators,
callback
will never be called.Param: it
Generator to run
Param: callback
Code to call for each iteration