import { AnyMap, ItemInMap } from "../types"; /** * Creates a new map populated with every key in `keys` where the value * behind each `k` in `keys` is `callback(map[k])`. * * ```tsx * mapPartialMap({ a: 1, b: 2, c: 3 }, ["a", "c"], (n) => n * 2); * //=> { * // a: 2, * // c: 6, * // } * ``` * * @param map The original map. * @param keys The keys to include in the new map. * @param callback A function that takes a single argument `map[k]` and returns the value of `newMap[k]`. * @returns A new `map` where `map[k]` is the result of `callback(map[k])`. */ export default function mapPartialMap(map: M, keys: Array, callback: (item: ItemInMap) => T): Record;