import { AsyncMapper, Mapper } from 'augmentative-iterable'; import { FluentIterable, FluentAsyncIterable } from '../base'; export interface MapFunction { /** * Transforms the iterable of `T` into an iterable of `R` by mapping all elements to an element of `R`.
* Example: `fluent(['anchor', 'almond', 'bound', 'alpine']).map(word => word.toUpperCase())` yields *ANCHOR*, *ALMOND*, *BOUND* and *ALPINE*. * @typeparam R The destination type of the mapping. * @param mapper The operation which maps an instance of `T` into an instance of `R`. * @returns A [[FluentIterable]] of the mapped elements. */ (mapper: Mapper): FluentIterable; /** * Transforms the iterable of `T` into an iterable of `R` by mapping all elements to an element of `R`.
* Example: `fluent(['anchor', 'almond', 'bound', 'alpine']).map(word => word.toUpperCase())` yields *ANCHOR*, *ALMOND*, *BOUND* and *ALPINE*. * @typeparam R The destination type of the mapping. * @param mapper The operation which maps an instance of `T` into an instance of `R`. * @returns A [[FluentIterable]] of the mapped elements. */ (mapper: R): FluentIterable; } export interface AsyncMapFunction { /** * Transforms the iterable of `T` into an iterable of `R` by mapping all elements to an element of `R`. * @typeparam R The destination type of the mapping. * @param mapper The asynchronous operation which maps an instance of `T` into an instance of `R`. * @returns A [[FluentAsyncIterable]] of the mapped elements. */ (mapper: AsyncMapper): FluentAsyncIterable; /** * Transforms the iterable of `T` into an iterable of `R` by mapping all elements to an element of `R`. * @typeparam R The destination type of the mapping. * @param mapper The asynchronous operation which maps an instance of `T` into an instance of `R`. * @returns A [[FluentAsyncIterable]] of the mapped elements. */ (mapper: R): FluentAsyncIterable; }