Working with Javascript Objects without mutating them