data-structure-typed 2.4.3 → 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 (44) hide show
  1. package/.github/workflows/release.yml +27 -0
  2. package/CHANGELOG.md +3 -1
  3. package/README.md +46 -50
  4. package/dist/cjs/index.cjs +27 -35
  5. package/dist/cjs-legacy/index.cjs +28 -35
  6. package/dist/esm/index.mjs +27 -35
  7. package/dist/esm-legacy/index.mjs +28 -35
  8. package/dist/types/data-structures/base/iterable-element-base.d.ts +1 -1
  9. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +5 -5
  10. package/dist/types/data-structures/binary-tree/bst.d.ts +1 -1
  11. package/dist/types/data-structures/graph/directed-graph.d.ts +2 -2
  12. package/dist/types/data-structures/graph/undirected-graph.d.ts +2 -2
  13. package/dist/types/data-structures/hash/hash-map.d.ts +2 -2
  14. package/dist/types/data-structures/heap/heap.d.ts +3 -7
  15. package/dist/types/types/data-structures/binary-tree/avl-tree.d.ts +1 -1
  16. package/dist/types/types/data-structures/binary-tree/red-black-tree.d.ts +1 -1
  17. package/dist/types/types/data-structures/linked-list/doubly-linked-list.d.ts +1 -1
  18. package/dist/types/types/data-structures/linked-list/singly-linked-list.d.ts +1 -1
  19. package/dist/types/types/data-structures/priority-queue/priority-queue.d.ts +1 -1
  20. package/dist/types/types/data-structures/stack/stack.d.ts +1 -1
  21. package/dist/umd/data-structure-typed.js +28 -35
  22. package/dist/umd/data-structure-typed.min.js +4 -4
  23. package/package.json +2 -2
  24. package/src/data-structures/base/iterable-element-base.ts +2 -2
  25. package/src/data-structures/binary-tree/binary-tree.ts +8 -7
  26. package/src/data-structures/binary-tree/bst.ts +1 -1
  27. package/src/data-structures/binary-tree/tree-multi-set.ts +5 -5
  28. package/src/data-structures/graph/abstract-graph.ts +18 -18
  29. package/src/data-structures/graph/directed-graph.ts +4 -4
  30. package/src/data-structures/graph/map-graph.ts +1 -1
  31. package/src/data-structures/graph/undirected-graph.ts +4 -4
  32. package/src/data-structures/hash/hash-map.ts +6 -4
  33. package/src/data-structures/heap/heap.ts +17 -14
  34. package/src/data-structures/linked-list/doubly-linked-list.ts +4 -4
  35. package/src/data-structures/linked-list/singly-linked-list.ts +15 -9
  36. package/src/data-structures/queue/deque.ts +1 -1
  37. package/src/data-structures/stack/stack.ts +1 -1
  38. package/src/data-structures/trie/trie.ts +10 -5
  39. package/src/types/data-structures/binary-tree/avl-tree.ts +1 -1
  40. package/src/types/data-structures/binary-tree/red-black-tree.ts +1 -1
  41. package/src/types/data-structures/linked-list/doubly-linked-list.ts +1 -1
  42. package/src/types/data-structures/linked-list/singly-linked-list.ts +1 -1
  43. package/src/types/data-structures/priority-queue/priority-queue.ts +1 -1
  44. package/src/types/data-structures/stack/stack.ts +1 -1
@@ -1019,8 +1019,9 @@ var LinkedHashMap = class extends IterableEntryBase {
1019
1019
  const cur = node;
1020
1020
  node = node.next;
1021
1021
  if (predicate(cur.key, cur.value, i++, this)) {
1022
- if (isWeakKey(cur.key)) {
1023
- this._objMap.delete(cur.key);
1022
+ const keyToCheck = cur.key;
1023
+ if (isWeakKey(keyToCheck)) {
1024
+ this._objMap.delete(keyToCheck);
1024
1025
  } else {
1025
1026
  const hash = this._hashFn(cur.key);
1026
1027
  delete this._noObjMap[hash];
@@ -1534,7 +1535,7 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1534
1535
  static {
1535
1536
  __name(this, "SinglyLinkedList");
1536
1537
  }
1537
- _equals = Object.is;
1538
+ _equals = /* @__PURE__ */ __name((a, b) => Object.is(a, b), "_equals");
1538
1539
  /**
1539
1540
  * Create a SinglyLinkedList and optionally bulk-insert elements.
1540
1541
  * @remarks Time O(N), Space O(N)
@@ -1638,8 +1639,8 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1638
1639
  return value2;
1639
1640
  }
1640
1641
  let current = this.head;
1641
- while (current.next !== this.tail) current = current.next;
1642
- const value = this.tail.value;
1642
+ while (current.next && current.next !== this.tail) current = current.next;
1643
+ const value = this.tail?.value;
1643
1644
  current.next = void 0;
1644
1645
  this._tail = current;
1645
1646
  this._length--;
@@ -1727,8 +1728,8 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1727
1728
  at(index) {
1728
1729
  if (index < 0 || index >= this._length) return void 0;
1729
1730
  let current = this.head;
1730
- for (let i = 0; i < index; i++) current = current.next;
1731
- return current.value;
1731
+ for (let i = 0; i < index && current; i++) current = current.next;
1732
+ return current?.value;
1732
1733
  }
1733
1734
  /**
1734
1735
  * Type guard: check whether the input is a SinglyLinkedListNode.
@@ -1748,7 +1749,7 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1748
1749
  getNodeAt(index) {
1749
1750
  if (index < 0 || index >= this._length) return void 0;
1750
1751
  let current = this.head;
1751
- for (let i = 0; i < index; i++) current = current.next;
1752
+ for (let i = 0; i < index && current; i++) current = current.next;
1752
1753
  return current;
1753
1754
  }
1754
1755
  /**
@@ -2257,7 +2258,7 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2257
2258
  static {
2258
2259
  __name(this, "DoublyLinkedList");
2259
2260
  }
2260
- _equals = Object.is;
2261
+ _equals = /* @__PURE__ */ __name((a, b) => Object.is(a, b), "_equals");
2261
2262
  /**
2262
2263
  * Create a DoublyLinkedList and optionally bulk-insert elements.
2263
2264
  * @remarks Time O(N), Space O(N)
@@ -2452,8 +2453,8 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2452
2453
  at(index) {
2453
2454
  if (index < 0 || index >= this._length) return void 0;
2454
2455
  let current = this.head;
2455
- for (let i = 0; i < index; i++) current = current.next;
2456
- return current.value;
2456
+ for (let i = 0; i < index && current; i++) current = current.next;
2457
+ return current?.value;
2457
2458
  }
2458
2459
  /**
2459
2460
  * Get the node reference at a given index.
@@ -2464,7 +2465,7 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2464
2465
  getNodeAt(index) {
2465
2466
  if (index < 0 || index >= this._length) return void 0;
2466
2467
  let current = this.head;
2467
- for (let i = 0; i < index; i++) current = current.next;
2468
+ for (let i = 0; i < index && current; i++) current = current.next;
2468
2469
  return current;
2469
2470
  }
2470
2471
  /**
@@ -2970,7 +2971,7 @@ var Stack = class extends IterableElementBase {
2970
2971
  static {
2971
2972
  __name(this, "Stack");
2972
2973
  }
2973
- _equals = Object.is;
2974
+ _equals = /* @__PURE__ */ __name((a, b) => Object.is(a, b), "_equals");
2974
2975
  /**
2975
2976
  * Create a Stack and optionally bulk-push elements.
2976
2977
  * @remarks Time O(N), Space O(N)
@@ -3606,7 +3607,7 @@ var Deque = class extends LinearBase {
3606
3607
  static {
3607
3608
  __name(this, "Deque");
3608
3609
  }
3609
- _equals = Object.is;
3610
+ _equals = /* @__PURE__ */ __name((a, b) => Object.is(a, b), "_equals");
3610
3611
  /**
3611
3612
  * Create a Deque and optionally bulk-insert elements.
3612
3613
  * @remarks Time O(N), Space O(N)
@@ -4687,11 +4688,6 @@ var Heap = class _Heap extends IterableElementBase {
4687
4688
  return 0;
4688
4689
  }, "_DEFAULT_COMPARATOR");
4689
4690
  _comparator = this._DEFAULT_COMPARATOR;
4690
- /**
4691
- * Get the comparator used to order elements.
4692
- * @remarks Time O(1), Space O(1)
4693
- * @returns Comparator function.
4694
- */
4695
4691
  /**
4696
4692
  * Get the comparator used to order elements.
4697
4693
  * @remarks Time O(1), Space O(1)
@@ -4740,8 +4736,7 @@ var Heap = class _Heap extends IterableElementBase {
4740
4736
  */
4741
4737
  _createInstance(options) {
4742
4738
  const Ctor = this.constructor;
4743
- const next = new Ctor([], { comparator: this.comparator, toElementFn: this.toElementFn, ...options ?? {} });
4744
- return next;
4739
+ return new Ctor([], { comparator: this.comparator, toElementFn: this.toElementFn, ...options ?? {} });
4745
4740
  }
4746
4741
  /**
4747
4742
  * (Protected) Create a like-kind instance seeded by elements.
@@ -5790,8 +5785,8 @@ var AbstractGraph = class extends IterableEntryBase {
5790
5785
  const Ctor = this.constructor;
5791
5786
  const instance = new Ctor();
5792
5787
  const graph = _options?.graph;
5793
- if (graph) instance._options = { ...instance._options, ...graph };
5794
- else instance._options = { ...instance._options, ...this._options };
5788
+ if (graph) instance["_options"] = { ...instance["_options"], ...graph };
5789
+ else instance["_options"] = { ...instance["_options"], ...this._options };
5795
5790
  return instance;
5796
5791
  }
5797
5792
  /**
@@ -5824,12 +5819,10 @@ var AbstractGraph = class extends IterableEntryBase {
5824
5819
  const [va, vb] = ends;
5825
5820
  const ka = va.key;
5826
5821
  const kb = vb.key;
5827
- const hasA = g.hasVertex ? g.hasVertex(ka) : false;
5828
- const hasB = g.hasVertex ? g.hasVertex(kb) : false;
5822
+ const hasA = typeof g.hasVertex === "function" ? g.hasVertex(ka) : false;
5823
+ const hasB = typeof g.hasVertex === "function" ? g.hasVertex(kb) : false;
5829
5824
  if (hasA && hasB) {
5830
- const w = e.weight;
5831
- const val = e.value;
5832
- const newEdge = g.createEdge(ka, kb, w, val);
5825
+ const newEdge = g.createEdge(ka, kb, e.weight, e.value);
5833
5826
  g._addEdge(newEdge);
5834
5827
  }
5835
5828
  }
@@ -8256,7 +8249,7 @@ var BinaryTree = class extends IterableEntryBase {
8256
8249
  * @param node - The node.
8257
8250
  * @returns The node's key or undefined.
8258
8251
  */
8259
- _DEFAULT_NODE_CALLBACK = /* @__PURE__ */ __name((node) => node ? node.key : void 0, "_DEFAULT_NODE_CALLBACK");
8252
+ _DEFAULT_NODE_CALLBACK = /* @__PURE__ */ __name((node) => node?.key, "_DEFAULT_NODE_CALLBACK");
8260
8253
  /**
8261
8254
  * (Protected) Snapshots the current tree's configuration options.
8262
8255
  * @remarks Time O(1)
@@ -13227,7 +13220,7 @@ var TreeMultiSet = class _TreeMultiSet {
13227
13220
  * @remarks Time O(1), Space O(1)
13228
13221
  */
13229
13222
  get comparator() {
13230
- return this.#core._comparator;
13223
+ return this.#core.comparator;
13231
13224
  }
13232
13225
  // ━━━ clear ━━━
13233
13226
  /**
@@ -13364,7 +13357,7 @@ var TreeMultiSet = class _TreeMultiSet {
13364
13357
  filter(predicate) {
13365
13358
  const result = new _TreeMultiSet([], {
13366
13359
  comparator: this.#isDefaultComparator ? void 0 : this.comparator,
13367
- isMapMode: this.#core._isMapMode
13360
+ isMapMode: this.#core.isMapMode
13368
13361
  });
13369
13362
  for (const [k, c] of this.entries()) {
13370
13363
  if (predicate(k, c)) {
@@ -13404,7 +13397,7 @@ var TreeMultiSet = class _TreeMultiSet {
13404
13397
  map(mapper, options) {
13405
13398
  const result = new _TreeMultiSet([], {
13406
13399
  comparator: options?.comparator,
13407
- isMapMode: this.#core._isMapMode
13400
+ isMapMode: this.#core.isMapMode
13408
13401
  });
13409
13402
  for (const [k, c] of this.entries()) {
13410
13403
  const [newKey, newCount] = mapper(k, c);
@@ -13424,7 +13417,7 @@ var TreeMultiSet = class _TreeMultiSet {
13424
13417
  clone() {
13425
13418
  const result = new _TreeMultiSet([], {
13426
13419
  comparator: this.#isDefaultComparator ? void 0 : this.comparator,
13427
- isMapMode: this.#core._isMapMode
13420
+ isMapMode: this.#core.isMapMode
13428
13421
  });
13429
13422
  for (const [k, c] of this.entries()) {
13430
13423
  result.add(k, c);
@@ -14476,12 +14469,11 @@ var Trie = class extends IterableElementBase {
14476
14469
  */
14477
14470
  _createInstance(options) {
14478
14471
  const Ctor = this.constructor;
14479
- const next = new Ctor([], {
14472
+ return new Ctor([], {
14480
14473
  toElementFn: this.toElementFn,
14481
14474
  caseSensitive: this.caseSensitive,
14482
14475
  ...options ?? {}
14483
14476
  });
14484
- return next;
14485
14477
  }
14486
14478
  /**
14487
14479
  * (Protected) Create a like-kind trie and seed it from an iterable.
@@ -1023,8 +1023,9 @@ var _LinkedHashMap = class _LinkedHashMap extends IterableEntryBase {
1023
1023
  const cur = node;
1024
1024
  node = node.next;
1025
1025
  if (predicate(cur.key, cur.value, i++, this)) {
1026
- if (isWeakKey(cur.key)) {
1027
- this._objMap.delete(cur.key);
1026
+ const keyToCheck = cur.key;
1027
+ if (isWeakKey(keyToCheck)) {
1028
+ this._objMap.delete(keyToCheck);
1028
1029
  } else {
1029
1030
  const hash = this._hashFn(cur.key);
1030
1031
  delete this._noObjMap[hash];
@@ -1542,7 +1543,7 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1542
1543
  */
1543
1544
  constructor(elements = [], options) {
1544
1545
  super(options);
1545
- __publicField(this, "_equals", Object.is);
1546
+ __publicField(this, "_equals", /* @__PURE__ */ __name((a, b) => Object.is(a, b), "_equals"));
1546
1547
  __publicField(this, "_head");
1547
1548
  __publicField(this, "_tail");
1548
1549
  __publicField(this, "_length", 0);
@@ -1630,6 +1631,7 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1630
1631
  * @returns Removed element or undefined.
1631
1632
  */
1632
1633
  pop() {
1634
+ var _a;
1633
1635
  if (!this.head) return void 0;
1634
1636
  if (this.head === this.tail) {
1635
1637
  const value2 = this.head.value;
@@ -1639,8 +1641,8 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1639
1641
  return value2;
1640
1642
  }
1641
1643
  let current = this.head;
1642
- while (current.next !== this.tail) current = current.next;
1643
- const value = this.tail.value;
1644
+ while (current.next && current.next !== this.tail) current = current.next;
1645
+ const value = (_a = this.tail) == null ? void 0 : _a.value;
1644
1646
  current.next = void 0;
1645
1647
  this._tail = current;
1646
1648
  this._length--;
@@ -1728,8 +1730,8 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1728
1730
  at(index) {
1729
1731
  if (index < 0 || index >= this._length) return void 0;
1730
1732
  let current = this.head;
1731
- for (let i = 0; i < index; i++) current = current.next;
1732
- return current.value;
1733
+ for (let i = 0; i < index && current; i++) current = current.next;
1734
+ return current == null ? void 0 : current.value;
1733
1735
  }
1734
1736
  /**
1735
1737
  * Type guard: check whether the input is a SinglyLinkedListNode.
@@ -1749,7 +1751,7 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1749
1751
  getNodeAt(index) {
1750
1752
  if (index < 0 || index >= this._length) return void 0;
1751
1753
  let current = this.head;
1752
- for (let i = 0; i < index; i++) current = current.next;
1754
+ for (let i = 0; i < index && current; i++) current = current.next;
1753
1755
  return current;
1754
1756
  }
1755
1757
  /**
@@ -2265,7 +2267,7 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2265
2267
  */
2266
2268
  constructor(elements = [], options) {
2267
2269
  super(options);
2268
- __publicField(this, "_equals", Object.is);
2270
+ __publicField(this, "_equals", /* @__PURE__ */ __name((a, b) => Object.is(a, b), "_equals"));
2269
2271
  __publicField(this, "_head");
2270
2272
  __publicField(this, "_tail");
2271
2273
  __publicField(this, "_length", 0);
@@ -2453,8 +2455,8 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2453
2455
  at(index) {
2454
2456
  if (index < 0 || index >= this._length) return void 0;
2455
2457
  let current = this.head;
2456
- for (let i = 0; i < index; i++) current = current.next;
2457
- return current.value;
2458
+ for (let i = 0; i < index && current; i++) current = current.next;
2459
+ return current == null ? void 0 : current.value;
2458
2460
  }
2459
2461
  /**
2460
2462
  * Get the node reference at a given index.
@@ -2465,7 +2467,7 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2465
2467
  getNodeAt(index) {
2466
2468
  if (index < 0 || index >= this._length) return void 0;
2467
2469
  let current = this.head;
2468
- for (let i = 0; i < index; i++) current = current.next;
2470
+ for (let i = 0; i < index && current; i++) current = current.next;
2469
2471
  return current;
2470
2472
  }
2471
2473
  /**
@@ -2977,7 +2979,7 @@ var _Stack = class _Stack extends IterableElementBase {
2977
2979
  */
2978
2980
  constructor(elements = [], options) {
2979
2981
  super(options);
2980
- __publicField(this, "_equals", Object.is);
2982
+ __publicField(this, "_equals", /* @__PURE__ */ __name((a, b) => Object.is(a, b), "_equals"));
2981
2983
  __publicField(this, "_elements", []);
2982
2984
  this.pushMany(elements);
2983
2985
  }
@@ -3612,7 +3614,7 @@ var _Deque = class _Deque extends LinearBase {
3612
3614
  */
3613
3615
  constructor(elements = [], options) {
3614
3616
  super(options);
3615
- __publicField(this, "_equals", Object.is);
3617
+ __publicField(this, "_equals", /* @__PURE__ */ __name((a, b) => Object.is(a, b), "_equals"));
3616
3618
  __publicField(this, "_bucketSize", 1 << 12);
3617
3619
  __publicField(this, "_bucketFirst", 0);
3618
3620
  __publicField(this, "_firstInBucket", 0);
@@ -4684,11 +4686,6 @@ var _Heap = class _Heap extends IterableElementBase {
4684
4686
  }
4685
4687
  return out;
4686
4688
  }
4687
- /**
4688
- * Get the comparator used to order elements.
4689
- * @remarks Time O(1), Space O(1)
4690
- * @returns Comparator function.
4691
- */
4692
4689
  /**
4693
4690
  * Get the comparator used to order elements.
4694
4691
  * @remarks Time O(1), Space O(1)
@@ -4737,8 +4734,7 @@ var _Heap = class _Heap extends IterableElementBase {
4737
4734
  */
4738
4735
  _createInstance(options) {
4739
4736
  const Ctor = this.constructor;
4740
- const next = new Ctor([], { comparator: this.comparator, toElementFn: this.toElementFn, ...options != null ? options : {} });
4741
- return next;
4737
+ return new Ctor([], { comparator: this.comparator, toElementFn: this.toElementFn, ...options != null ? options : {} });
4742
4738
  }
4743
4739
  /**
4744
4740
  * (Protected) Create a like-kind instance seeded by elements.
@@ -5784,8 +5780,8 @@ var _AbstractGraph = class _AbstractGraph extends IterableEntryBase {
5784
5780
  const Ctor = this.constructor;
5785
5781
  const instance = new Ctor();
5786
5782
  const graph = _options == null ? void 0 : _options.graph;
5787
- if (graph) instance._options = { ...instance._options, ...graph };
5788
- else instance._options = { ...instance._options, ...this._options };
5783
+ if (graph) instance["_options"] = { ...instance["_options"], ...graph };
5784
+ else instance["_options"] = { ...instance["_options"], ...this._options };
5789
5785
  return instance;
5790
5786
  }
5791
5787
  /**
@@ -5818,12 +5814,10 @@ var _AbstractGraph = class _AbstractGraph extends IterableEntryBase {
5818
5814
  const [va, vb] = ends;
5819
5815
  const ka = va.key;
5820
5816
  const kb = vb.key;
5821
- const hasA = g.hasVertex ? g.hasVertex(ka) : false;
5822
- const hasB = g.hasVertex ? g.hasVertex(kb) : false;
5817
+ const hasA = typeof g.hasVertex === "function" ? g.hasVertex(ka) : false;
5818
+ const hasB = typeof g.hasVertex === "function" ? g.hasVertex(kb) : false;
5823
5819
  if (hasA && hasB) {
5824
- const w = e.weight;
5825
- const val = e.value;
5826
- const newEdge = g.createEdge(ka, kb, w, val);
5820
+ const newEdge = g.createEdge(ka, kb, e.weight, e.value);
5827
5821
  g._addEdge(newEdge);
5828
5822
  }
5829
5823
  }
@@ -7015,7 +7009,7 @@ var _BinaryTree = class _BinaryTree extends IterableEntryBase {
7015
7009
  * @param node - The node.
7016
7010
  * @returns The node's key or undefined.
7017
7011
  */
7018
- __publicField(this, "_DEFAULT_NODE_CALLBACK", /* @__PURE__ */ __name((node) => node ? node.key : void 0, "_DEFAULT_NODE_CALLBACK"));
7012
+ __publicField(this, "_DEFAULT_NODE_CALLBACK", /* @__PURE__ */ __name((node) => node == null ? void 0 : node.key, "_DEFAULT_NODE_CALLBACK"));
7019
7013
  if (options) {
7020
7014
  const { iterationType, toEntryFn, isMapMode, isDuplicate } = options;
7021
7015
  if (iterationType) this.iterationType = iterationType;
@@ -13235,7 +13229,7 @@ var _TreeMultiSet = class _TreeMultiSet {
13235
13229
  * @remarks Time O(1), Space O(1)
13236
13230
  */
13237
13231
  get comparator() {
13238
- return __privateGet(this, _core4)._comparator;
13232
+ return __privateGet(this, _core4).comparator;
13239
13233
  }
13240
13234
  // ━━━ clear ━━━
13241
13235
  /**
@@ -13372,7 +13366,7 @@ var _TreeMultiSet = class _TreeMultiSet {
13372
13366
  filter(predicate) {
13373
13367
  const result = new _TreeMultiSet([], {
13374
13368
  comparator: __privateGet(this, _isDefaultComparator4) ? void 0 : this.comparator,
13375
- isMapMode: __privateGet(this, _core4)._isMapMode
13369
+ isMapMode: __privateGet(this, _core4).isMapMode
13376
13370
  });
13377
13371
  for (const [k, c] of this.entries()) {
13378
13372
  if (predicate(k, c)) {
@@ -13412,7 +13406,7 @@ var _TreeMultiSet = class _TreeMultiSet {
13412
13406
  map(mapper, options) {
13413
13407
  const result = new _TreeMultiSet([], {
13414
13408
  comparator: options == null ? void 0 : options.comparator,
13415
- isMapMode: __privateGet(this, _core4)._isMapMode
13409
+ isMapMode: __privateGet(this, _core4).isMapMode
13416
13410
  });
13417
13411
  for (const [k, c] of this.entries()) {
13418
13412
  const [newKey, newCount] = mapper(k, c);
@@ -13432,7 +13426,7 @@ var _TreeMultiSet = class _TreeMultiSet {
13432
13426
  clone() {
13433
13427
  const result = new _TreeMultiSet([], {
13434
13428
  comparator: __privateGet(this, _isDefaultComparator4) ? void 0 : this.comparator,
13435
- isMapMode: __privateGet(this, _core4)._isMapMode
13429
+ isMapMode: __privateGet(this, _core4).isMapMode
13436
13430
  });
13437
13431
  for (const [k, c] of this.entries()) {
13438
13432
  result.add(k, c);
@@ -14480,12 +14474,11 @@ var _Trie = class _Trie extends IterableElementBase {
14480
14474
  */
14481
14475
  _createInstance(options) {
14482
14476
  const Ctor = this.constructor;
14483
- const next = new Ctor([], {
14477
+ return new Ctor([], {
14484
14478
  toElementFn: this.toElementFn,
14485
14479
  caseSensitive: this.caseSensitive,
14486
14480
  ...options != null ? options : {}
14487
14481
  });
14488
- return next;
14489
14482
  }
14490
14483
  /**
14491
14484
  * (Protected) Create a like-kind trie and seed it from an iterable.
@@ -27,7 +27,7 @@ export declare abstract class IterableElementBase<E, R> implements Iterable<E> {
27
27
  * @remarks
28
28
  * Time O(1), Space O(1).
29
29
  */
30
- protected _toElementFn?: (rawElement: R) => E;
30
+ protected readonly _toElementFn?: (rawElement: R) => E;
31
31
  /**
32
32
  * Exposes the current `toElementFn`, if configured.
33
33
  *
@@ -275,7 +275,7 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
275
275
  * @param [options] - Configuration options for the tree.
276
276
  */
277
277
  constructor(keysNodesEntriesOrRaws?: Iterable<K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | R>, options?: BinaryTreeOptions<K, V, R>);
278
- protected _isMapMode: boolean;
278
+ protected readonly _isMapMode: boolean;
279
279
  /**
280
280
  * Gets whether the tree is in Map mode.
281
281
  * @remarks In Map mode (default), values are stored in an external Map, and nodes only hold keys. If false, values are stored directly on the nodes. Time O(1)
@@ -283,7 +283,7 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
283
283
  * @returns True if in Map mode, false otherwise.
284
284
  */
285
285
  get isMapMode(): boolean;
286
- protected _isDuplicate: boolean;
286
+ protected readonly _isDuplicate: boolean;
287
287
  /**
288
288
  * Gets whether the tree allows duplicate keys.
289
289
  * @remarks Time O(1)
@@ -315,7 +315,7 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
315
315
  * @returns The size of the tree.
316
316
  */
317
317
  get size(): number;
318
- protected _NIL: BinaryTreeNode<K, V>;
318
+ protected readonly _NIL: BinaryTreeNode<K, V>;
319
319
  /**
320
320
  * Gets the sentinel NIL node (used in self-balancing trees like Red-Black Tree).
321
321
  * @remarks Time O(1)
@@ -323,7 +323,7 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
323
323
  * @returns The NIL node.
324
324
  */
325
325
  get NIL(): BinaryTreeNode<K, V>;
326
- protected _toEntryFn?: ToEntryFn<K, V, R>;
326
+ protected readonly _toEntryFn?: ToEntryFn<K, V, R>;
327
327
  /**
328
328
  * Gets the function used to convert raw data objects (R) into [key, value] entries.
329
329
  * @remarks Time O(1)
@@ -682,7 +682,7 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
682
682
  * @param node - The node.
683
683
  * @returns The node's key or undefined.
684
684
  */
685
- protected _DEFAULT_NODE_CALLBACK: (node: BinaryTreeNode<K, V> | null | undefined) => K | undefined;
685
+ protected readonly _DEFAULT_NODE_CALLBACK: NodeCallback<BinaryTreeNode<K, V> | null | undefined, K | undefined>;
686
686
  /**
687
687
  * (Protected) Snapshots the current tree's configuration options.
688
688
  * @remarks Time O(1)
@@ -294,7 +294,7 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
294
294
 
295
295
  * @remarks Time O(1) Space O(1)
296
296
  */
297
- protected _comparator: Comparator<K>;
297
+ protected readonly _comparator: Comparator<K>;
298
298
  /**
299
299
  * Gets the comparator function used by the tree.
300
300
  * @remarks Time O(1)
@@ -170,7 +170,7 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
170
170
  * @returns DirectedGraph with all keys added.
171
171
  * @remarks Time O(V), Space O(V)
172
172
  */
173
- static fromKeys<K extends VertexKey>(keys: Iterable<K>): DirectedGraph<K, any, DirectedVertex<K>, DirectedEdge<any>>;
173
+ static fromKeys<K extends VertexKey>(keys: Iterable<K>): DirectedGraph<K, undefined, DirectedVertex<K>, DirectedEdge<undefined>>;
174
174
  /**
175
175
  * Construct a directed graph from `[key, value]` entries.
176
176
  * @template V - Vertex value type.
@@ -178,7 +178,7 @@ export declare class DirectedGraph<V = any, E = any, VO extends DirectedVertex<V
178
178
  * @returns DirectedGraph with all vertices added.
179
179
  * @remarks Time O(V), Space O(V)
180
180
  */
181
- static fromEntries<V>(entries: Iterable<[VertexKey, V]>): DirectedGraph<V, any, DirectedVertex<V>, DirectedEdge<any>>;
181
+ static fromEntries<V>(entries: Iterable<[VertexKey, V]>): DirectedGraph<V, undefined, DirectedVertex<V>, DirectedEdge<undefined>>;
182
182
  /**
183
183
  * Create a directed vertex instance. Does not insert into the graph.
184
184
  * @param key - Vertex identifier.
@@ -200,7 +200,7 @@ export declare class UndirectedGraph<V = any, E = any, VO extends UndirectedVert
200
200
  * @returns UndirectedGraph with all keys added.
201
201
  * @remarks Time O(V), Space O(V)
202
202
  */
203
- static fromKeys<K extends VertexKey>(keys: Iterable<K>): UndirectedGraph<K, any, UndirectedVertex<K>, UndirectedEdge<any>>;
203
+ static fromKeys<K extends VertexKey>(keys: Iterable<K>): UndirectedGraph<K, undefined, UndirectedVertex<K>, UndirectedEdge<undefined>>;
204
204
  /**
205
205
  * Construct an undirected graph from `[key, value]` entries.
206
206
  * @template V - Vertex value type.
@@ -208,7 +208,7 @@ export declare class UndirectedGraph<V = any, E = any, VO extends UndirectedVert
208
208
  * @returns UndirectedGraph with all vertices added.
209
209
  * @remarks Time O(V), Space O(V)
210
210
  */
211
- static fromEntries<V>(entries: Iterable<[VertexKey, V]>): UndirectedGraph<V, any, UndirectedVertex<V>, UndirectedEdge<any>>;
211
+ static fromEntries<V>(entries: Iterable<[VertexKey, V]>): UndirectedGraph<V, undefined, UndirectedVertex<V>, UndirectedEdge<undefined>>;
212
212
  /**
213
213
  * Create an undirected vertex instance. Does not insert into the graph.
214
214
  * @param key - Vertex identifier.
@@ -175,7 +175,7 @@ export declare class HashMap<K = any, V = any, R = [K, V]> extends IterableEntry
175
175
  * @returns Map of object→value.
176
176
  */
177
177
  get objMap(): Map<object, V>;
178
- protected _toEntryFn?: (rawElement: R) => [K, V];
178
+ protected readonly _toEntryFn?: (rawElement: R) => [K, V];
179
179
  /**
180
180
  * Get the raw→entry converter function if present.
181
181
  * @remarks Time O(1), Space O(1)
@@ -346,7 +346,7 @@ export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends Iterabl
346
346
  * @returns Tail node or sentinel.
347
347
  */
348
348
  get tail(): HashMapLinkedNode<K, V | undefined>;
349
- protected _toEntryFn?: (rawElement: R) => [K, V];
349
+ protected readonly _toEntryFn?: (rawElement: R) => [K, V];
350
350
  get toEntryFn(): ((rawElement: R) => [K, V]) | undefined;
351
351
  protected _size: number;
352
352
  get size(): number;
@@ -414,12 +414,8 @@ export declare class Heap<E = any, R = any> extends IterableElementBase<E, R> {
414
414
  * @returns A new heap with mapped elements.
415
415
  */
416
416
  mapSame(callback: ElementCallback<E, R, E>, thisArg?: unknown): this;
417
- protected _DEFAULT_COMPARATOR: (a: E, b: E) => number;
418
- protected _comparator: Comparator<E>; /**
419
- * Get the comparator used to order elements.
420
- * @remarks Time O(1), Space O(1)
421
- * @returns Comparator function.
422
- */
417
+ protected readonly _DEFAULT_COMPARATOR: Comparator<E>;
418
+ protected readonly _comparator: Comparator<E>;
423
419
  /**
424
420
  * Get the comparator used to order elements.
425
421
  * @remarks Time O(1), Space O(1)
@@ -501,7 +497,7 @@ export declare class FibonacciHeap<E> {
501
497
  * @returns Min node or undefined.
502
498
  */
503
499
  get min(): FibonacciHeapNode<E> | undefined;
504
- protected _comparator: Comparator<E>;
500
+ protected readonly _comparator: Comparator<E>;
505
501
  get comparator(): Comparator<E>;
506
502
  clear(): void;
507
503
  add(element: E): boolean;
@@ -1,2 +1,2 @@
1
1
  import { BSTOptions } from './bst';
2
- export type AVLTreeOptions<K, V, R> = BSTOptions<K, V, R> & {};
2
+ export type AVLTreeOptions<K, V, R> = BSTOptions<K, V, R>;
@@ -1,3 +1,3 @@
1
1
  import type { BSTOptions } from './bst';
2
2
  export type RBTNColor = 'RED' | 'BLACK';
3
- export type RedBlackTreeOptions<K, V, R> = BSTOptions<K, V, R> & {};
3
+ export type RedBlackTreeOptions<K, V, R> = BSTOptions<K, V, R>;
@@ -1,2 +1,2 @@
1
1
  import { LinearBaseOptions } from '../base';
2
- export type DoublyLinkedListOptions<E, R> = LinearBaseOptions<E, R> & {};
2
+ export type DoublyLinkedListOptions<E, R> = LinearBaseOptions<E, R>;
@@ -1,2 +1,2 @@
1
1
  import { LinearBaseOptions } from '../base';
2
- export type SinglyLinkedListOptions<E, R> = LinearBaseOptions<E, R> & {};
2
+ export type SinglyLinkedListOptions<E, R> = LinearBaseOptions<E, R>;
@@ -1,2 +1,2 @@
1
1
  import { HeapOptions } from '../heap';
2
- export type PriorityQueueOptions<E, R> = HeapOptions<E, R> & {};
2
+ export type PriorityQueueOptions<E, R> = HeapOptions<E, R>;
@@ -1,2 +1,2 @@
1
1
  import { IterableElementBaseOptions } from '../base';
2
- export type StackOptions<E, R> = IterableElementBaseOptions<E, R> & {};
2
+ export type StackOptions<E, R> = IterableElementBaseOptions<E, R>;