yta
    Preparing search index...

    Function forEach

    • Consume the iterator performing a side effect on each item in the sequence. Returns a promise that resolves when the iteration is finished.

      import { pipe } from "yta";
      import { asAsync, range } from "yta/sync";
      import { forEach } from "yta/async";

      await pipe(
      range(5),
      asAsync(),
      forEach((n) => console.log(n)),
      );
      // => undefined
      // logs 0, 1, 2, 3, 4

      See also:

      Type Parameters

      • A

      Parameters

      • fn: (item: A) => void

        The side effect function

      Returns (items: AsyncIterable<A>) => Promise<void>