@vgerbot/async
    Preparing search index...

    Function any

    • Takes an array of tasks and returns a promise that resolves as soon as any of the tasks resolves. If all tasks reject, it rejects with an AggregateError.

      Parameters

      Returns CancellableHandle<unknown>

      A cancellable handle that resolves with the first successful task's result.

      const handle = any(
      {},
      async () => {
      throw new Error("failed");
      },
      async (token) => {
      await token.sleep(10);
      return "ok";
      },
      );

      const result = await handle; // "ok"