import { OperatorAsyncFunction } from '../../interfaces.js'; import { ConcatAsyncIterable } from '../concat.js'; /** * Concatenates the second async-iterable sequence to the first async-iterable sequence upon successful termination of the first. * * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @param {AsyncIterable} v1 First async-iterable source. * @param {AsyncIterable} v2 Second async-iterable source. * @returns {(OperatorAsyncFunction)} An async-iterable sequence that contains the elements of the first sequence, * followed by those of the second the sequence. */ export function concatWith(v2: AsyncIterable): OperatorAsyncFunction; /** * Concatenates all async-iterable sequences in the given sequences, as long as the previous async-iterable * sequence terminated successfully. * * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. * @param {AsyncIterable} v1 First async-iterable source. * @param {AsyncIterable} v2 Second async-iterable source. * @param {AsyncIterable} v3 Third async-iterable source. * @returns {(OperatorAsyncFunction)} An async-iterable sequence that contains the elements of each given sequence, * in sequential order. */ export function concatWith( v2: AsyncIterable, v3: AsyncIterable ): OperatorAsyncFunction; /** * Concatenates all async-iterable sequences in the given sequences, as long as the previous async-iterable * sequence terminated successfully. * * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. * @template T4 The type of the elements in the fourth source sequence. * @param {AsyncIterable} v2 Second async-iterable source. * @param {AsyncIterable} v3 Third async-iterable source. * @param {AsyncIterable} v4 Fourth async-iterable source. * @returns {(OperatorAsyncFunction)} An async-iterable sequence that contains the elements of each * given sequence, in sequential order. */ export function concatWith( v2: AsyncIterable, v3: AsyncIterable, v4: AsyncIterable ): OperatorAsyncFunction; /** * Concatenates all async-iterable sequences in the given sequences, as long as the previous async-iterable * sequence terminated successfully. * * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. * @template T4 The type of the elements in the fourth source sequence. * @template T5 The type of the elements in the fifth source sequence. * @param {AsyncIterable} v2 Second async-iterable source. * @param {AsyncIterable} v3 Third async-iterable source. * @param {AsyncIterable} v4 Fourth async-iterable source. * @param {AsyncIterable} v5 Fifth async-iterable source. * @returns {(OperatorAsyncFunction)} An async-iterable sequence that contains the elements of each * given sequence, in sequential order. */ export function concatWith( v2: AsyncIterable, v3: AsyncIterable, v4: AsyncIterable, v5: AsyncIterable ): OperatorAsyncFunction; /** * Concatenates all async-iterable sequences in the given sequences, as long as the previous async-iterable * sequence terminated successfully. * * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. * @template T4 The type of the elements in the fourth source sequence. * @template T5 The type of the elements in the fifth source sequence. * @template T6 The type of the elements in the sixth source sequence. * @param {AsyncIterable} v2 Second async-iterable source. * @param {AsyncIterable} v3 Third async-iterable source. * @param {AsyncIterable} v4 Fourth async-iterable source. * @param {AsyncIterable} v5 Fifth async-iterable source. * @param {AsyncIterable} v6 Sixth async-iterable source. * @returns {(OperatorAsyncFunction)} An async-iterable sequence that contains the elements of each * given sequence, in sequential order. */ export function concatWith( v2: AsyncIterable, v3: AsyncIterable, v4: AsyncIterable, v5: AsyncIterable, v6: AsyncIterable ): OperatorAsyncFunction; /** * Concatenates all async-iterable sequences in the given sequences, as long as the previous async-iterable * sequence terminated successfully. * * @template T The type of the elements in the sequences. * @param {...AsyncIterable[]} args The async-iterable sources. * @returns {AsyncIterableX} An async-iterable sequence that contains the elements of each given sequence, in sequential order. */ export function concatWith(...args: AsyncIterable[]): OperatorAsyncFunction { return function concatWithOperatorFunction(source: AsyncIterable) { return new ConcatAsyncIterable([source, ...args]); }; }