Raynos / observ-array

An array containing observable values
MIT License
26 stars 4 forks source link

allow 'put' of values beyond current length #10

Closed mmckegg closed 10 years ago

mmckegg commented 10 years ago

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.

Raynos commented 10 years ago

:+1:

Raynos commented 10 years ago

Published v1.3.0

Raynos commented 10 years ago

Added you as a collabator.