@simonlongstaff/linked-list

1.0.7 • Public • Published

Linked List

A TypeScript LinkedList data type implementation with a current node tracking function

Getters

getHead() 
getTail()
getCurrent()
getLenght()

List Manipulation

push(value: object)

Pushes a JSON object on to the bottom of the list

pop()

Removes the last node from the list

shift()

Removes the first node from the list

unshift(value: object)

Pushes a JSON object into the top of the list

insertAtIndex(value: object, index: number)

Pushes a JSON object at the index supplied

removeAtIndex(index: number)

Removes node at index

getAtIndex(index:number)

Returns the JSON of node at index

setAtIndex(value: object, index: number)

Replaces the JSON of node at index

reverse()

Reverses the order of the list

Current Node Tracking

By default, the current node will be set as the head of the list

setCurrent(index:number)

Set the current node as the node at index

next()
previous()

Sets the current node to the next or previous node in the list, does nothing if it is null

Output

toArray()
toString()

Return the values of all nodes in the list as an array or a stringified json

Readme

Keywords

none

Package Sidebar

Install

npm i @simonlongstaff/linked-list

Weekly Downloads

4

Version

1.0.7

License

ISC

Unpacked Size

50.5 kB

Total Files

13

Last publish

Collaborators

  • simonlongstaff