source: node_modules/es-toolkit/dist/object/mapValues.d.mts

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 924 bytes
RevLine 
[a762898]1/**
2 * Creates a new object with the same keys as the given object, but with values generated
3 * by running each own enumerable property of the object through the iteratee function.
4 *
5 * @template T - The type of the object.
6 * @template K - The type of the keys in the object.
7 * @template V - The type of the new values generated by the iteratee function.
8 *
9 * @param {T} object - The object to iterate over.
10 * @param {(value: T[K], key: K, object: T) => V} getNewValue - The function invoked per own enumerable property.
11 * @returns {Record<K, V>} - Returns the new mapped object.
12 *
13 * @example
14 * // Example usage:
15 * const obj = { a: 1, b: 2 };
16 * const result = mapValues(obj, (value) => value * 2);
17 * console.log(result); // { a: 2, b: 4 }
18 */
19declare function mapValues<T extends object, K extends keyof T, V>(object: T, getNewValue: (value: T[K], key: K, object: T) => V): Record<K, V>;
20
21export { mapValues };
Note: See TracBrowser for help on using the repository browser.