UNPKG

typedash

Version:

modern, type-safe collection of utility functions

18 lines (17 loc) 933 B
import { t as CastToString } from "./CastToString-Dm1m4Kgs.js"; import { t as KeysOfUnion } from "./KeysOfUnion-CRGM1li-.js"; //#region src/functions/mapValues/mapValues.d.ts /** * Returns a new object with the same keys as the given object, but with each value mapped to a new value as returned by the given mapper function. * @param object The object to map. * @param mapperFunction The function used to map each value. * @returns A new object with the same keys as the given object, but with each value mapped to a new value as returned by the given mapper function. * @example * ```ts * mapValues({ a: 1, b: 2, c: 3 }, (value) => value * 2) // { a: 2, b: 4, c: 6 } * ``` */ declare function mapValues<T extends object, V>(object: T, mapperFunction: (value: T[keyof T], key: CastToString<KeysOfUnion<T>>) => V): Record<keyof T, V>; //#endregion export { mapValues as t }; //# sourceMappingURL=mapValues-BDq3gSzA.d.ts.map