queue-typed 2.4.2 → 2.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/cjs/index.cjs +7 -7
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs-legacy/index.cjs +8 -7
  4. package/dist/cjs-legacy/index.cjs.map +1 -1
  5. package/dist/esm/index.mjs +7 -7
  6. package/dist/esm/index.mjs.map +1 -1
  7. package/dist/esm-legacy/index.mjs +8 -7
  8. package/dist/esm-legacy/index.mjs.map +1 -1
  9. package/dist/types/data-structures/base/iterable-element-base.d.ts +1 -1
  10. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +5 -5
  11. package/dist/types/data-structures/binary-tree/bst.d.ts +1 -1
  12. package/dist/types/data-structures/binary-tree/tree-map.d.ts +10 -0
  13. package/dist/types/data-structures/binary-tree/tree-set.d.ts +10 -0
  14. package/dist/types/data-structures/graph/directed-graph.d.ts +2 -2
  15. package/dist/types/data-structures/graph/undirected-graph.d.ts +2 -2
  16. package/dist/types/data-structures/hash/hash-map.d.ts +2 -2
  17. package/dist/types/data-structures/heap/heap.d.ts +3 -7
  18. package/dist/types/types/data-structures/binary-tree/avl-tree.d.ts +1 -1
  19. package/dist/types/types/data-structures/binary-tree/red-black-tree.d.ts +1 -1
  20. package/dist/types/types/data-structures/linked-list/doubly-linked-list.d.ts +1 -1
  21. package/dist/types/types/data-structures/linked-list/singly-linked-list.d.ts +1 -1
  22. package/dist/types/types/data-structures/priority-queue/priority-queue.d.ts +1 -1
  23. package/dist/types/types/data-structures/stack/stack.d.ts +1 -1
  24. package/dist/umd/queue-typed.js +8 -7
  25. package/dist/umd/queue-typed.js.map +1 -1
  26. package/dist/umd/queue-typed.min.js +1 -1
  27. package/dist/umd/queue-typed.min.js.map +1 -1
  28. package/package.json +2 -2
  29. package/src/data-structures/base/iterable-element-base.ts +2 -2
  30. package/src/data-structures/binary-tree/binary-tree.ts +8 -7
  31. package/src/data-structures/binary-tree/bst.ts +1 -1
  32. package/src/data-structures/binary-tree/tree-map.ts +16 -0
  33. package/src/data-structures/binary-tree/tree-multi-set.ts +5 -5
  34. package/src/data-structures/binary-tree/tree-set.ts +16 -0
  35. package/src/data-structures/graph/abstract-graph.ts +18 -18
  36. package/src/data-structures/graph/directed-graph.ts +4 -4
  37. package/src/data-structures/graph/map-graph.ts +1 -1
  38. package/src/data-structures/graph/undirected-graph.ts +4 -4
  39. package/src/data-structures/hash/hash-map.ts +6 -4
  40. package/src/data-structures/heap/heap.ts +17 -14
  41. package/src/data-structures/linked-list/doubly-linked-list.ts +4 -4
  42. package/src/data-structures/linked-list/singly-linked-list.ts +15 -9
  43. package/src/data-structures/queue/deque.ts +1 -1
  44. package/src/data-structures/stack/stack.ts +1 -1
  45. package/src/data-structures/trie/trie.ts +10 -5
  46. package/src/types/data-structures/binary-tree/avl-tree.ts +1 -1
  47. package/src/types/data-structures/binary-tree/red-black-tree.ts +1 -1
  48. package/src/types/data-structures/linked-list/doubly-linked-list.ts +1 -1
  49. package/src/types/data-structures/linked-list/singly-linked-list.ts +1 -1
  50. package/src/types/data-structures/priority-queue/priority-queue.ts +1 -1
  51. package/src/types/data-structures/stack/stack.ts +1 -1
@@ -651,7 +651,7 @@ var SinglyLinkedList = class extends LinearLinkedBase {
651
651
  static {
652
652
  __name(this, "SinglyLinkedList");
653
653
  }
654
- _equals = Object.is;
654
+ _equals = /* @__PURE__ */ __name((a, b) => Object.is(a, b), "_equals");
655
655
  /**
656
656
  * Create a SinglyLinkedList and optionally bulk-insert elements.
657
657
  * @remarks Time O(N), Space O(N)
@@ -755,8 +755,8 @@ var SinglyLinkedList = class extends LinearLinkedBase {
755
755
  return value2;
756
756
  }
757
757
  let current = this.head;
758
- while (current.next !== this.tail) current = current.next;
759
- const value = this.tail.value;
758
+ while (current.next && current.next !== this.tail) current = current.next;
759
+ const value = this.tail?.value;
760
760
  current.next = void 0;
761
761
  this._tail = current;
762
762
  this._length--;
@@ -844,8 +844,8 @@ var SinglyLinkedList = class extends LinearLinkedBase {
844
844
  at(index) {
845
845
  if (index < 0 || index >= this._length) return void 0;
846
846
  let current = this.head;
847
- for (let i = 0; i < index; i++) current = current.next;
848
- return current.value;
847
+ for (let i = 0; i < index && current; i++) current = current.next;
848
+ return current?.value;
849
849
  }
850
850
  /**
851
851
  * Type guard: check whether the input is a SinglyLinkedListNode.
@@ -865,7 +865,7 @@ var SinglyLinkedList = class extends LinearLinkedBase {
865
865
  getNodeAt(index) {
866
866
  if (index < 0 || index >= this._length) return void 0;
867
867
  let current = this.head;
868
- for (let i = 0; i < index; i++) current = current.next;
868
+ for (let i = 0; i < index && current; i++) current = current.next;
869
869
  return current;
870
870
  }
871
871
  /**
@@ -1710,7 +1710,7 @@ var Deque = class extends LinearBase {
1710
1710
  static {
1711
1711
  __name(this, "Deque");
1712
1712
  }
1713
- _equals = Object.is;
1713
+ _equals = /* @__PURE__ */ __name((a, b) => Object.is(a, b), "_equals");
1714
1714
  /**
1715
1715
  * Create a Deque and optionally bulk-insert elements.
1716
1716
  * @remarks Time O(N), Space O(N)