Function until

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.

until(count(5), () => {
// do something 5 times
});

If you want the value from the generator, use a for of loop as usual. If callback explicitly returns false, the generator is aborted.

This does not work for infinite generators, callback will never be called.

Generator to run

Code to call for each iteration

  • Parameters

    • it: AsyncIterable<any>
    • f: (() => Promise<undefined> | Promise<boolean>)
        • (): Promise<undefined> | Promise<boolean>
        • Returns Promise<undefined> | Promise<boolean>

    Returns Promise<undefined>

  • Parameters

    • it: Iterable<any>
    • f: (() => boolean)
        • (): boolean
        • Returns boolean

    Returns void

  • Parameters

    • it: Iterable<any>
    • f: (() => Promise<boolean>)
        • (): Promise<boolean>
        • Returns Promise<boolean>

    Returns Promise<undefined>