Prelude API
    Preparing search index...
    • Creates an async generator that concatenates multiple async iterables.

      Type Parameters

      • Gs extends AsyncIterable<unknown, any, any>[]

        Array type of async iterables

      Parameters

      • ...valuesArray: Gs

        Multiple async iterables to concatenate

      Returns AsyncGenerator<AsyncIterated<Gs[number]>>

      An async generator that yields all values from each iterable in sequence

      This function combines multiple async iterables into a single async generator. Values are processed in order - all values from the first iterable, then all values from the second iterable, and so on. This is useful for sequentially processing multiple data sources without having to manually chain them.

      Note that this is different from merging, as concat waits for each iterable to completely finish before moving to the next one.

      // Concatenate multiple arrays
      const result = await G.pipe(
      G.concat(
      G.ofIterable([1, 2, 3]),
      G.ofIterable([4, 5, 6]),
      G.ofIterable([7, 8, 9])
      ),
      G.array
      ); // [1, 2, 3, 4, 5, 6, 7, 8, 9]

      // Concatenate different data sources
      const allData = await G.pipe(
      G.concat(
      G.ofIterable(localData),
      fetchFromDatabase(),
      fetchFromApi()
      ),
      G.map(item => processItem(item)),
      G.array
      );