source: node_modules/es-toolkit/dist/compat/object/mapKeys.d.ts

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

Added visualizations

  • Property mode set to 100644
File size: 1.4 KB
Line 
1import { ListIteratee } from '../_internal/ListIteratee.js';
2import { ObjectIteratee } from '../_internal/ObjectIteratee.js';
3
4/**
5 * Creates an object with the same values as `object` and keys generated by running each own enumerable string keyed property through `iteratee`.
6 *
7 * @template T
8 * @param {ArrayLike<T> | null | undefined} object - The object to iterate over.
9 * @param {ValueIteratee<T>} [iteratee] - The function invoked per iteration.
10 * @returns {Record<string, T>} - Returns the new mapped object.
11 *
12 * @example
13 * mapKeys([1, 2, 3], (value, index) => `key${index}`);
14 * // => { 'key0': 1, 'key1': 2, 'key2': 3 }
15 */
16declare function mapKeys<T>(object: ArrayLike<T> | null | undefined, iteratee?: ListIteratee<T>): Record<string, T>;
17/**
18 * Creates an object with the same values as `object` and keys generated by running each own enumerable string keyed property through `iteratee`.
19 *
20 * @template T
21 * @param {T | null | undefined} object - The object to iterate over.
22 * @param {ValueIteratee<T[keyof T]>} [iteratee] - The function invoked per iteration.
23 * @returns {Record<string, T[keyof T]>} - Returns the new mapped object.
24 *
25 * @example
26 * mapKeys({ a: 1, b: 2 }, (value, key) => key + value);
27 * // => { 'a1': 1, 'b2': 2 }
28 */
29declare function mapKeys<T extends object>(object: T | null | undefined, iteratee?: ObjectIteratee<T>): Record<string, T[keyof T]>;
30
31export { mapKeys };
Note: See TracBrowser for help on using the repository browser.