A library for linked lists written in Node.js 💯
##Using this library
var LinkedList = require('node_linkedlists');
var list1 = new LinkedList();
There are 6 major prototypes here in this library.
Using our initialized "list1", we can add objects to our list in the following manner:
list1.add('Hello');
list1.add('It's);
list1.add('Me');
list1.add('I');
list1.add('Was');
list1.add('Wondering');
...
console.log(list1.size()); // 6
For this prototype, it takes in an index as a parameter.
list1.remove(1); // removes It's
For this prototype, it takes in some data as a parameter.
list1.findIndexOf("Hello"); // 0
This prototype converts the Linked List to a String
console.log(list1.toString()); //"Hello", "It's", "Me", "I", "Was", "Wondering"
This prototype converts the LinkedList to an array
console.log(list1.toArray()); //["Hello", "It's", "Me","I", "Was". "Wondering"]
This prototype removes all elements from a list
list1.removeAll(); //removes every single element from the list
console.log(list1.size()); // returns 0
This prototype gets the first element in the list
console.log(list1.getFirstElement) //"Hello"
- addAt prototype