UNPKG

ix

Version:

The Interactive Extensions for JavaScript

35 lines (33 loc) 1.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.range = void 0; const tslib_1 = require("tslib"); const asynciterablex_js_1 = require("./asynciterablex.js"); const aborterror_js_1 = require("../aborterror.js"); class RangeAsyncIterable extends asynciterablex_js_1.AsyncIterableX { constructor(start, count) { super(); this._start = start; this._count = count; } [Symbol.asyncIterator](signal) { return tslib_1.__asyncGenerator(this, arguments, function* _a() { (0, aborterror_js_1.throwIfAborted)(signal); for (let current = this._start, end = this._start + this._count; current < end; current++) { yield yield tslib_1.__await(current); } }); } } /** * Generates an async-iterable sequence of integral numbers within a specified range. * * @param {number} start The value of the first integer in the sequence. * @param {number} count The number of sequential integers to generate. * @returns {AsyncIterableX<number>} An async-iterable sequence that contains a range of sequential integral numbers. */ function range(start, count) { return new RangeAsyncIterable(start, count); } exports.range = range; //# sourceMappingURL=range.js.map