UNPKG

1.05 kBTypeScriptView Raw
1import { IIterator } from './iter';
2/**
3 * Create an empty iterator.
4 *
5 * @returns A new iterator which yields nothing.
6 *
7 * #### Example
8 * ```typescript
9 * import { empty, toArray } from '@phosphor/algorithm';
10 *
11 * let stream = empty<number>();
12 *
13 * toArray(stream); // []
14 * ```
15 */
16export declare function empty<T>(): IIterator<T>;
17/**
18 * An iterator which is always empty.
19 */
20export declare class EmptyIterator<T> implements IIterator<T> {
21 /**
22 * Construct a new empty iterator.
23 */
24 constructor();
25 /**
26 * Get an iterator over the object's values.
27 *
28 * @returns An iterator which yields the object's values.
29 */
30 iter(): IIterator<T>;
31 /**
32 * Create an independent clone of the iterator.
33 *
34 * @returns A new independent clone of the iterator.
35 */
36 clone(): IIterator<T>;
37 /**
38 * Get the next value from the iterator.
39 *
40 * @returns The next value from the iterator, or `undefined`.
41 */
42 next(): T | undefined;
43}