Non resizable array
Array that don't resize itself when push
and pop
are called.
A separate index is used.
This is usefull in scenarios where the array is under a lot of changes, and can make the garbage collector go crazy (in a game loop for instance).
Installation
$ npm install --save non-resizable-array
Usage
const array = ; array;const value = array; forlet i = 0; i < arraylength; i++ const value = array;
API
array = new NonResizableArray()
Create a new instance.
value = array.peek(index)
Get the value at index
, without modifying the array.
array.push(value)
Push a new value
at the tail of the array.
value = array.pop()
Get the tail value
of the array. Modify the array.
array.clear()
Clear internal array excess. For instance, if you push a 100 items, then remove 50, the excess is 100 - 50 = 50.
array.dispose()
License
MIT, see LICENSE.md for more details.