export function mapObject, R>( obj: T, fn: (value: T[K], key: K) => R ): { [K in keyof T]: R } { const result = {} as { [K in keyof T]: R } for (const key in obj) { if (Object.hasOwn(obj, key)) { result[key] = fn(obj[key], key) } } return result }