When using an $accumulator is it safe to "modify" the existing state and return it?

Hi everyone. Thanks for the $accumulator - it’s amazing. We are building some amazing things with it, in combination with the group aggregation step. It feels like super-powers!

I was wondering, if it’s safe to do something like the following, where the state is mutated and then returned:

function accumulateFn(someState) {
  someState.fooBar = 2;
  return someState;
}
// vs
function accumulateFn(someState) {
  return {
    fooBar: 2
  }
}

(I have some pretty complex $accumulator’s that would be very simple to maintain, if I can do something like state.path.to.some.object += 3; return state;. Thanks in advance :+1: