UNPKG

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