1.0.5 • Published 3 years ago

list-singly-linked v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

Singly Linked List data structure implementation

Usage

const LinkedList = require('list-singly-linked');

const list = new LinkedList(); // creates a new Linked List object

list.push(value) // appends a new tail node with given value

list.unshift(value) // appends a new head node with given value

list.pop() // removes the tail node from list and returns the removed node's value

list.shift() // removes the head from list and returns the removed node's value

list.get(index) // returns the node, defined by index

list.findIndex(callback) // returns the index of the first element in the list, that satisfies the provided testing callback function.
// Otherwise, it returns -1, indicating that no element passed the test

list.find(callback) // returns the value of the first element in the provided array that satisfies the provided testing function.
// If no values satisfy the testing function, undefined is returned.

list.length // the length of the list

Install

$ npm install list-singly-linked

License

ISC

1.0.5

3 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago