UNPKG

@reactivex/ix-esnext-esm

Version:

The Interactive Extensions for JavaScript

25 lines (23 loc) 622 B
import { IterableX } from '../iterablex'; export class SkipLastIterable extends IterableX { constructor(source, count) { super(); this._source = source; this._count = count; } *[Symbol.iterator]() { const q = []; for (const item of this._source) { q.push(item); if (q.length > this._count) { yield q.shift(); } } } } export function skipLast(count) { return function skipLastOperatorFunction(source) { return new SkipLastIterable(source, count); }; } //# sourceMappingURL=skiplast.mjs.map