Generated some basic unit tests for invertObjectToMap via GitHub Copilot.
One of the generated tests failed and surfaced possiblity that object entries could be "lost" if there were duplicate values... which is very often a possiblity. Added invariant to ensure values are unique and no entries are lost. Should be O(1) check so not worried about overhead.