swapObjectKeys¶
Overview¶
Swap the values of two keys on an object, but only if the value is defined
@example swapObjectKeys( { x: 4,y: 3 }, 'x', 'y' ) -> { x: 4, y:3 } swapObjectKeys( { x: 4 }, 'x', 'y' ) -> { y:4 } swapObjectKeys( { x: 4, y: undefined }, 'x', 'y' ) -> { x: undefined, y:4 } swapObjectKeys( { otherStuff: 'hi' }, 'x', 'y' ) -> { otherStuff: 'hi' }
@author Michael Kauzmann (PhET Interactive Simulations)
Source Code¶
See the source for swapObjectKeys.ts in the phet-core repository.