1 | /**
|
2 | * Filter an iterable for values which pass a test.
|
3 | *
|
4 | * @param object - The iterable object of interest.
|
5 | *
|
6 | * @param fn - The predicate function to invoke for each value.
|
7 | *
|
8 | * @returns An iterator which yields the values which pass the test.
|
9 | *
|
10 | * #### Example
|
11 | * ```typescript
|
12 | * import { filter } from '@lumino/algorithm';
|
13 | *
|
14 | * let data = [1, 2, 3, 4, 5, 6];
|
15 | *
|
16 | * let stream = filter(data, value => value % 2 === 0);
|
17 | *
|
18 | * Array.from(stream); // [2, 4, 6]
|
19 | * ```
|
20 | */
|
21 | export declare function filter<T>(object: Iterable<T>, fn: (value: T, index: number) => boolean): IterableIterator<T>;
|