A javascript function, which can runs both in browser and node.js,  to extend an object from other object deeply or not