es-toolkit 1.26.1-dev.861 → 1.26.1-dev.862
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
* by running each own enumerable property of the object through the iteratee function.
|
|
4
4
|
*
|
|
5
5
|
* @template T - The type of the object.
|
|
6
|
-
* @template
|
|
7
|
-
* @template K2 - The type of the new keys generated by the iteratee function.
|
|
6
|
+
* @template K - The type of the new keys generated by the iteratee function.
|
|
8
7
|
*
|
|
9
8
|
* @param {T} object - The object to iterate over.
|
|
10
|
-
* @param {(value: T[
|
|
11
|
-
* @returns {Record<
|
|
9
|
+
* @param {(value: T[keyof T], key: keyof T, object: T) => K} getNewKey - The function invoked per own enumerable property.
|
|
10
|
+
* @returns {Record<K, T[keyof T]>} - Returns the new mapped object.
|
|
12
11
|
*
|
|
13
12
|
* @example
|
|
14
13
|
* // Example usage:
|
|
@@ -16,6 +15,6 @@
|
|
|
16
15
|
* const result = mapKeys(obj, (value, key) => key + value);
|
|
17
16
|
* console.log(result); // { a1: 1, b2: 2 }
|
|
18
17
|
*/
|
|
19
|
-
declare function mapKeys<T extends
|
|
18
|
+
declare function mapKeys<T extends Record<PropertyKey, any>, K extends PropertyKey>(object: T, getNewKey: (value: T[keyof T], key: keyof T, object: T) => K): Record<K, T[keyof T]>;
|
|
20
19
|
|
|
21
20
|
export { mapKeys };
|
package/dist/object/mapKeys.d.ts
CHANGED
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
* by running each own enumerable property of the object through the iteratee function.
|
|
4
4
|
*
|
|
5
5
|
* @template T - The type of the object.
|
|
6
|
-
* @template
|
|
7
|
-
* @template K2 - The type of the new keys generated by the iteratee function.
|
|
6
|
+
* @template K - The type of the new keys generated by the iteratee function.
|
|
8
7
|
*
|
|
9
8
|
* @param {T} object - The object to iterate over.
|
|
10
|
-
* @param {(value: T[
|
|
11
|
-
* @returns {Record<
|
|
9
|
+
* @param {(value: T[keyof T], key: keyof T, object: T) => K} getNewKey - The function invoked per own enumerable property.
|
|
10
|
+
* @returns {Record<K, T[keyof T]>} - Returns the new mapped object.
|
|
12
11
|
*
|
|
13
12
|
* @example
|
|
14
13
|
* // Example usage:
|
|
@@ -16,6 +15,6 @@
|
|
|
16
15
|
* const result = mapKeys(obj, (value, key) => key + value);
|
|
17
16
|
* console.log(result); // { a1: 1, b2: 2 }
|
|
18
17
|
*/
|
|
19
|
-
declare function mapKeys<T extends
|
|
18
|
+
declare function mapKeys<T extends Record<PropertyKey, any>, K extends PropertyKey>(object: T, getNewKey: (value: T[keyof T], key: keyof T, object: T) => K): Record<K, T[keyof T]>;
|
|
20
19
|
|
|
21
20
|
export { mapKeys };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-toolkit",
|
|
3
3
|
"description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
|
|
4
|
-
"version": "1.26.1-dev.
|
|
4
|
+
"version": "1.26.1-dev.862+0b8df186",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|