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.

  • Parameters

    • it: Iterable<any>

      Generator to run

    • callback: (() => boolean | void)

      Code to call for each iteration

        • (): boolean | void
        • Returns boolean | void

    Returns void