@loupthibault/linkedlist
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -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,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})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t||self).linkedlist=e()}(this,function(){var t=function(){function t(){var t=[].slice.call(arguments);this._head=null,this._tail=null,this._ln=0;var n,i=this._ln=t.length,l=null,a=0;if(1===i)for(i=t[0],l=this._tail=n=new e,a=1;a<i;++a)(n=new e).next=l,l.prev=n,l=n;else if(i>1)for(a=i-1,l=this._tail=n=new e(t[a--]);a>=0;--a)(n=new e(t[a])).next=l,l.prev=n,l=n;this._head=l}var n,i=t.prototype;return i.toArray=function(){var t=new Array(this.length);return this.forEach(function(e,n){return t[n]=e}),t},i.push=function(){for(var t,n=[].slice.call(arguments),i=this,l=n.length,a=-1;++a<l;)(t=new e(n[a])).prev=i._tail,i._tail?i._tail.next=t:i._head=t,i._tail=t;return i._ln+=l,i._ln},i.shift=function(){var t=this;if(t._head){var e=t._head.data;return t._head=t._head.next,--t._ln,null===t._head&&(t._tail=null),e}},i.pop=function(){var t=this;if(t._tail){var e=t._tail.data;return t._tail=t._tail.prev,t._tail.next=null,--t._ln,null===t._tail&&(t._head=null),e}},i.unshift=function(){for(var t,n=[].slice.call(arguments),i=this,l=n.length,a=-1;++a<l;)(t=new e(n[a])).next=i._head,i._head?i._head.prev=t:i._tail=t,i._head=t;return i._ln+=l,i._ln},i.forEach=function(t){for(var e=this.head,n=-1;e;)t(e.data,++n),e=e.next},(n=[{key:"head",get:function(){return this._head}},{key:"tail",get:function(){return this._tail}},{key:"length",get:function(){return this._ln}}])&&function(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)}}(t.prototype,n),t}(),e=function(t){void 0===t&&(t=null),this.next=null,this.prev=null,this.data=t};return t}); |
{ | ||
"name": "@loupthibault/linkedlist", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Javascript Linked List", | ||
"main": "lib/linkedlist.cjs.js", | ||
"module": "lib/linkedlist.esm.js", | ||
"browser": "dist/linkedlist.umd.js", | ||
"source": "src/index.js", | ||
"main": "dist/linkedlist.js", | ||
"exports": "dist/linkedlist.modern.js", | ||
"module": "dist/linkedlist.module.js", | ||
"unpkg": "dist/linkedlist.umd.js", | ||
"scripts": { | ||
"build": "rollup -c", | ||
"dev": "rollup -c -w", | ||
"prepare": "npm run build" | ||
"build": "microbundle build -i src/index.js --compress --no-sourcemap --external none" | ||
}, | ||
"author": "Loup-Rodolphe THIBAULT <loupthibault@gmail.com> (louprodolphethibault.com)", | ||
"author": "Loup-Rodolphe THIBAULT (louprodolphethibault.com)", | ||
"license": "MIT", | ||
"files": [ | ||
"lib", | ||
"dist" | ||
], | ||
"devDependencies": { | ||
"@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.1.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-terser": "^5.1.3" | ||
} | ||
"eslint": "^7.18.0", | ||
"microbundle": "^0.13.0" | ||
}, | ||
"dependencies": {} | ||
} |
@@ -19,5 +19,2 @@ # Linked List | ||
const array = [0, 1, 2, 3, 4, 5]; | ||
// Create Linkedlist | ||
@@ -27,3 +24,3 @@ const linkedlist = new LinkedList(); | ||
// Add values to linked list | ||
array.forEach((value) => linkedlist.push(value)); | ||
[0, 1, 2, 3, 4, 5].forEach(value => linkedlist.push(value)); | ||
@@ -44,2 +41,2 @@ // Parse linked list | ||
Copyright (c) 2019-present, Loup-Rodolphe THIBAULT. | ||
Copyright (c) 2021, Loup-Rodolphe THIBAULT. |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
2
7
8547
26
39
1