@josharsh/linkedlistjs

1.0.0 • Public • Published

LinkedlistJs

Linked list data structure using functional javascript.

About

Implement a singly linked list with ease in functional JS.

Installation

npm install linkedlistjs

How to Use

var harshlist =require("LinkedList")
harshlist.append(10);
harshlist.append(20);
harshlist.append(30);
harshlist.append(40);
harshlist.append(50);
harshlist.append(60);

// Log the length of Linked List
console.log(harshlist.len());

//Map each values in the linked list
harshlist.map((dataItem)=>{
    console.log(dataItem);
})

// Convert to an Array
console.log(harshlist.toArray());

Methods:

  • .append(): Adds a new item to list
  • .len(): Gets the size of the list
  • .map(): maps through each item in list
  • .exists(): checks if an item exists
  • .toArray(): converts list to an Array.

Package Sidebar

Install

npm i @josharsh/linkedlistjs

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

39.2 kB

Total Files

7

Last publish

Collaborators

  • josharsh