Skip to content
A minimal CircularList for Javascript
JavaScript
Find file
Latest commit 29a066c @nervetattoo Merge pull request #1 from Haraldson/master
Clarify CircularList’s .. circular nature

README.md

A minimal Circular List in javascript

Build Status

This only aims at iterating a 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
list.next() // 1

// 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

Something went wrong with that request. Please try again.