( obj: Record<string, T>, map: (key: string, value: T) => [string, T], )
| 35 | }; |
| 36 | |
| 37 | export const mapEntries = <T>( |
| 38 | obj: Record<string, T>, |
| 39 | map: (key: string, value: T) => [string, T], |
| 40 | ): Record<string, T> => { |
| 41 | const result = Object.fromEntries( |
| 42 | Object.entries(obj).map(([key, val]) => { |
| 43 | const [newKey, newVal] = map(key, val); |
| 44 | return [newKey, newVal]; |
| 45 | }), |
| 46 | ); |
| 47 | return result; |
| 48 | }; |
| 49 | |
| 50 | export const customMapEntries = <TReturn, T = any>( |
| 51 | obj: Record<string, T>, |
no outgoing calls
no test coverage detected