Currently arr.put(index, value) is using array.splice(index, 0, value) internally. This works for most cases, except where index > array.length. In this case the value is simply appended to the end instead of filling the space between.
var arr = ObservArray([ Observ("foo"), Observ("bar") ])
arr.put(4, Observ("baz"))
assert.deepEqual(arr(), ["foo", "bar", , , "baz"])
// not ok - actual: ["foo", "bar", "baz"]
This PR adds proper put support based on array[index] = value.
Currently
arr.put(index, value)
is usingarray.splice(index, 0, value)
internally. This works for most cases, except whereindex > array.length
. In this case the value is simply appended to the end instead of filling the space between.This PR adds proper
put
support based onarray[index] = value
.