Closed Xiot closed 1 month ago
Just noticed that there is a PR that addresses this https://github.com/toss/es-toolkit/pull/556
Hello, thanks for your report. We merged the pull request. https://github.com/toss/es-toolkit/blob/main/src/object/merge.ts#L98
Can you check if es-toolkit@1.22.0-dev.706
works for you?
es-toolkit@1.22.0-dev.706
seems to fix the issue.
Thanks
I found some unexpected behaviour with the
merge
function.It appears that when values are merged, there are cases where it just copies the reference to the source object.
which produces
This seems to be what is responsible https://github.com/toss/es-toolkit/blob/main/src/object/merge.ts#L98
The same code using the
merge
method from lodash producesAt least in my eyes, the one from
lodash
seems more correct, since thesource
is never mutated.Curious to hear your thoughts on if this is intentional, and if so, what is the reasoning.