1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | /**
|
4 | * Create an empty iterator.
|
5 | *
|
6 | * @returns A new iterator which yields nothing.
|
7 | *
|
8 | * #### Example
|
9 | * ```typescript
|
10 | * import { empty, toArray } from '@phosphor/algorithm';
|
11 | *
|
12 | * let stream = empty<number>();
|
13 | *
|
14 | * toArray(stream); // []
|
15 | * ```
|
16 | */
|
17 | function empty() {
|
18 | return new EmptyIterator();
|
19 | }
|
20 | exports.empty = empty;
|
21 | /**
|
22 | * An iterator which is always empty.
|
23 | */
|
24 | var EmptyIterator = /** @class */ (function () {
|
25 | /**
|
26 | * Construct a new empty iterator.
|
27 | */
|
28 | function EmptyIterator() {
|
29 | }
|
30 | /**
|
31 | * Get an iterator over the object's values.
|
32 | *
|
33 | * @returns An iterator which yields the object's values.
|
34 | */
|
35 | EmptyIterator.prototype.iter = function () {
|
36 | return this;
|
37 | };
|
38 | /**
|
39 | * Create an independent clone of the iterator.
|
40 | *
|
41 | * @returns A new independent clone of the iterator.
|
42 | */
|
43 | EmptyIterator.prototype.clone = function () {
|
44 | return new EmptyIterator();
|
45 | };
|
46 | /**
|
47 | * Get the next value from the iterator.
|
48 | *
|
49 | * @returns The next value from the iterator, or `undefined`.
|
50 | */
|
51 | EmptyIterator.prototype.next = function () {
|
52 | return undefined;
|
53 | };
|
54 | return EmptyIterator;
|
55 | }());
|
56 | exports.EmptyIterator = EmptyIterator;
|