@vgerbot/async
    Preparing search index...

    Function doWhilst

    • Executes an iteratee at least once, then repeatedly while the async test returns true. Similar to whilst but the test is evaluated after each iteration (do-while loop).

      Parameters

      • iteratee: WhilstIteratee

        Async body executed at least once, then while test is true.

      • test: WhilstTest

        Condition evaluated after each iteration.

      • Optionaloptions: CancellableOptions<unknown>

        Cancellable configuration options.

      Returns CancellableHandle<unknown>

      A cancellable handle that resolves when the loop exits.

      let count = 0;
      const handle = doWhilst(
      async (token) => {
      await token.sleep(5);
      count++;
      },
      async () => count < 3,
      );

      await handle;
      // count === 3