import { AsyncMapper, Mapper, AnyIterable } from 'augmentative-iterable'; import { AsyncItemType, IsAnyOrUnknown, ItemType } from '../base'; import { FluentAsyncIterable, FluentIterable } from '../base'; export type FlattenNoParams = { /** * Projects each element of the iterable to an iterable and flattens the resulting iterable into one iterable.
* Examples:
* * `fluent([['anchor', 'almond'], ['bound', 'alpine']]).flatten()` yields *anchor*, *almond*, *bound* and *alpine*.
* @typeparam R The type of the elements in the inner iterable. * @returns The [[FluentIterable]] of the flattened iterable. */ >(): FluentIterable; }; export type FlattenFunction = { /** * Projects each element of the iterable to an iterable and flattens the resulting iterable into one iterable.
* Examples:
* * `fluent([['anchor', 'almond'], ['bound', 'alpine']]).flatten()` yields *anchor*, *almond*, *bound* and *alpine*.
* * `fluent([ { values: ['anchor', 'almond'] }, { values: ['bound', 'alpine'] }]).flatten(obj => obj.values)` yields *anchor*, *almond*, *bound* and *alpine*. * @typeparam R The type of the elements in the inner iterable. * @param mapper Specifies the projection from the elements of `T` to iterables of `R`. Identity mapping is applied (taking the elements as iterables) if omitted. * @returns The [[FluentIterable]] of the flattened iterable. */ (mapper: Mapper>): FluentIterable; /** * Projects each element of the iterable to an iterable and flattens the resulting iterable into one iterable.
* Examples:
* * `fluent([ { values: ['anchor', 'almond'] }, { values: ['bound', 'alpine'] }]).flatten(obj => obj.values)` yields *anchor*, *almond*, *bound* and *alpine*. * @typeparam R The type of the elements in the inner iterable. * @param mapper Specifies the projection from the elements of `T` to iterables of `R`. Identity mapping is applied (taking the elements as iterables) if omitted. * @returns The [[FluentIterable]] of the flattened iterable. */ >(mapper: K): FluentIterable; } & (T extends Iterable ? FlattenNoParams : IsAnyOrUnknown extends true ? FlattenNoParams : {}); export type AsyncFlattenNoParams = { /** * Projects each element of the iterable to an iterable and flattens the resulting iterable into one iterable.
* Examples:
* * `fluent([['anchor', 'almond'], ['bound', 'alpine']]).flatten()` yields *anchor*, *almond*, *bound* and *alpine*.
* @typeparam R The type of the elements in the inner iterable. * @returns The [[FluentIterable]] of the flattened iterable. */ >(): FluentAsyncIterable; }; export type AsyncFlattenFunction = { /** * Asynchronously projects each element of the iterable to an iterable and flattens the resulting iterable into one iterable. * @typeparam R The type of the elements in the inner iterable. * @param mapper Specifies the asynchronous projection from the elements of `T` to iterables of `R`. * @returns The flattened [[FluentAsyncIterable]]. */ (mapper: AsyncMapper>): FluentAsyncIterable; /** * Asynchronously projects each element of the iterable to an iterable and flattens the resulting iterable into one iterable. * @typeparam R The type of the elements in the inner iterable. * @param mapper Specifies the asynchronous projection from the elements of `T` to iterables of `R`. * @returns The flattened [[FluentAsyncIterable]]. */ >(mapper: K): FluentAsyncIterable; } & (T extends AnyIterable ? AsyncFlattenNoParams : IsAnyOrUnknown extends true ? AsyncFlattenNoParams : {});