UNPKG

631 BJavaScriptView Raw
1import { IterableX } from './iterablex';
2/**
3 * Creates an iterable from the specified elements.
4 *
5 * @export
6 * @template TSource The type of the elements to create an iterable sequence.
7 * @param {...TSource[]} args The elements to turn into an iterable sequence.
8 * @returns {IterableX<TSource>} The iterable sequence created from the elements.
9 */
10export function of(...args) {
11 return new OfIterable(args);
12}
13export class OfIterable extends IterableX {
14 constructor(args) {
15 super();
16 this._args = args;
17 }
18 *[Symbol.iterator]() {
19 yield* this._args;
20 }
21}
22
23//# sourceMappingURL=of.mjs.map