object-path-immutable
object-path-immutable copied to clipboard
Unexpected value after chaining
When chaining multiple assign
/merge
calls that need to change the object root, I was expecting them all to have an effect. Instead only the last assign
/merge
is applied.
const obj = { a: 1 }
const newObj = immutable(obj).assign(null, { b: 2 }).assign(null, { c: 3 }).value()
Expected output
{
a: 1,
b: 2,
c: 3,
}
Actual output
{
a: 1,
c: 3,
}
If this is expected behavior it might be worth pointing it out in the documentation.