npm.io
0.1.0 • Published 12 years ago

clist

Licence
MIT
Version
0.1.0
Deps
0
Vulns
0
Weekly
0

A minimal Circular Linked List in javascript

Build Status

This only aims at solving iterating the list, in order to handle transformations use native array methods and reset the data structure.

var CircularList = require('CircularList');

var list = new CircularList([1, 2, 3, 4]);

list.next() // 1
list.next() // 2
list.prev() // 1
list.last() // 4

// Modify list by resetting

list.reset(list.toArray().slice(1)); // [1, 2, 3]

Install

  • bower install CircularList
  • npm install CircularList

Supported environments:

  • node: var CircularList = require('CircularList');
  • browser:
    • AMD: define(['CircularList'], function(CircularList) {});
    • Global: window.CircularList

Run tests

npm install; npm test