node package manager


Fast linked list with live iterator


Build Status SemVer License

Fast linked list with live iterator. The list can be modified while iterating over the items.

Install with npm

npm install live-list

Browser compatibility

To use this module in a browser, download the npm package and then use Browserify to create a standalone version.


var List = require('live-list').List;
var l = new List();
l.insert(2, 3);
var v, i = l.iterator();
while ((= !== undefined) {

List API

  • length: Reflects the number of items in the list
  • push(value): Appends a value to the list
  • unshift(value): Prepends a value to the list
  • insert(value, before): Inserts a value before another value
  • remove(value): Removes the given value from the list
  • removeAll(): Removes all values from the list
  • toArray(): Returns a new array with all values in the list
  • iterator(): Returns a new Iterator

Iterator API

The iterator is derived from min-iterator and extends the API with these functions:

  • insert(value): Inserts a value into the list before the value returned by the last call to next()
  • remove(): Removes the value from the list that was returned by the last call to next()