Socket
Socket
Sign inDemoInstall

doubly-linked-list-js

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    doubly-linked-list-js

A DoublyLinkedList JavaScript Universal Module


Version published
Weekly downloads
30
increased by7.14%
Maintainers
1
Install size
16.9 kB
Created
Weekly downloads
 

Readme

Source

doubly-linked-list-js

A DoublyLinkedList Javascript Universal Module.

Installation

You may install this package using bower or npm:

bower install doubly-linked-list-js --save

npm install doubly-linked-list-js --save

Usage

Node.js

var
	DoublyLinkedList = require('doubly-linked-list-js');

var
	list = new DoublyLinkedList();

API

  • forge()
  • forgeCircular()
  • add(data)
  • forEach(iterator, fromData, context)
  • forEachReverse(iterator, fromData, context)
  • getAt(index)
  • getFirst()
  • getIndexOf(data)
  • getLast()
  • getRandom()
  • getLastIndexOf(data)
  • getLength()
  • getNext(data)
  • getPrevious(data)
  • isCircular()
  • isEmpty()
  • makeCircular()
  • makeLinear()
  • removeAt(index)
  • toArray()
  • toString()

forge

var
	list = DoublyLinkedList.forge();

forgeCircular

var
	list = DoublyLinkedList.forgeCircular();

add

list
	.add('a')
	.add('b')
	.add('c');

forEach

var
	array = [];

list.forEach(function (data) {
	array.push(data);
}, 'b');

console.log(array.toString()); // b,c

list
	.makeCircular()
	.forEach(function (data) {
		array.push(data);
	}, 'b');

console.log(array.toString()); // b,c,a

forEachReverse

var
	array = [];

list.forEachReverse(function (data) {
	array.push(data);
}, 'b');

console.log(array.toString()); // b,a

list
	.makeCircular()
	.forEachReverse(function (data) {
		array.push(data);
	}, 'b');

console.log(array.toString()); // b,a,c

FAQs

Last updated on 17 Mar 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc