1 | import { AsyncIterableX } from './asynciterablex';
|
2 | import { throwIfAborted } from '../aborterror';
|
3 | export class OfAsyncIterable extends AsyncIterableX {
|
4 | constructor(args) {
|
5 | super();
|
6 | this._args = args;
|
7 | }
|
8 | async *[Symbol.asyncIterator](signal) {
|
9 | throwIfAborted(signal);
|
10 | for (const item of this._args) {
|
11 | yield item;
|
12 | }
|
13 | }
|
14 | }
|
15 | /**
|
16 | * Creates an async-iterable from the specified elements.
|
17 | *
|
18 | * @export
|
19 | * @template TSource The type of the elements to create an async-iterable sequence.
|
20 | * @param {...TSource[]} args The elements to turn into an async-iterable sequence.
|
21 | * @returns {AsyncIterableX<TSource>} The async-iterable sequence created from the elements.
|
22 | */
|
23 | export function of(...args) {
|
24 | return new OfAsyncIterable(args);
|
25 | }
|
26 |
|
27 | //# sourceMappingURL=of.mjs.map
|