kolodny / immutability-helper

mutate a copy of data without changing the original source
MIT License
5.17k stars 186 forks source link

When use $set to set a string with spaces, it doesn't works #152

Closed dengxiao0509 closed 4 years ago

dengxiao0509 commented 4 years ago

e.g.

const obj = {a: '123'}

const obj2 = update(obj, { a: { $set: '123 ', } })

console.log(obj === obj2) // true

It seems that helper considers '123' is equal to '123 '? But that results in failing getting a new obj reference, any solution?

kolodny commented 4 years ago

This seems to be working as expected in runkit: https://runkit.com/embed/mq5zkzqv3y2z

image