import { IterableX } from '../iterablex.js'; import { MonoTypeOperatorFunction } from '../../interfaces.js'; /** @ignore */ export class EndWithIterable extends IterableX { private _source: Iterable; private _args: TSource[]; constructor(source: Iterable, args: TSource[]) { super(); this._source = source; this._args = args; } *[Symbol.iterator]() { for (const item of this._source) { yield item; } for (const x of this._args) { yield x; } } } /** * Append values to an iterable sequence. * * @template TSource The type of the elements in the source sequence. * @param {...TSource[]} args The values to append to the end of the iterable sequence. * @returns {MonoTypeOperatorFunction} An operator which appends values to the end of the sequence. */ export function endWith(...args: TSource[]): MonoTypeOperatorFunction { return function endsWithOperatorFunction(source: Iterable): IterableX { return new EndWithIterable(source, args); }; }