@codibre/fluent-iterable
Version:
Provides LINQ-like fluent api operations for iterables and async iterables (ES2018+).
27 lines (26 loc) • 1.71 kB
TypeScript
import { KVGroupTransform } from '../types/base';
import { Mapper } from 'augmentative-iterable';
import { AnyMapper } from '../types-internal';
import { Choose } from '../types';
/**
* Returns a functions that make the group operations to get only one item, per group key,
* The item kept is the preferred one, according to a given choosing criteria,
* @param choose must return the preferred value over two provided
*/
export declare function getGroupingTopHit<K, T>(choose: Choose<T>): KVGroupTransform<K, T>;
/**
* Returns a functions that make the group operations get distinct items, according to a giving criteria,
* keeping the preferred one, according to a given choosing criteria,
* @param distinct must return the distinction key. The distinction is respected by group
* @param choose must return the preferred value over two provided
* @param mapper The property name you want to map for the value
*/
export declare function getGroupingTopHit<K, T, KT extends keyof T>(distinct: AnyMapper<T>, choose: Choose<T[KT]>, mapper: KT): KVGroupTransform<K, T, T[KT][]>;
/**
* Returns a functions that make the group operations get distinct items, according to a giving criteria,
* keeping the preferred one, according to a given choosing criteria,
* @param distinct must return the distinction key. The distinction is respected by group
* @param choose must return the preferred value over two provided
* @param mapper If informed, the mapping operation to define the grouping value. If not, the original value is assumed
*/
export declare function getGroupingTopHit<K, T, NewT = T>(distinct: AnyMapper<T>, choose: Choose<NewT>, mapper?: Mapper<T, NewT>): KVGroupTransform<K, T, NewT>;