UNPKG

@reactivex/ix-esnext-esm

Version:

The Interactive Extensions for JavaScript

27 lines (25 loc) 639 B
import { IterableX } from '../iterablex'; export class TakeIterable extends IterableX { constructor(source, count) { super(); this._source = source; this._count = count; } *[Symbol.iterator]() { let i = this._count; if (i > 0) { for (const item of this._source) { yield item; if (--i === 0) { break; } } } } } export function take(count) { return function takeOperatorFunction(source) { return new TakeIterable(source, count); }; } //# sourceMappingURL=take.mjs.map