UNPKG

@codibre/fluent-iterable

Version:

Provides LINQ-like fluent api operations for iterables and async iterables (ES2018+).

26 lines (25 loc) 2.01 kB
import { KVGroupTransform } from '../types/base'; import { ItemType } from '../types'; import { Mapper } from 'augmentative-iterable'; /** * Return a transformation function for use in group operation to guarantee distinct elements for each group, following the informed grouping mapper * @param valueDistinctMapper must return the unicity key. The unicity is respected by group */ export declare function getGroupingDistinct<K, T>(valueDistinctMapper: keyof T): KVGroupTransform<K, T>; /** * Return a transformation function for use in group operation to guarantee distinct elements for each group, following the informed grouping mapper * @param valueMapper maps the value for a Iterable of values. Useful if you need to flat map your values per group somehow * @param valueDistinctMapper must return the unicity key. The unicity is respected by group */ export declare function getGroupingDistinct<K, T, KT extends keyof T, NewT extends ItemType<T[KT]> = ItemType<T[KT]>>(valueMapper: KT, valueDistinctMapper: keyof ItemType<T[KT]>): KVGroupTransform<K, T, NewT>; /** * Return a transformation function for use in group operation to guarantee distinct elements for each group, following the informed grouping mapper * @param valueDistinctMapper must return the unicity key. The unicity is respected by group */ export declare function getGroupingDistinct<K, T, NewT>(valueDistinctMapper: Mapper<T, NewT>): KVGroupTransform<K, T, NewT>; /** * Return a transformation function for use in group operation to guarantee distinct elements for each group, following the informed grouping mapper * @param valueMapper maps the value for a Iterable of values. Useful if you need to flat map your values per group somehow * @param valueDistinctMapper must return the unicity key. The unicity is respected by group */ export declare function getGroupingDistinct<K, T, NewT = T[]>(valueMapper: Mapper<T, Iterable<NewT>>, valueDistinctMapper?: Mapper<NewT, unknown> | keyof NewT): KVGroupTransform<K, T, NewT>;