Initial commit

This commit is contained in:
2026-08-24 22:20:36 +02:00
commit 62f7b1278a
251 changed files with 16670 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
const LinkedList = require("../Utility/LinkedList");
class LinkedListNode {
constructor(key, value) {
this.key = key;
this.value = value;
this.next = null;
};
};
class InventoryList extends LinkedList {
constructor() {
super();
};
accumulateItem(key, value) {
const entry = this.map.get(key);
const updatedValue = entry ? entry.value.amount + value.amount : value;
if (entry) entry.value.amount = updatedValue;
else this.addItem(key, updatedValue); /// eeeh
}
addItem(key, value) {
if (!key || !value || !value.categoryID || !value.id || isNaN(value.amount)) return console.info("addItem", key, value);
const temp = new LinkedListNode(key, value);
if (!this.head) {
this.head = temp;
this.tail = temp;
} else {
this.tail.next = temp;
this.tail = temp;
};
this.map.set(key, temp);
}
};
module.exports = InventoryList;