UNPKG

@reactivex/ix-es5-esm

Version:

The Interactive Extensions for JavaScript

52 lines (50 loc) 1.91 kB
import { __extends, __generator } from "tslib"; import { IterableX } from '../iterablex.js'; /** @ignore */ var SkipIterable = /** @class */ (function (_super) { __extends(SkipIterable, _super); function SkipIterable(source, count) { var _this = _super.call(this) || this; _this._source = source; _this._count = count; return _this; } SkipIterable.prototype[Symbol.iterator] = function () { var it, count, next; return __generator(this, function (_a) { switch (_a.label) { case 0: it = this._source[Symbol.iterator](); count = this._count; while (count > 0 && !(next = it.next()).done) { count--; } if (!(count <= 0)) return [3 /*break*/, 3]; _a.label = 1; case 1: if (!!(next = it.next()).done) return [3 /*break*/, 3]; return [4 /*yield*/, next.value]; case 2: _a.sent(); return [3 /*break*/, 1]; case 3: return [2 /*return*/]; } }); }; return SkipIterable; }(IterableX)); export { SkipIterable }; /** * Bypasses a specified number of elements in an iterable sequence and then returns the remaining elements. * * @template TSource The type of the elements in the source sequence. * @param {number} count The number of elements to skip before returning the remaining elements. * @returns {MonoTypeOperatorFunction<TSource>} An iterable sequence that contains the elements that * occur after the specified index in the input sequence. */ export function skip(count) { return function skipOperatorFunction(source) { return new SkipIterable(source, count); }; } //# sourceMappingURL=skip.js.map