Loading homepage
Input: invertObject({ first: "red", second: "green" }) Output: { red: "first", green: "second" }
Input: invertObject({ one: 1, two: 2 }) Output: { "1": "one", "2": "two" }
Input: invertObject({ first: "same", last: "same" }) Output: { same: "last" }
Input: invertObject({ numeric: 1, text: "1" }) Output: { "1": "text" }
Input: invertObject({}) Output: {}
invertObject(object) accepts one object with string or number values and returns an object with string keys and string values. TypeScript uses Readonly<Record<string, string | number>> for the input and Record<string, string> for the result. Numeric values become property-name strings. The last entry visited by Object.entries wins when values collide.