/** * If the specified key is not already associated with a value in this map, computes * its value using the given mapping function and enters it into this map. * * @param map - map from which to get the key's value or compute and associate * @param key - key for which to get the value or with which the computed value is to be associated * @param mappingFunction - function to compute a value for key */ export declare const computeIfAbsent: (map: Map, key: K, mappingFunction: (key: K) => V) => V; /** * Create a new Map by associating the value of mapper executed for each key in the source map. * * @param map - source map * @param mapper - function to compute a value in the resulting map for the source key and value */ export declare const mapMap: (map: ReadonlyMap, mapper: (value: V, key: K) => M) => Map; /** * Create a new Map by associating the value of mapper executed for each key in the source map. * * @param map - source map * @param mapper - asynchronous function to compute a value in the resulting map for the source key and value */ export declare const mapMapAsync: (map: ReadonlyMap, mapper: (value: V, key: K) => Promise) => Promise>; /** * Create a new Map by associating the value of each key with mapper executed for each key in the source map. * The opposite of mapMap. In the event two source keys map to the same result key, the second source key's * value will overwrite the first, in which case the cardinality of the returned map may be smaller than the * source map's. * * @param map - source map * @param mapper - function to compute a key in the resulting map for the source key and value */ export declare const mapKeys: (map: ReadonlyMap, mapper: (key: K, value: V) => K2) => Map; /** * Create a new Map from each member of keys to the corresponding member of values. * * @example * ``` * zipToMap([1, 2], ['a', 'b']) => Map({1: 'a', 2: 'b'}) * ``` * * @param keys - keys * @param values - corresponding ordered values for keys */ export declare const zipToMap: (keys: readonly K[], values: readonly V[]) => Map; /** * Create a new Map by inverting keys and values of specified map. * * @param map - map to invert */ export declare const invertMap: (map: ReadonlyMap) => Map; /** * Execute a reducer function on each element of the source map, resulting in a single output value. * * @param map - source map * @param reducer - reducer function that takes an accumulated value, current iteration value, and current * iteration key and returns a new accumulated value * @param initialValue - initial accumulated value */ export declare const reduceMap: (map: ReadonlyMap, reducer: (accumulator: A, value: V, key: K) => A, initialValue: A) => A; /** * Execute an asynchronous reducer function on each element of the source map, resulting in a single output value. * Note that this does not parallelize asynchronous reduce steps so it should be used with caution. * * @param map - source map * @param reducer - asynchronous reducer function that takes an accumulated value, current iteration value, and * current iteration key and returns a new accumulated value * @param initialValue - initial accumulated value */ export declare const reduceMapAsync: (map: ReadonlyMap, reducer: (accumulator: A, value: V, key: K) => Promise, initialValue: A) => Promise; /** * Create a new Map containing all elements from the source map that pass the provided test predicate. * @param map - source map * @param predicate - function to test each element of source map */ export declare function filterMap(map: ReadonlyMap, predicate: (value: V, key: K) => value is S): Map; /** * Create a new Map containing all elements from the source map that pass the provided test predicate. * @param map - source map * @param predicate - function to test each element of source map */ export declare function filterMap(map: ReadonlyMap, predicate: (value: V, key: K) => boolean): Map;