From 7096e77bd8f0257888b74e7877e7c5eda1f18140 Mon Sep 17 00:00:00 2001 From: Rajkumar Dusad Date: Wed, 26 Apr 2023 14:07:37 +0530 Subject: [PATCH] bug fixes --- package.json | 2 +- src/fifo.cjs | 1 - src/fifo.mjs | 1 - src/lifo.cjs | 1 - src/lifo.mjs | 1 - src/linkedlist/index.cjs | 12 +++--------- src/linkedlist/index.mjs | 12 +++--------- src/lru.cjs | 1 - src/lru.mjs | 1 - src/mru.cjs | 1 - src/mru.mjs | 1 - 11 files changed, 7 insertions(+), 27 deletions(-) diff --git a/package.json b/package.json index 77101c7..bbf2de8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@opensnip/cachejs", - "version": "1.0.2", + "version": "1.0.3", "description": "Fast and lightweight caching library for javascript", "main": "index.mjs", "type": "module", diff --git a/src/fifo.cjs b/src/fifo.cjs index 17bfafd..9b24b89 100644 --- a/src/fifo.cjs +++ b/src/fifo.cjs @@ -1,5 +1,4 @@ const LinkedList = require("./linkedlist/index.cjs"); -const Node = require("./linkedlist/node.cjs"); module.exports = class FIFO { #linkedList = null; diff --git a/src/fifo.mjs b/src/fifo.mjs index eadf28d..475b4b3 100644 --- a/src/fifo.mjs +++ b/src/fifo.mjs @@ -1,5 +1,4 @@ import LinkedList from "./linkedlist/index.mjs"; -import Node from "./linkedlist/node.mjs"; export default class FIFO { #linkedList = null; diff --git a/src/lifo.cjs b/src/lifo.cjs index 549918a..9c1f97e 100644 --- a/src/lifo.cjs +++ b/src/lifo.cjs @@ -1,5 +1,4 @@ const LinkedList = require("./linkedlist/index.cjs"); -const Node = require("./linkedlist/node.cjs"); module.exports = class LIFO { #linkedList = null; diff --git a/src/lifo.mjs b/src/lifo.mjs index d12e298..ee23615 100644 --- a/src/lifo.mjs +++ b/src/lifo.mjs @@ -1,5 +1,4 @@ import LinkedList from "./linkedlist/index.mjs"; -import Node from "./linkedlist/node.mjs"; export default class LIFO { #linkedList = null; diff --git a/src/linkedlist/index.cjs b/src/linkedlist/index.cjs index 3eaf209..5457d7d 100644 --- a/src/linkedlist/index.cjs +++ b/src/linkedlist/index.cjs @@ -140,12 +140,8 @@ module.exports = class LinkedList { if (rightNode === this.#head) this.#head = tmpLeft; if (rightNode === this.#tail) this.#tail = tmpLeft; - delete leftNode.next; - delete leftNode.prev; - delete leftNode.value; - delete rightNode.next; - delete rightNode.prev; - delete rightNode.value; + leftNode = null; + rightNode = null; return [tmpLeft, tmpRight]; } @@ -171,9 +167,7 @@ module.exports = class LinkedList { delete(node) { this.detach(node); - delete node.prev; - delete node.next; - delete node.value; + node = null; } detach(node) { diff --git a/src/linkedlist/index.mjs b/src/linkedlist/index.mjs index aa004ae..5e4991d 100644 --- a/src/linkedlist/index.mjs +++ b/src/linkedlist/index.mjs @@ -140,12 +140,8 @@ export default class LinkedList { if (rightNode === this.#head) this.#head = tmpLeft; if (rightNode === this.#tail) this.#tail = tmpLeft; - delete leftNode.next; - delete leftNode.prev; - delete leftNode.value; - delete rightNode.next; - delete rightNode.prev; - delete rightNode.value; + leftNode = null; + rightNode = null; return [tmpLeft, tmpRight]; } @@ -171,9 +167,7 @@ export default class LinkedList { delete(node) { this.detach(node); - delete node.prev; - delete node.next; - delete node.value; + node = null; } detach(node) { diff --git a/src/lru.cjs b/src/lru.cjs index a671d3d..6ae3843 100644 --- a/src/lru.cjs +++ b/src/lru.cjs @@ -1,5 +1,4 @@ const LinkedList = require("./linkedlist/index.cjs"); -const Node = require("./linkedlist/node.cjs"); module.exports = class LRU { #linkedList = null; diff --git a/src/lru.mjs b/src/lru.mjs index 3169ad3..18afa0a 100644 --- a/src/lru.mjs +++ b/src/lru.mjs @@ -1,5 +1,4 @@ import LinkedList from "./linkedlist/index.mjs"; -import Node from "./linkedlist/node.mjs"; export default class LRU { #linkedList = null; diff --git a/src/mru.cjs b/src/mru.cjs index 8abb9c1..5b0ac49 100644 --- a/src/mru.cjs +++ b/src/mru.cjs @@ -1,5 +1,4 @@ const LinkedList = require("./linkedlist/index.cjs"); -const Node = require("./linkedlist/node.cjs"); module.exports = class MRU { #linkedList = null; diff --git a/src/mru.mjs b/src/mru.mjs index 53e9fd9..926b449 100644 --- a/src/mru.mjs +++ b/src/mru.mjs @@ -1,5 +1,4 @@ import LinkedList from "./linkedlist/index.mjs"; -import Node from "./linkedlist/node.mjs"; export default class MRU { #linkedList = null;