Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In 2.0.1, nested objects in parameters could be mutated in some circumstances depending on the shape of the other object parameters. I found this extremely unpredictable, and I was sure it was a bug until I looked closely through the source code and found this behaviour was actually specified in the tests.
With my change, the original parameters should now never be mutated. (Apart from the first parameter, which is always mutated, no changes there.)
I think you should merge my pull request because the expected behaviour of the library is that the second parameter and onwards will not be modified at all. The npm description says "Deeply mix the properties of objects into the first object", implying the other objects won't be changed. My pull request makes the library safer and more predictable.
However, since the behaviour is different now, I've increased the version to 3.0.0 so nobody's code would be broken by automated updates if they were relying on the old behaviour.
Fixes #14.
See the tests to see exactly how the behaviour has changed.