UNPKG

linq-extensions

Version:

Linq-like extension methods for JavaScript and TypeScript builtin collections

27 lines 875 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InsertIterable = void 0; const iterable_1 = require("../iterable"); class InsertIterable extends iterable_1.Iterable { constructor(originalIterable, index, iterableToBeInserted) { super(); this.originalIterable = originalIterable; this.index = index; this.iterableToBeInserted = iterableToBeInserted; } *[Symbol.iterator]() { let i = 0; for (const element of this.originalIterable) { if (i !== this.index) { yield element; } else { for (const otherElement of this.iterableToBeInserted) { yield otherElement; } } } } } exports.InsertIterable = InsertIterable; //# sourceMappingURL=insert-iterable.js.map