Array-Model
Extension of native Array object to make it a collection model. But it still real Array. So you can you can just wrap any exist Array in your project.
Installation
via npm
npm install array-model
Usage
Just create a array, call method .model()
and you will have great collection object.
Simple example prevents addition of objects with wrong type.
var arr = ;arr; arr;console; // [42]arr;console; // [42]arr;console; // [42, 24]
Events work great even with assignments.
var arr = 123arr;arr;arr1 = 4// 2, 1// 4, 1
Array-Model provides useful getters for you!
var arr = 123;arr;console; // [1,4,9]console; // 9
See more examples in spec.coffee
.
What Array-Model cannot do for you
Assignment to not exist values. It will not work and probably break your object.
var arr = ;arr;arr0 = 'data';