UNPKG

ix

Version:

The Interactive Extensions for JavaScript

32 lines (30 loc) 907 B
import { IterableX } from '../iterablex.mjs'; /** @ignore */ export class StartWithIterable extends IterableX { constructor(source, args) { super(); this._source = source; this._args = args; } *[Symbol.iterator]() { for (const x of this._args) { yield x; } for (const item of this._source) { yield item; } } } /** * Prepend a value to an iterable sequence. * * @template TSource The type of the elements in the source sequence. * @param {...TSource[]} args Elements to prepend to the specified sequence. * @returns {MonoTypeOperatorFunction<TSource>} The source sequence prepended with the specified values. */ export function startWith(...args) { return function startWithOperatorFunction(source) { return new StartWithIterable(source, args); }; } //# sourceMappingURL=startwith.mjs.map