utility function to apply defaults to an options object