Circular linked lists
Switch branches/tags
Nothing to show
Latest commit 81c3af1 Feb 20, 2015 @hughsk 0.0.2
Failed to load latest commit information. first commit Aug 11, 2013
index.js Fix `.each` Feb 20, 2015
package.json 0.0.2 Feb 20, 2015


A circular linked list, quickly whipped up based on the implementation in jcoglan's article.

Useful in place of an array when you don't need indexing but you do need to be able add/remove elements really quickly.


npm install circular-list


LinkedList = require('circular-list')

The linked list class definition.

var list = new LinkedList

Creates a new linked list, which you can add/remove nodes from.

var node = new LinkedList.Node(data)

Nodes are used to represent an item in the list. These are just wrappers so you don't have to modify the original object. They contain first and last properties so that they can be traversed, and a data property which contains the original value passed to the node.


Appends a node to the end of a list.

list.insert(before, after)

Inserts the after node after before in the list.


Removes a node from the list.


Iterates over the list, calling iterator( for each node.