Skip to content

@epikodelabs/streamix


@epikodelabs/streamix / concat

Function: concat()

concat<T>(...sources): Stream<T>

Defined in: projects/libraries/streamix/src/lib/streams/concat.ts:30

Concatenates sources sequentially.

concat(a, b, c) subscribes to a, yields all its values, waits for it to complete, then moves to b, then c.

  • If any source errors, the concatenated stream errors and remaining sources are not processed.
  • Sources may be Streams, raw values, arrays/iterables, or Promises of those.

Type Parameters

T

T = any

Value type.

Parameters

sources

...ConcatSource<T>[]

Streams or values (including promises) to concatenate.

Returns

Stream<T>

A new stream that emits values from all input sources in order.

Example

ts
const s = concat(from([1, 2]), from([3]), 4);
// emits: 1, 2, 3, 4

Released under the MIT License.