Skip to content

Get update and updateDeep to work on list-like objects

Compare
Choose a tag to compare
@m-mujica m-mujica released this 23 Oct 18:15
· 17 commits to master since this release

This patch release fixes .update and updateDeep behavior when called on list-like objects.

The following code was throwing an exception due to both methods always calling canReflect.updateMap and canReflect.updateDeepMap under the hood even if the caller was an array.

class MyArray extends mixinMapProps(Array) {}

let arr = new MyArray();
arr.push(1, 2, 3, 4);
assert.equal(arr.length, 4); 

arr.updateDeep([]); // throws an exception
assert.equal(arr.length, 0);