import { IterableX } from './iterablex.js'; class AnonymousIterable extends IterableX { private _fn: () => Iterator; constructor(fn: () => Iterator) { super(); this._fn = fn; } [Symbol.iterator]() { return this._fn(); } } /** * Creates a new iterable using the specified function implementing the members of AsyncIterable * * @template T The type of the elements returned by the iterable sequence. * @param {(() => Iterator)} fn The function that creates the [Symbol.iterator]() method * @returns {IterableX} A new iterable instance. */ export function create(getIterator: () => Iterator): IterableX { return new AnonymousIterable(getIterator); }