1 | import { IterableX } from './iterablex';
|
2 | class AnonymousIterable extends IterableX {
|
3 | constructor(fn) {
|
4 | super();
|
5 | this._fn = fn;
|
6 | }
|
7 | [Symbol.iterator]() {
|
8 | return this._fn();
|
9 | }
|
10 | }
|
11 | /**
|
12 | * Creates an enumerable sequence based on an enumerator factory function.
|
13 | * @param {function(): Iterator<T>} getIterator The iterator factory function.
|
14 | * @return {Iterable<T>} Sequence that will invoke the iterator factory upon a call to [Symbol.iterator]().
|
15 | */
|
16 | export function create(getIterator) {
|
17 | return new AnonymousIterable(getIterator);
|
18 | }
|
19 |
|
20 | //# sourceMappingURL=create.mjs.map
|