JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 25
  • Score
    100M100P100Q61735F
  • License Apache-2.0

An easy circular list

Package Exports

  • easy-circular-list

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (easy-circular-list) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

A simple circular list implementation for Javascript

Why yet another one ?

I needed to have an iterable list with not too crappy performances; searched, found nothing, did it myself.

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