- until(it, callback): Promise<undefined>
Parameters
- it: Iterable<any> | AsyncIterable<any>
- callback: (() =>
| undefined
| boolean
| void
| Promise<undefined>
| Promise<void>
| Promise<boolean>)- ():
| undefined
| boolean
| void
| Promise<undefined>
| Promise<void>
| Promise<boolean> Returns
| undefined
| boolean
| void
| Promise<undefined>
| Promise<void>
| 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.In this version, we do a
for await of
overgen
, and alsoawait callback()
.If you want the value from the generator, use a
for of
loop as usual.If
callback
explicitly returns false, the generator is aborted.