Skip to content

dbengsch/easy-circular-list

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A bad but useful circular list for Javascript

Install it

npm install easy-circular-list

Use it

var CircularList = require('easy-circular-list');
var data = [1, 2, 3];

var list = new CircularList(data);

Functions

list.iterate()

Iterates the pointer of the list forward

list.forward()

Iterates the pointer of the list forward

list.backward()

Iterates the pointer of the list backward

list.rewind()

Iterates to the first element

list.end()

Iterates to the end of the list

list.getSize()

Returns list size

list.getCurrent()

Returns current value

list.getNext()

Iterates to next and returns the value

list.getPrevious()

Iterates to previous and returns the value

list.getArray()

Returns an array representation of the list

list.add(value)

Adds a value to the list

list.remove(value)

Removes a value from the list, updates the pointer accordingly

LICENSE

This library is published under Apache 2 License

About

A simple circular list

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published