yta
    Preparing search index...

    Function aside

    • Perform a side effect with each element while passing the value on. Useful for inspecting items they pass through a pipeline.

      import { pipe } from "yta";
      import { aside, map, of, toArray } from "yta/async";

      pipe(
      of(0, 1, 2, 3, 4),
      map((n) => n ** 2),
      aside((n) => {
      // Inspect the state at this point.
      console.log(n);
      }),
      toArray(),
      );

      See also:

      Type Parameters

      • A

        The item type

      Parameters

      • fn: (item: A) => void

        The side effect producing function

      Returns (items: AsyncIterable<A>) => AsyncGenerator<A, void>