/** * Converts the values of a `Map` to an array. * * @param map - The `Map` to convert. * @returns - An array containing the values of the `Map`. * @template T - The type of the values in the Map. */ export declare function mapValuesToArray(map: Map): T[]; /** * Returns an array containing all the keys from a given `Map`. * * @param map - The `Map` from which to extract the keys. * @returns - An array containing all the keys from the map. * @template T - The type of the keys in the map. */ export declare function mapKeysToArray(map: Map): T[]; /** * Converts a `Map` object to an array of key-value pairs. * * @param map - The `Map` object to convert. * @returns - An array of key-value pairs from the `Map`. * @template K - The type of the keys in the `Map`. * @template T - The type of the values in the `Map`. */ export declare function mapEntriesToArray(map: Map): [K, T][]; /** * Converts a `Map` to an object. * * @param map - The `Map` to convert. * @returns An object with keys and values from the `Map`. * @template K - The type of the keys in the `Map`. * @template T - The type of the values in the `Map`. */ export declare function mapToObject(map: Map): Record; /** * Sets a key-value pair in a `Map` if the key does not already exist. * * @param map The map to modify. * @param key The key to set in the map. * @param value The value to set in the map. * @returns The modified map. * @template K The type of the map's keys. * @template T The type of the map's values. * @throws If the map already has a value for the given key. */ export declare function setInMapIfNotExists(map: Map, key: K, value: T): Map; /** * Merges two maps and returns a new map. * * If the `override` parameter is provided and set to `'override'`, the values from `map2` will override the values from * `map` for the same keys. * * If the `override` parameter is not provided or set to any other value, the values from `map2` will only be added to * the new map if the keys do not already exist in `map`. * * @param map - The first map to merge. * @param map2 - The second map to merge. * @param override - _(optional)_ Specifies whether to override values from `map` with values from `map2`. * @returns A new map that is a merge of `map` and `map2`. * @template K The type of the keys in the maps. * @template T The type of the values in the maps. */ export declare function returnAMergeWith(map: Map, map2: Map, override?: 'override'): Map; /** * Puts an array of values into a map, using a key handler function to determine the keys. * * If the `override` parameter is provided and set to `'override'`, existing values in the map with the same keys will * be overridden. * * If the `override` parameter is not provided or set to any other value, existing values in the map with the same keys * will be preserved. * * @param map - The map to put the values into. * @param array - The array of values to put into the map. * @param keyHandler - The function that determines the keys for the values. * @param override - _(optional)_ If provided and set to `'override'`, existing values with the same keys will be overridden. * @returns - The updated map with the values from the array. * @template T - The type of values in the array. * @template K - The type of keys in the map. */ export declare function putArrayInMap(map: Map, array: T[], keyHandler: (item: T) => K, override?: 'override'): Map; /** * Puts array items into a map by applying a handler function to each item. * * If the `override` parameter is provided and set to `'override'`, existing map entries will be overridden. * * If the `override` parameter is not provided or set to any other value, existing map entries will be preserved. * * @param map - The map to put the array items into. * @param array - The array of items to put into the map. * @param itemHandler - The handler function to apply to each item in the array. * @param override - _(optional)_ If set to `'override'`, existing map entries will be overridden. Default is undefined. * @returns - The updated map with the array items added. * @template T - The type of values stored in the map. * @template K - The type of keys used in the map. * @template A - The type of items in the array. */ export declare function putArrayItemsInMap(map: Map, array: A[], itemHandler: (item: A) => [K, T], override?: 'override'): Map; /** * Merges two maps into a new `Map`. * * @param a - The first map to merge. * @param b - The second map to merge. * @param override - _(optional)_ Specifies whether to override values in the first map with values from the second map. If not provided, values from the second map will only be added if they don't already exist in the first map. * @returns - The merged map. * @template K1 - The type of keys in the first map. * @template K2 - The type of keys in the second map. * @template T1 - The type of values in the first map. * @template T2 - The type of values in the second map. */ export declare function mergeMaps(a: Map, b: Map, override?: 'override'): Map; /** * Converts a `Map` of `Sets` to a `Map` of `Arrays`. * * @param map - The `Map` of `Sets` to be converted. * @returns A new Map with the `Sets` converted to `Arrays`. * @template K - The type of the keys in the `Map`. * @template T - The type of the values in the `Sets`. */ export declare function fromMapOfSetsToMapsOfArrays(map: Map>): Map; /** * Creates a `Map` from an array of items, using a key handler function to determine the keys. * * @param array - The array of items. * @param keyHandler - The function that determines the keys for the Map. * @param override - _(optional)_ parameter to specify whether to override existing values in the Map. * @returns - The resulting Map with keys and corresponding items from the array. * @template T - The type of the items in the array. * @template K - The type of the keys in the resulting `Map`. */ export declare function mapFromArray(array: T[], keyHandler: (item: T) => K, override?: 'override'): Map; /** * Creates a new `Map` object from an array by applying a transformation function to each item. * The transformation function should return an array with two elements: the key and the value for the `Map` entry. * If the `override` parameter is set to `'override'`, existing entries with the same key will be overwritten. * * @param array The input array. * @param itemHandler The transformation function to apply to each item in the array. * @param override - _(optional)_ Specifies whether to override existing entries with the same key. Default is undefined. * @returns - A new `Map` object with the transformed entries from the input array. * @template T The type of the elements in the input array. * @template K The type of the keys in the resulting Map. * @template TT The type of the values in the resulting Map. */ export declare function mapFromArrayWithValues(array: T[], itemHandler: (item: T) => [K, TT], override?: 'override'): Map; /** * Creates a `Map` of arrays from an input array, using a key handler function. * * @param array - The input array. * @param keyHandler - The function that extracts the key from each element in the input array. * @returns - The resulting Map of arrays, where each key maps to an array of elements with that key. * @template T - The type of elements in the input array. * @template K - The type of keys in the resulting Map. */ export declare function mapOfArraysFromArray(array: T[], keyHandler: (item: T) => K): Map; /** * Merges two maps of arrays into a single map of arrays. * The resulting map contains unique values from both input maps. * * @param a - The first map to merge. * @param b - The second map to merge. * @returns - The merged map of arrays. * @template K1 - The type of keys in the first map. * @template K2 - The type of keys in the second map. * @template T1 - The type of values in the arrays of the first map. * @template T2 - The type of values in the arrays of the second map. */ export declare function mergeMapsOfArrays(a: Map, b: Map): Map;