Created
April 23, 2026 13:48
-
-
Save rasmusmerzin/5e0c1f653f1d336a2d835be791f1a8ae to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function mapRecord<K extends string, V1, V2>( | |
| input: Record<K, V1>, | |
| mapper: (value: V1, key: K) => V2, | |
| ): Record<K, V2> { | |
| const entries = Object.entries(input).map(([key, value]) => [key, mapper(value as V1, key as K)]); | |
| return Object.fromEntries(entries); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment