import { AsyncMapper, Mapper } from 'augmentative-iterable'; import { FluentAsyncIterable, FluentIterable } from '../base'; import { Choose } from '../choose'; export interface DistinctFunction { /** * Returns distinct elements from the iterable from a certain projections perspective.
* Examples:
* * `fluent(['anchor', 'almond', 'anchor', 'alpine']).distinct()` yields *anchor*, *almond* and *alpine*
* * `fluent(['anchor', 'almond', 'bound', 'alpine']).distinct(word => word[0])` yields *anchor* and *bound* * @typeparam R The type of the data the element equality is based on. * @param mapper The projection to use to determine element equality. Identity mapping is used if omitted. * @param maxOcurrences The number of accepted occurrences for each item. Default: 1 * @returns The [[FluentIterable]] of the distinct elements. */ (mapper: Mapper, maxOcurrences?: number): FluentIterable; /** * Returns distinct elements from the iterable from a certain projections perspective.
* Examples:
* * `fluent(['anchor', 'almond', 'anchor', 'alpine']).distinct()` yields *anchor*, *almond* and *alpine*
* * `fluent(['anchor', 'almond', 'bound', 'alpine']).distinct(word => word[0])` yields *anchor* and *bound* * @typeparam R The type of the data the element equality is based on. * @param mapper The projection to use to determine element equality. Identity mapping is used if omitted. * @param choose receives two T elements and return the one that must be chosen * @returns The [[FluentIterable]] of the distinct elements. */ (mapper: Mapper, choose: Choose): FluentIterable; /** * Returns distinct elements from the iterable.
* Examples:
* * `fluent(['anchor', 'almond', 'anchor', 'alpine']).distinct()` yields *anchor*, *almond* and *alpine*
* * `fluent(['anchor', 'almond', 'bound', 'alpine']).distinct(word => word[0])` yields *anchor* and *bound* * @typeparam R The type of the data the element equality is based on. * @returns The [[FluentIterable]] of the distinct elements. */ (maxOcurrences?: number): FluentIterable; /** * Returns distinct elements from the iterable from a certain projections perspective.
* Examples:
* * `fluent(['anchor', 'almond', 'anchor', 'alpine']).distinct()` yields *anchor*, *almond* and *alpine*
* * `fluent(['anchor', 'almond', 'bound', 'alpine']).distinct(word => word[0])` yields *anchor* and *bound* * @typeparam R The type of the data the element equality is based on. * @param mapper The projection to use to determine element equality. Identity mapping is used if omitted. * @param maxOcurrences The number of accepted occurrences for each item. Default: 1 * @returns The [[FluentIterable]] of the distinct elements. */ (mapper: R, maxOcurrences?: number): FluentIterable; /** * Returns distinct elements from the iterable from a certain projections perspective.
* Examples:
* * `fluent(['anchor', 'almond', 'anchor', 'alpine']).distinct()` yields *anchor*, *almond* and *alpine*
* * `fluent(['anchor', 'almond', 'bound', 'alpine']).distinct(word => word[0])` yields *anchor* and *bound* * @typeparam R The type of the data the element equality is based on. * @param mapper The projection to use to determine element equality. Identity mapping is used if omitted. * @param choose receives two T elements and return the one that must be chosen * @returns The [[FluentIterable]] of the distinct elements. */ (mapper: R, choose: Choose): FluentIterable; } export interface AsyncDistinctFunction { /** * Returns distinct elements from the iterable from a certain asynchronous projections perspective. * @typeparam R The type of the data the element equality is based on. * @param mapper The asynchronous projection to use to determine element equality. Identity mapping is used if omitted. * @param maxOcurrences The number of accepted occurrences for each item. Default: 1 * @returns The [[FluentAsyncIterable]] of the distinct elements. */ (mapper?: AsyncMapper, maxOcurrences?: number): FluentAsyncIterable; /** * Returns distinct elements from the iterable from a certain asynchronous projections perspective. * @typeparam R The type of the data the element equality is based on. * @param mapper The asynchronous projection to use to determine element equality. Identity mapping is used if omitted. * @param choose receives two T elements and return the one that must be chosen * @returns The [[FluentAsyncIterable]] of the distinct elements. */ (mapper: AsyncMapper, choose: Choose): FluentAsyncIterable; /** * Returns distinct elements from the iterable from a certain asynchronous projections perspective. * @typeparam R The type of the data the element equality is based on. * @param mapper The asynchronous projection to use to determine element equality. Identity mapping is used if omitted. * @param maxOcurrences The number of accepted occurrences for each item. Default: 1 * @returns The [[FluentAsyncIterable]] of the distinct elements. */ (mapper: R, maxOcurrences?: number): FluentAsyncIterable; /** * Returns distinct elements from the iterable from a certain asynchronous projections perspective. * @typeparam R The type of the data the element equality is based on. * @param mapper The asynchronous projection to use to determine element equality. Identity mapping is used if omitted. * @param choose receives two T elements and return the one that must be chosen * @returns The [[FluentAsyncIterable]] of the distinct elements. */ (mapper: R, choose: Choose): FluentAsyncIterable; }