Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@loupthibault/linkedlist

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loupthibault/linkedlist - npm Package Compare versions

Comparing version 0.1.0 to 0.1.2

2

dist/linkedlist.umd.js

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).LinkedList=e()}(this,function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var n=function(){function n(){t(this,n),this._head=null,this._tail=null,this._length=0;var e,h=this._length=arguments.length,a=null,l=0;if(1===h)for(h=arguments.length<=0?void 0:arguments[0],a=this._tail=e=new i,l=1;l<h;++l)(e=new i).next=a,a.prev=e,a=e;else if(h>1){var r;for(l=h-1,a=this._tail=e=new i((r=l--)<0||arguments.length<=r?void 0:arguments[r]);l>=0;--l)(e=new i(l<0||arguments.length<=l?void 0:arguments[l])).next=a,a.prev=e,a=e}this._head=a}var h,a,l;return h=n,(a=[{key:"getArray",value:function(){var t=new Array(this._length);return this.forEach(function(e,n){return t[n]=e}),t}},{key:"push",value:function(){for(var t,e,n=arguments.length,h=-1;++h<n;)t=h<0||arguments.length<=h?void 0:arguments[h],(e=new i(t)).prev=this._tail,this._tail?this._tail.next=e:this._head=e,this._tail=e;this._length+=n}},{key:"shift",value:function(){if(this._head){var t=this._head.data;return this._head=this._head.next,--this._length,null===this._head&&(this._tail=null),t}}},{key:"pop",value:function(){if(this._tail){var t=this._tail.data;return this._tail=this._tail.prev,this._tail.next=null,--this._length,null===this._tail&&(this._head=null),t}}},{key:"unshift",value:function(){for(var t,e,n=arguments.length,h=-1;++h<n;)t=h<0||arguments.length<=h?void 0:arguments[h],(e=new i(t)).next=this._head,this._head?this._head.prev=e:this._tail=e,this._head=e;this._length+=n}},{key:"forEach",value:function(t){for(var e=this.head,n=-1;e;)t(e.data,++n),e=e.next}},{key:"head",get:function(){return this._head}},{key:"tail",get:function(){return this._tail}},{key:"length",get:function(){return this._length}}])&&e(h.prototype,a),l&&e(h,l),n}(),i=function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;t(this,e),this.next=null,this.prev=null,this.data=n};return n});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).LinkedList=e()}(this,(function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var n=function(){function n(){t(this,n),this._head=null,this._tail=null,this._length=0;var e,h=this._length=arguments.length,l=null,a=0;if(1===h)for(h=arguments.length<=0?void 0:arguments[0],l=this._tail=e=new i,a=1;a<h;++a)(e=new i).next=l,l.prev=e,l=e;else if(h>1){var r;for(a=h-1,l=this._tail=e=new i((r=a--)<0||arguments.length<=r?void 0:arguments[r]);a>=0;--a)(e=new i(a<0||arguments.length<=a?void 0:arguments[a])).next=l,l.prev=e,l=e}this._head=l}var h,l,a;return h=n,(l=[{key:"getArray",value:function(){var t=new Array(this._length);return this.forEach((function(e,n){return t[n]=e})),t}},{key:"push",value:function(){for(var t,e,n=arguments.length,h=-1;++h<n;)t=h<0||arguments.length<=h?void 0:arguments[h],(e=new i(t)).prev=this._tail,this._tail?this._tail.next=e:this._head=e,this._tail=e;return this._length+=n,this._length}},{key:"shift",value:function(){if(this._head){var t=this._head.data;return this._head=this._head.next,--this._length,null===this._head&&(this._tail=null),t}}},{key:"pop",value:function(){if(this._tail){var t=this._tail.data;return this._tail=this._tail.prev,this._tail.next=null,--this._length,null===this._tail&&(this._head=null),t}}},{key:"unshift",value:function(){for(var t,e,n=arguments.length,h=-1;++h<n;)t=h<0||arguments.length<=h?void 0:arguments[h],(e=new i(t)).next=this._head,this._head?this._head.prev=e:this._tail=e,this._head=e;return this._length+=n,this._length}},{key:"forEach",value:function(t){for(var e=this.head,n=-1;e;)t(e.data,++n),e=e.next}},{key:"head",get:function(){return this._head}},{key:"tail",get:function(){return this._tail}},{key:"length",get:function(){return this._length}}])&&e(h.prototype,l),a&&e(h,a),n}(),i=function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;t(this,e),this.next=null,this.prev=null,this.data=n};return n}));

@@ -27,5 +27,5 @@ 'use strict';

len = values[0];
head = this._tail = newNode = new LinkedListNode();
head = this._tail = newNode = new LLNode();
for (i = 1; i < len; ++i) {
newNode = new LinkedListNode();
newNode = new LLNode();
newNode.next = head;

@@ -39,5 +39,5 @@ head.prev = newNode;

i = len - 1;
head = this._tail = newNode = new LinkedListNode(values[i--]);
head = this._tail = newNode = new LLNode(values[i--]);
for (; i >= 0; --i) {
newNode = new LinkedListNode(values[i]);
newNode = new LLNode(values[i]);
newNode.next = head;

@@ -54,21 +54,3 @@ head.prev = newNode;

// -
[Symbol.iterator]() {
var node, nextNode;
node = nextNode = this.head;
return {
next: () => {
node = nextNode;
if (node) {
nextNode = node.next;
return { value: node.data, done: false };
}
else {
return { value: null, done: true };
}
}
};
}
getArray() {

@@ -109,3 +91,3 @@ var array = new Array(this._length);

arg = args[i];
newNode = new LinkedListNode(arg);
newNode = new LLNode(arg);
newNode.prev = this._tail;

@@ -122,2 +104,4 @@

this._length += numArgs;
return this._length;
}

@@ -172,3 +156,3 @@

arg = args[i];
newNode = new LinkedListNode(arg);
newNode = new LLNode(arg);
newNode.next = this._head;

@@ -185,4 +169,5 @@

this._length += numArgs;
this._length += numArgs;
return this._length;
}

@@ -203,3 +188,3 @@

class LinkedListNode {
class LLNode {

@@ -206,0 +191,0 @@ constructor(data = null) {

@@ -25,5 +25,5 @@ class LinkedList {

len = values[0];
head = this._tail = newNode = new LinkedListNode();
head = this._tail = newNode = new LLNode();
for (i = 1; i < len; ++i) {
newNode = new LinkedListNode();
newNode = new LLNode();
newNode.next = head;

@@ -37,5 +37,5 @@ head.prev = newNode;

i = len - 1;
head = this._tail = newNode = new LinkedListNode(values[i--]);
head = this._tail = newNode = new LLNode(values[i--]);
for (; i >= 0; --i) {
newNode = new LinkedListNode(values[i]);
newNode = new LLNode(values[i]);
newNode.next = head;

@@ -52,21 +52,3 @@ head.prev = newNode;

// -
[Symbol.iterator]() {
var node, nextNode;
node = nextNode = this.head;
return {
next: () => {
node = nextNode;
if (node) {
nextNode = node.next;
return { value: node.data, done: false };
}
else {
return { value: null, done: true };
}
}
};
}
getArray() {

@@ -107,3 +89,3 @@ var array = new Array(this._length);

arg = args[i];
newNode = new LinkedListNode(arg);
newNode = new LLNode(arg);
newNode.prev = this._tail;

@@ -120,2 +102,4 @@

this._length += numArgs;
return this._length;
}

@@ -170,3 +154,3 @@

arg = args[i];
newNode = new LinkedListNode(arg);
newNode = new LLNode(arg);
newNode.next = this._head;

@@ -183,4 +167,5 @@

this._length += numArgs;
this._length += numArgs;
return this._length;
}

@@ -201,3 +186,3 @@

class LinkedListNode {
class LLNode {

@@ -204,0 +189,0 @@ constructor(data = null) {

{
"name": "@loupthibault/linkedlist",
"version": "0.1.0",
"version": "0.1.2",
"description": "Javascript Linked List",

@@ -20,10 +20,10 @@ "main": "lib/linkedlist.cjs.js",

"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"rollup": "^1.17.0",
"@babel/core": "^7.7.7",
"@babel/preset-env": "^7.7.7",
"rollup": "^1.28.0",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-commonjs": "^10.0.1",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-terser": "^5.1.1"
"rollup-plugin-terser": "^5.1.3"
}
}

@@ -10,3 +10,3 @@ # Linked List

### Install
```
```sh
npm i @loupthibault/linkedlist

@@ -17,3 +17,3 @@ ```

```
```js
import LinkedList from '@loupthibault/linkedlist';

@@ -20,0 +20,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc