Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

stack-base-iterator

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stack-base-iterator - npm Package Compare versions

Comparing version
1.2.25
to
1.2.26
+6
-4
dist/cjs/LinkedList.d.cts
export default class LinkedList<T> {
private fifo;
get length(): any;
private head;
private tail;
length: number;
constructor();
last(): T;
push(value: T): LinkedList<T>;
pop(): T;
push(value: T): LinkedList<T>;
remove(value: T): boolean;
remove(value: T): T;
}
export default class LinkedList<T> {
private fifo;
get length(): any;
private head;
private tail;
length: number;
constructor();
last(): T;
push(value: T): LinkedList<T>;
pop(): T;
push(value: T): LinkedList<T>;
remove(value: T): boolean;
remove(value: T): T;
}
+54
-39

@@ -11,3 +11,2 @@ "use strict";

});
var _fifo = /*#__PURE__*/ _interop_require_default(require("fifo"));
function _class_call_check(instance, Constructor) {

@@ -18,21 +17,9 @@ if (!(instance instanceof Constructor)) {

}
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _create_class(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
var Node = function Node(value) {
"use strict";
_class_call_check(this, Node);
this.value = value;
this.prev = null;
this.next = null;
};
var LinkedList = /*#__PURE__*/ function() {

@@ -42,34 +29,62 @@ "use strict";

_class_call_check(this, LinkedList);
this.fifo = new _fifo.default();
this.head = null;
this.tail = null;
this.length = 0;
}
var _proto = LinkedList.prototype;
_proto.last = function last() {
return this.fifo.last();
return this.tail ? this.tail.value : undefined;
};
_proto.pop = function pop() {
return this.fifo.pop();
};
_proto.push = function push(value) {
this.fifo.push(value);
var newNode = new Node(value);
if (!this.head) {
this.head = newNode;
this.tail = newNode;
} else {
newNode.prev = this.tail;
this.tail.next = newNode;
this.tail = newNode;
}
this.length++;
return this;
};
_proto.pop = function pop() {
if (!this.head) return undefined;
var poppedNode = this.tail;
if (this.length === 1) {
this.head = null;
this.tail = null;
} else {
this.tail = poppedNode.prev;
this.tail.next = null;
poppedNode.prev = null;
}
this.length--;
return poppedNode.value;
};
_proto.remove = function remove(value) {
for(var node = this.fifo.node; node; node = this.fifo.next(node)){
if (node.value === value) {
this.fifo.remove(node);
return true;
if (!this.head) return undefined;
var currentNode = this.head;
while(currentNode){
if (currentNode.value === value) {
if (currentNode === this.head) {
this.head = currentNode.next;
if (this.head) this.head.prev = null;
else this.tail = null;
} else if (currentNode === this.tail) {
this.tail = currentNode.prev;
this.tail.next = null;
} else {
currentNode.prev.next = currentNode.next;
currentNode.next.prev = currentNode.prev;
}
this.length--;
return currentNode.value;
}
currentNode = currentNode.next;
}
return false;
return undefined;
};
_create_class(LinkedList, [
{
key: "length",
get: function get() {
return this.fifo.length;
}
}
]);
return LinkedList;
}();
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }

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

{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/stack-base-iterator/src/LinkedList.ts"],"sourcesContent":["import FIFO from 'fifo';\n\nexport default class LinkedList<T> {\n private fifo = new FIFO<T>();\n\n get length() {\n return this.fifo.length;\n }\n last(): T {\n return this.fifo.last();\n }\n pop(): T {\n return this.fifo.pop() as T;\n }\n push(value: T): LinkedList<T> {\n this.fifo.push(value);\n return this;\n }\n remove(value: T): boolean {\n for (let node = this.fifo.node; node; node = this.fifo.next(node)) {\n if (node.value === value) {\n this.fifo.remove(node);\n return true;\n }\n }\n return false;\n }\n}\n"],"names":["LinkedList","fifo","FIFO","last","pop","push","value","remove","node","next","length"],"mappings":";;;;;;;eAEqBA;;;2DAFJ;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,IAAA,AAAMA,2BAAN;;aAAMA;gCAAAA;aACXC,OAAO,IAAIC,aAAI;;iBADJF;IAMnBG,OAAAA,IAEC,GAFDA,SAAAA;QACE,OAAO,IAAI,CAACF,IAAI,CAACE,IAAI;IACvB;IACAC,OAAAA,GAEC,GAFDA,SAAAA;QACE,OAAO,IAAI,CAACH,IAAI,CAACG,GAAG;IACtB;IACAC,OAAAA,IAGC,GAHDA,SAAAA,KAAKC,KAAQ;QACX,IAAI,CAACL,IAAI,CAACI,IAAI,CAACC;QACf,OAAO,IAAI;IACb;IACAC,OAAAA,MAQC,GARDA,SAAAA,OAAOD,KAAQ;QACb,IAAK,IAAIE,OAAO,IAAI,CAACP,IAAI,CAACO,IAAI,EAAEA,MAAMA,OAAO,IAAI,CAACP,IAAI,CAACQ,IAAI,CAACD,MAAO;YACjE,IAAIA,KAAKF,KAAK,KAAKA,OAAO;gBACxB,IAAI,CAACL,IAAI,CAACM,MAAM,CAACC;gBACjB,OAAO;YACT;QACF;QACA,OAAO;IACT;kBAxBmBR;;YAGfU,KAAAA;iBAAJ;gBACE,OAAO,IAAI,CAACT,IAAI,CAACS,MAAM;YACzB;;;WALmBV"}
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/stack-base-iterator/src/LinkedList.ts"],"sourcesContent":["class Node<T> {\n value: T;\n prev: Node<T>;\n next: Node<T>;\n\n constructor(value: T) {\n this.value = value;\n this.prev = null;\n this.next = null;\n }\n}\n\nexport default class LinkedList<T> {\n private head: Node<T>;\n private tail: Node<T>;\n length: number;\n\n constructor() {\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n\n last(): T {\n return this.tail ? this.tail.value : undefined;\n }\n\n push(value: T): LinkedList<T> {\n const newNode = new Node<T>(value);\n if (!this.head) {\n this.head = newNode;\n this.tail = newNode;\n } else {\n newNode.prev = this.tail;\n this.tail.next = newNode;\n this.tail = newNode;\n }\n this.length++;\n return this;\n }\n\n pop(): T {\n if (!this.head) return undefined;\n const poppedNode = this.tail;\n if (this.length === 1) {\n this.head = null;\n this.tail = null;\n } else {\n this.tail = poppedNode.prev;\n this.tail.next = null;\n poppedNode.prev = null;\n }\n this.length--;\n return poppedNode.value;\n }\n\n remove(value: T): T {\n if (!this.head) return undefined;\n\n let currentNode = this.head;\n while (currentNode) {\n if (currentNode.value === value) {\n if (currentNode === this.head) {\n this.head = currentNode.next;\n if (this.head) this.head.prev = null;\n else this.tail = null;\n } else if (currentNode === this.tail) {\n this.tail = currentNode.prev;\n this.tail.next = null;\n } else {\n currentNode.prev.next = currentNode.next;\n currentNode.next.prev = currentNode.prev;\n }\n this.length--;\n return currentNode.value;\n }\n currentNode = currentNode.next;\n }\n return undefined;\n }\n}\n"],"names":["LinkedList","Node","value","prev","next","head","tail","length","last","undefined","push","newNode","pop","poppedNode","remove","currentNode"],"mappings":";;;;;;;eAYqBA;;;;;;;;AAZrB,IAAA,AAAMC,OAAN,SAAMA,KAKQC,KAAQ;;4BALhBD;IAMF,IAAI,CAACC,KAAK,GAAGA;IACb,IAAI,CAACC,IAAI,GAAG;IACZ,IAAI,CAACC,IAAI,GAAG;;AAID,IAAA,AAAMJ,2BAAN;;aAAMA;gCAAAA;QAMjB,IAAI,CAACK,IAAI,GAAG;QACZ,IAAI,CAACC,IAAI,GAAG;QACZ,IAAI,CAACC,MAAM,GAAG;;iBARGP;IAWnBQ,OAAAA,IAEC,GAFDA,SAAAA;QACE,OAAO,IAAI,CAACF,IAAI,GAAG,IAAI,CAACA,IAAI,CAACJ,KAAK,GAAGO;IACvC;IAEAC,OAAAA,IAYC,GAZDA,SAAAA,KAAKR,KAAQ;QACX,IAAMS,UAAU,IAAIV,KAAQC;QAC5B,IAAI,CAAC,IAAI,CAACG,IAAI,EAAE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AACC,IAAI,GAAGW,YAAYX,IAAI;oBACxCW,YAAYX,IAAI,CAACD,IAAI,GAAGY,YAAYZ,IAAI;gBAC1C;gBACA,IAAI,CAACI,MAAM;gBACX,OAAOQ,YAAYb,KAAK;YAC1B;YACAa,cAAcA,YAAYX,IAAI;QAChC;QACA,OAAOK;IACT;WAnEmBT"}
export default class LinkedList<T> {
private fifo;
get length(): any;
private head;
private tail;
length: number;
constructor();
last(): T;
push(value: T): LinkedList<T>;
pop(): T;
push(value: T): LinkedList<T>;
remove(value: T): boolean;
remove(value: T): T;
}

@@ -1,29 +0,68 @@

import FIFO from 'fifo';
let Node = class Node {
constructor(value){
this.value = value;
this.prev = null;
this.next = null;
}
};
let LinkedList = class LinkedList {
get length() {
return this.fifo.length;
}
last() {
return this.fifo.last();
return this.tail ? this.tail.value : undefined;
}
pop() {
return this.fifo.pop();
}
push(value) {
this.fifo.push(value);
const newNode = new Node(value);
if (!this.head) {
this.head = newNode;
this.tail = newNode;
} else {
newNode.prev = this.tail;
this.tail.next = newNode;
this.tail = newNode;
}
this.length++;
return this;
}
pop() {
if (!this.head) return undefined;
const poppedNode = this.tail;
if (this.length === 1) {
this.head = null;
this.tail = null;
} else {
this.tail = poppedNode.prev;
this.tail.next = null;
poppedNode.prev = null;
}
this.length--;
return poppedNode.value;
}
remove(value) {
for(let node = this.fifo.node; node; node = this.fifo.next(node)){
if (node.value === value) {
this.fifo.remove(node);
return true;
if (!this.head) return undefined;
let currentNode = this.head;
while(currentNode){
if (currentNode.value === value) {
if (currentNode === this.head) {
this.head = currentNode.next;
if (this.head) this.head.prev = null;
else this.tail = null;
} else if (currentNode === this.tail) {
this.tail = currentNode.prev;
this.tail.next = null;
} else {
currentNode.prev.next = currentNode.next;
currentNode.next.prev = currentNode.prev;
}
this.length--;
return currentNode.value;
}
currentNode = currentNode.next;
}
return false;
return undefined;
}
constructor(){
this.fifo = new FIFO();
this.head = null;
this.tail = null;
this.length = 0;
}
};
export { LinkedList as default };

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

{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/stack-base-iterator/src/LinkedList.ts"],"sourcesContent":["import FIFO from 'fifo';\n\nexport default class LinkedList<T> {\n private fifo = new FIFO<T>();\n\n get length() {\n return this.fifo.length;\n }\n last(): T {\n return this.fifo.last();\n }\n pop(): T {\n return this.fifo.pop() as T;\n }\n push(value: T): LinkedList<T> {\n this.fifo.push(value);\n return this;\n }\n remove(value: T): boolean {\n for (let node = this.fifo.node; node; node = this.fifo.next(node)) {\n if (node.value === value) {\n this.fifo.remove(node);\n return true;\n }\n }\n return false;\n }\n}\n"],"names":["FIFO","LinkedList","length","fifo","last","pop","push","value","remove","node","next"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AAET,IAAA,AAAMC,aAAN,MAAMA;IAGnB,IAAIC,SAAS;QACX,OAAO,IAAI,CAACC,IAAI,CAACD,MAAM;IACzB;IACAE,OAAU;QACR,OAAO,IAAI,CAACD,IAAI,CAACC,IAAI;IACvB;IACAC,MAAS;QACP,OAAO,IAAI,CAACF,IAAI,CAACE,GAAG;IACtB;IACAC,KAAKC,KAAQ,EAAiB;QAC5B,IAAI,CAACJ,IAAI,CAACG,IAAI,CAACC;QACf,OAAO,IAAI;IACb;IACAC,OAAOD,KAAQ,EAAW;QACxB,IAAK,IAAIE,OAAO,IAAI,CAACN,IAAI,CAACM,IAAI,EAAEA,MAAMA,OAAO,IAAI,CAACN,IAAI,CAACO,IAAI,CAACD,MAAO;YACjE,IAAIA,KAAKF,KAAK,KAAKA,OAAO;gBACxB,IAAI,CAACJ,IAAI,CAACK,MAAM,CAACC;gBACjB,OAAO;YACT;QACF;QACA,OAAO;IACT;;aAvBQN,OAAO,IAAIH;;AAwBrB;AAzBA,SAAqBC,wBAyBpB"}
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/stack-base-iterator/src/LinkedList.ts"],"sourcesContent":["class Node<T> {\n value: T;\n prev: Node<T>;\n next: Node<T>;\n\n constructor(value: T) {\n this.value = value;\n this.prev = null;\n this.next = null;\n }\n}\n\nexport default class LinkedList<T> {\n private head: Node<T>;\n private tail: Node<T>;\n length: number;\n\n constructor() {\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n\n last(): T {\n return this.tail ? this.tail.value : undefined;\n }\n\n push(value: T): LinkedList<T> {\n const newNode = new Node<T>(value);\n if (!this.head) {\n this.head = newNode;\n this.tail = newNode;\n } else {\n newNode.prev = this.tail;\n this.tail.next = newNode;\n this.tail = newNode;\n }\n this.length++;\n return this;\n }\n\n pop(): T {\n if (!this.head) return undefined;\n const poppedNode = this.tail;\n if (this.length === 1) {\n this.head = null;\n this.tail = null;\n } else {\n this.tail = poppedNode.prev;\n this.tail.next = null;\n poppedNode.prev = null;\n }\n this.length--;\n return poppedNode.value;\n }\n\n remove(value: T): T {\n if (!this.head) return undefined;\n\n let currentNode = this.head;\n while (currentNode) {\n if (currentNode.value === value) {\n if (currentNode === this.head) {\n this.head = currentNode.next;\n if (this.head) this.head.prev = null;\n else this.tail = null;\n } else if (currentNode === this.tail) {\n this.tail = currentNode.prev;\n this.tail.next = null;\n } else {\n currentNode.prev.next = currentNode.next;\n currentNode.next.prev = currentNode.prev;\n }\n this.length--;\n return currentNode.value;\n }\n currentNode = currentNode.next;\n }\n return undefined;\n }\n}\n"],"names":["Node","value","prev","next","LinkedList","last","tail","undefined","push","newNode","head","length","pop","poppedNode","remove","currentNode"],"mappings":"AAAA,IAAA,AAAMA,OAAN,MAAMA;IAKJ,YAAYC,KAAQ,CAAE;QACpB,IAAI,CAACA,KAAK,GAAGA;QACb,IAAI,CAACC,IAAI,GAAG;QACZ,IAAI,CAACC,IAAI,GAAG;IACd;AACF;AAEe,IAAA,AAAMC,aAAN,MAAMA;IAWnBC,OAAU;QACR,OAAO,IAAI,CAACC,IAAI,GAAG,IAAI,CAACA,IAAI,CAACL,KAAK,GAAGM;IACvC;IAEAC,KAAKP,KAAQ,EAAiB;QAC5B,MAAMQ,UAAU,IAAIT,KAAQ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AACC,IAAI,GAAGY,YAAYZ,IAAI;oBACxCY,YAAYZ,IAAI,CAACD,IAAI,GAAGa,YAAYb,IAAI;gBAC1C;gBACA,IAAI,CAACS,MAAM;gBACX,OAAOI,YAAYd,KAAK;YAC1B;YACAc,cAAcA,YAAYZ,IAAI;QAChC;QACA,OAAOI;IACT;IA9DA,aAAc;QACZ,IAAI,CAACG,IAAI,GAAG;QACZ,IAAI,CAACJ,IAAI,GAAG;QACZ,IAAI,CAACK,MAAM,GAAG;IAChB;AA2DF;AApEA,SAAqBP,wBAoEpB"}
{
"name": "stack-base-iterator",
"version": "1.2.25",
"version": "1.2.26",
"description": "Base iterator for values retrieved using a stack of async functions returning values",

@@ -42,4 +42,3 @@ "keywords": [

"async-compat": "^1.6.13",
"call-once-fn": "^1.0.18",
"fifo": "^2.4.1"
"call-once-fn": "^1.0.18"
},

@@ -46,0 +45,0 @@ "devDependencies": {