import { IndexedSelector } from "../types/IndexedSelector"; import { MapFactory } from "../types/MapFactory"; /** * Groups elements of a sequence by key, returning a map of iterables per key. * * @typeParam T - Element type produced by the source iterable. * @typeParam TKey - Key type returned by `keySelector`. * @typeParam TValue - Value type stored in each lookup entry when `valueSelector` is supplied. * @param src - Source iterable to partition. * @param keySelector - Projection producing the lookup key for each element. * @param valueSelector - Optional projection producing the value to store per key; defaults to the element itself. * @param mapFactory - Optional factory controlling the concrete map implementation that backs the lookup. * @returns A map in which each key maps to an iterable of the grouped values. * @example * ```ts * const lookup = _toLookup( * ["a", "aa", "bbb"], * (value) => value.length * ); * console.log([...lookup.entries()].map(([k, v]) => [k, [...v]])); * // [[1, ["a"]], [2, ["aa"]], [3, ["bbb"]]] * ``` */ export declare function _toLookup(src: Iterable, keySelector: IndexedSelector, mapFactory?: MapFactory): Map>; export declare function _toLookup(src: Iterable, keySelector: IndexedSelector, valueSelector: IndexedSelector, mapFactory?: MapFactory): Map>; /** * Curried version of {@link _toLookup}. */ export declare function toLookup(keySelector: IndexedSelector, mapFactory?: MapFactory): (src: Iterable) => Map>; export declare function toLookup(keySelector: IndexedSelector, valueSelector: IndexedSelector, mapFactory?: MapFactory): (src: Iterable) => Map>;