Minor optimization, you can move `typeof object1Value === 'object'` into the previous if statement and avoid the lookup into `object2`