import { MonoTypeOperatorAsyncFunction } from '../../interfaces.js'; import { RaceAsyncIterable } from '../race.js'; /** * Propagates the async sequence that reacts first. * * @param {...AsyncIterable[]} sources The source sequences. * @return {MonoTypeOperatorAsyncFunction } An async sequence that surfaces either of the given sequences, whichever reacted first. */ export function raceWith( ...sources: AsyncIterable[] ): MonoTypeOperatorAsyncFunction { return function raceWithOperatorFunction(source: AsyncIterable) { return new RaceAsyncIterable([source, ...sources]); }; }