import { type PrimativeKey, type ReadKeyFunction } from '../key'; import { type Maybe } from '../value/maybe.type'; /** * Maps the values of the input array to a Map, keyed by the result of a key function. * Optionally transforms each value using a value function. * * @param values - source array of items to map * @param keyFn - function to extract a key from each item * @param valueFn - optional function to transform each item into the desired map value * @returns a Map of keys to values derived from the input array */ export declare function arrayToMap(values: T[], keyFn: ReadKeyFunction, valueFn: (t: T) => V): Map, V>; export declare function arrayToMap(values: T[], keyFn: ReadKeyFunction, valueFn: (t: T) => T): Map, T>; export declare function arrayToMap(values: T[], keyFn: ReadKeyFunction): Map, T>; /** * Maps the values of the input array to a Record object, keyed by the result of a key function. * Items with undefined keys are omitted. Optionally transforms each value using a value function. * * @param values - source array of items to map * @param keyFn - function to extract a key from each item * @param valueFn - optional function to transform each item into the desired record value * @returns a Record of keys to values derived from the input array */ export declare function arrayToObject(values: T[], keyFn: ReadKeyFunction, valueFn: (t: T) => V): Record; export declare function arrayToObject(values: T[], keyFn: ReadKeyFunction, valueFn: (t: T) => T): Record; export declare function arrayToObject(values: T[], keyFn: ReadKeyFunction): Record; /** * Returns values for each key, reusing existing items when available and generating new ones for missing keys. * * @param keys - the keys to resolve values for * @param existing - array of pre-existing items to check against * @param readKey - function to extract a key from an existing item * @param generateFn - function to create a new item for a key not found in existing items * @returns an array of items corresponding to each input key, in the same order */ export declare function generateIfDoesNotExist(keys: K[], existing: T[], readKey: ReadKeyFunction, generateFn: (key: K) => T): T[];