Prelude API
    Preparing search index...
    • Creates a transformer that applies a function to each value without changing the values.

      Type Parameters

      • T

      Parameters

      • f: (value: T, index: number, worker: number) => void | Promise<void>

        Side-effect function to apply to each value

      • options: { concurrency?: number; signal?: AbortSignal } = {}

        Configuration options

        • Optionalconcurrency?: number

          Number of concurrent operations (default: 1)

        • Optionalsignal?: AbortSignal

          Aborting makes the transformer throw signal.reason and stop pulling from the source; a call of f already in flight is left to settle on its own

      Returns (values: AsyncIterable<T>) => AsyncGenerator<any, void, unknown>

      A transformer function that yields the original values after applying the function

      The tap function is used for side effects while processing an async iterable. It applies the provided function to each value but yields the original values unchanged. Supports concurrent processing with configurable concurrency.

      // Log values as they pass through
      const result = await G.pipe(
      G.ofIterable([1, 2, 3, 4, 5]),
      G.tap(value => console.log(`Processing: ${value}`)),
      G.array
      ); // [1, 2, 3, 4, 5]

      // Process values concurrently
      const result = await G.pipe(
      G.ofIterable([1, 2, 3, 4, 5]),
      G.tap(async value => {
      await longRunningOperation(value);
      }, { concurrency: 3 }),
      G.array
      );