1 | import { IterableX } from './iterablex';
|
2 | class ChainIterable extends IterableX {
|
3 | constructor(result) {
|
4 | super();
|
5 | this._result = result;
|
6 | }
|
7 | [Symbol.iterator]() {
|
8 | return this._result[Symbol.iterator]();
|
9 | }
|
10 | }
|
11 | /**
|
12 | * Returns an iterable sequence that is the result of invoking the selector on the source sequence,
|
13 | * without sharing subscriptions. This operator allows for a fluent style of writing queries that use
|
14 | * the same sequence multiple times.
|
15 | * @param {Iterable<TSource>} source Source sequence that will be shared in the selector function.
|
16 | * @param {function(source: Iterable<TSource>): Iterable<TResult>} selector Selector function which can use
|
17 | * the source sequence as many times as needed, without sharing subscriptions to the source sequence.
|
18 | * @returns An iterable sequence that contains the elements of a sequence produced by multicasting the source
|
19 | * sequence within a selector function.
|
20 | */
|
21 | export function chain(source, selector) {
|
22 | return new ChainIterable(selector(source));
|
23 | }
|
24 |
|
25 | //# sourceMappingURL=chain.mjs.map
|