Package Exports
- cyclist
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cyclist) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Cyclist
Cyclist is an efficient cyclic list implemention for Javascript. It is available through npm
npm install cyclist
Usage
var cyclist = require('cyclist');
var list = cyclist(4); // the size of the buffer should be a 2 magnitude
// this buffer can now hold 4 elements in total
list.put(42, 'hello 42'); // store something and index 42
list.put(43, 'hello 43'); // store something and index 43
console.log(list.get(42)); // prints hello 42
console.log(list.get(46)); // prints hello 42 again since 46 - 42 == list.size
You can use .fit(minElementsCount)
to make sure the buffer can fit a certain
amount of elements after it has been created.
list.fit(16); // list can now hold at least 16 elements
API
cyclist(minSize)
creates a new buffercyclist#get(index)
get an object stored in the buffercyclist#put(index,value)
insert an object into the buffercyclist#del(index)
delete an object from an indexcyclist#fit(minSize)
resize the buffer if size is less than minSizecyclist#size
property containing current size of buffer
License
MIT