You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

node-linkedlist

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-linkedlist - npm Package Compare versions

Comparing version
0.1.1
to
0.1.3
+13
-6
package.json
{
"name": "node-linkedlist",
"version": "0.1.1",
"version": "0.1.3",
"description": "Double linked list features",

@@ -9,3 +9,5 @@ "main": "index.js",

},
"dependencies": {},
"dependencies": {
"ring": "2.1.0"
},
"devDependencies": {

@@ -17,2 +19,3 @@ "should": "*",

"test": [
"TestAddSingleNodeObjectToList.js",
"TestCleanUpList.js",

@@ -30,9 +33,13 @@ "TestCustomNodeBackwardTraversing.js",

"keywords": [
"unary tree",
"structures",
"lists",
"linked list",
"lists",
"structures",
"unary tree"
"doubly linked list"
],
"author": "Sven Mueller",
"author": {
"name": "Sven Mueller",
"email": "svenmue@localdomain.org"
},
"license": "LGPL-3.0"
}
+116
-52

@@ -27,5 +27,7 @@ <h1>LinkedList</h1>

<h4>size</h4>
The number of nodes linked to each other in a row.
<b>Example</b>
<strong>Example</strong>
```javascript

@@ -38,3 +40,4 @@ var list = require("node-linkedlist").Create()

<a name="setDataType">
<h4>setDataType</h4>
<h4>setDataType(dataType)</h4>
You are not fixed to use ''LinkedList'' as it is with the internal standard node. You can use it to chain

@@ -45,9 +48,11 @@ your own business objects too. The only thing you have to do is to extend the standard node object and publish

bottom of the documentation under <a href="#node">List node</a>
<br/>
<br/>
<strong>Arguments</strong>
<b>Arguments</b>
* `dataType` (constructor) - The constructor of the class extending the standard node object.
* `return` (LinkedList) - The list itself is returned.
<b>Example</b>
<strong>Example</strong>
```javascript

@@ -76,5 +81,7 @@ var LinkedList = require("node-linkedlist")

<a name="add">
<h4>add</h4>
<h4>add(data[, callback])</h4>
Add a new node to the end of the list.
<br/>
<br/>
<b>Arguments</b>

@@ -87,2 +94,3 @@

<b>Example</b>
```javascript

@@ -103,6 +111,8 @@ var LinkedList = require("node-linkedlist")

<a name="searchBy">
<h4>searchBy</h4>
<h4>searchBy(property, value)</h4>
Search a node by one of its properties. If the list contains extended standard nodes it is required to implement
a getter method like ''getFirstName'' or ''getFirstname''.
<br/>
<br/>
<b>Arguments</b>

@@ -115,2 +125,3 @@

<b>Example</b>
```javascript

@@ -126,5 +137,7 @@ var LinkedList = require("node-linkedlist")

<a name="get">
<h4>get</h4>
<h4>get(position[, raw])</h4>
Get a node by a given position.
<br/>
<br/>
<b>Arguments</b>

@@ -134,6 +147,7 @@

the first or last node is returned.
* `raw` (boolean) - A flag to get the node itself instead of the value only. Default is false.
* `raw` (boolean) - A flag to get the node itself instead of the value only. Default is false to get only the value.
* `return` (Node) - The node at the position or first/last node if the position is less/equal 0 or higher than list size.
<b>Example</b>
```javascript

@@ -148,5 +162,7 @@ var LinkedList = require("node-linkedlist")

<a name="delete">
<h4>delete</h4>
<h4>delete(position)</h4>
Delete a node from given position.
<br/>
<br/>
<b>Arguments</b>

@@ -158,2 +174,3 @@

<b>Example</b>
```javascript

@@ -168,5 +185,7 @@ var LinkedList = require("node-linkedlist")

<a name="first">
<h4>first</h4>
<h4>first()</h4>
Get the first node of the list.
<br/>
<br/>
<b>Arguments</b>

@@ -177,2 +196,3 @@

<b>Example</b>
```javascript

@@ -187,5 +207,7 @@ var LinkedList = require("node-linkedlist")

<a name="last">
<h4>last</h4>
<h4>last()</h4>
Get the last node of the list.
<br/>
<br/>
<b>Arguments</b>

@@ -196,2 +218,3 @@

<b>Example</b>
```javascript

@@ -206,5 +229,7 @@ var LinkedList = require("node-linkedlist")

<a name="isStdNode">
<h4>isStdNode</h4>
<h4>isStdNode(node)</h4>
Check if a node is an instance of the internal standard node.
<br/>
<br/>
<b>Arguments</b>

@@ -216,2 +241,3 @@

<b>Example</b>
```javascript

@@ -230,5 +256,7 @@ var LinkedList = require("node-linkedlist")

<a name="clean">
<h4>clean</h4>
<h4>clean()</h4>
Removes all nodes from the list.
<br/>
<br/>
<b>Arguments</b>

@@ -239,2 +267,3 @@

<b>Example</b>
```javascript

@@ -249,5 +278,7 @@ var LinkedList = require("node-linkedlist")

<a name="toArray">
<h4>toArray</h4>
<h4>toArray()</h4>
Converts the list into an array.
<br/>
<br/>
<b>Arguments</b>

@@ -258,2 +289,3 @@

<b>Example</b>
```javascript

@@ -274,3 +306,4 @@ var LinkedList = require("node-linkedlist")

<a name="next">
<h4>next</h4>
<h4>next()</h4>
Get the next node in the list.

@@ -280,3 +313,4 @@

<a name="hasNext">
<h4>hasNext</h4>
<h4>hasNext()</h4>
Check the existence of a next node.

@@ -286,3 +320,4 @@

<a name="previous">
<h4>previous</h4>
<h4>previous()</h4>
Get the previous node in the list.

@@ -292,6 +327,8 @@

<a name="hasPrevious">
<h4>hasPrevious</h4>
<h4>hasPrevious()</h4>
Check the existence of a previous node.
<b>Example</b>
```javascript

@@ -308,3 +345,3 @@ var LinkedList = require("node-linkedlist")

// or backwards
for(node = list.last(); list.HasPrevious(); node.previous()) {
for(node = list.last(); list.hasPrevious(); node.previous()) {
...

@@ -317,6 +354,8 @@ ...

<a name="node">
<h4>node (Constructor)</h4>
<h4>node [Constructor]</h4>
The list node is the standard node object used by the linked list internally if no other node constructor is offered.
You can get it via the property 'node' of the linked list object.
<br/>
<br/>
<b>Arguments</b>

@@ -327,2 +366,3 @@

<b>Example</b>
```javascript

@@ -336,10 +376,13 @@ var list = require("node-linkedlist").Create()

<a name="setNext">
<h4>setNext</h4>
<h4>setNext(nextNode)</h4>
Set another node object as next node to the current one.
<br/>
<br/>
<b>Arguments</b>
* node (object) - A node object of the same datatype of the list.
* nextNode (object) - A node which has to be referenced as next node.
<b>Example</b>
```javascript

@@ -364,5 +407,7 @@ var LinkedList = require("node-linkedlist")

<a name="next">
<h4>next</h4>
<h4>next()</h4>
Get the next node that is referenced to the current node.
<br/>
<br/>
<b>Arguments</b>

@@ -373,2 +418,3 @@

<b>Example</b>
```javascript

@@ -385,5 +431,7 @@ var LinkedList = require("node-linkedlist")

<a name="hasNext">
<h4>hasNext</h4>
<h4>hasNext()</h4>
Check the existence of a next nodes reference.
<br/>
<br/>
<b>Arguments</b>

@@ -394,2 +442,3 @@

<b>Example</b>
```javascript

@@ -407,10 +456,13 @@ var LinkedList = require("node-linkedlist")

<a name="setPrevious">
<h4>setPrevioius</h4>
<h4>setPrevious(previousNode)</h4>
Set another node object as previous node to the current one.
<br/>
<br/>
<b>Arguments</b>
* No arguments
* previousNode (node) - The node which has to be referenced before current node.
<b>Example</b>
```javascript

@@ -437,5 +489,7 @@ var LinkedList = require("node-linkedlist")

<a name="previous">
<h4>previous</h4>
<h4>previous()</h4>
Get the previous node that is referenced to the current node.
<br/>
<br/>
<b>Arguments</b>

@@ -446,2 +500,3 @@

<b>Example</b>
```javascript

@@ -458,5 +513,7 @@ var LinkedList = require("node-linkedlist")

<a name="hasPrevious">
<h4>hasPrevious</h4>
<h4>hasPrevious()</h4>
Check the existence of a previous nodes reference.
<br/>
<br/>
<b>Arguments</b>

@@ -467,2 +524,3 @@

<b>Example</b>
```javascript

@@ -480,11 +538,14 @@ var LinkedList = require("node-linkedlist")

<a name="setValue">
<h4>setValue</h4>
Set the value that is added to the list. This method is used internally so it is fully transparent
<h4>setValue(value)</h4>
Set the value that has to be added to the list. This method is used internally so it is fully transparent
via ''list.add(...)'' if you use the standard node.
<br/>
<br/>
<b>Arguments</b>
* No argument
* value (mixed) - The value that has to be put to a list via a node.
<b>Example</b>
```javascript

@@ -504,6 +565,8 @@ var LinkedList = require("node-linkedlist")

<a name="getValue">
<h4>getValue</h4>
Get the value that is stored in the standard node. This method is used internally so it is fully transparent
<h4>getValue()</h4>
Get the value that is stored in a node. This method is used internally so it is fully transparent
via ''list.get(position)'' if you use the standard node.
<br/>
<br/>
<b>Arguments</b>

@@ -514,2 +577,3 @@

<b>Example</b>
```javascript

@@ -516,0 +580,0 @@ var LinkedList = require("node-linkedlist")

@@ -1,3 +0,1 @@

var _ = require('underscore');
var User = function() {

@@ -85,4 +83,4 @@ this.name = "User";

*
* @param previousNode {ListNode}
* @returns {ListNode}
* @param previousNode {User}
* @returns {User}
*/

@@ -97,3 +95,3 @@ User.prototype.setPrevious = function(previousNode) {

*
* @returns {ListNode}
* @returns {User}
*/

@@ -107,4 +105,4 @@ User.prototype.previous = function() {

*
* @param nextNode {ListNode}
* @returns {ListNode}
* @param nextNode {User}
* @returns {User}
*/

@@ -119,3 +117,3 @@ User.prototype.setNext = function(nextNode) {

*
* @returns {ListNode}
* @returns {User}
*/

@@ -131,3 +129,3 @@ User.prototype.next = function() {

User.prototype.hasNext = function() {
return (!_.isNull(this._next.data) === true);
return (this._next.data !== null);
};

@@ -140,3 +138,3 @@

User.prototype.hasPrevious = function() {
return (_.isNull(this._previous.data) === false);
return (this._previous.data !== null);
};

@@ -143,0 +141,0 @@

@@ -1,3 +0,2 @@

var ring = require('ring')
, _ = require('underscore');
var ring = require('ring');

@@ -18,4 +17,4 @@ var User2 = function() {

*
* @param previousNode {ListNode}
* @returns {ListNode}
* @param previousNode {User}
* @returns {User}
*/

@@ -30,3 +29,3 @@ User2.prototype.setPrevious = function(previousNode) {

*
* @returns {ListNode}
* @returns {User}
*/

@@ -40,4 +39,4 @@ User2.prototype.previous = function() {

*
* @param nextNode {ListNode}
* @returns {ListNode}
* @param nextNode {User}
* @returns {User}
*/

@@ -52,3 +51,3 @@ User2.prototype.setNext = function(nextNode) {

*
* @returns {ListNode}
* @returns {User}
*/

@@ -64,3 +63,3 @@ User2.prototype.next = function() {

User2.prototype.hasNext = function() {
return (!_.isNull(this._next.data) === true);
return (this._next.data !== null);
};

@@ -73,3 +72,3 @@

User2.prototype.hasPrevious = function() {
return (_.isNull(this._previous.data) === false);
return (this._previous.data !== null);
};

@@ -76,0 +75,0 @@