singly-linked-list-typed 2.5.0 → 2.5.2

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 (90) hide show
  1. package/dist/cjs/index.cjs +418 -51
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs-legacy/index.cjs +417 -50
  4. package/dist/cjs-legacy/index.cjs.map +1 -1
  5. package/dist/esm/index.mjs +418 -52
  6. package/dist/esm/index.mjs.map +1 -1
  7. package/dist/esm-legacy/index.mjs +417 -51
  8. package/dist/esm-legacy/index.mjs.map +1 -1
  9. package/dist/types/common/error.d.ts +9 -0
  10. package/dist/types/common/index.d.ts +1 -1
  11. package/dist/types/data-structures/base/index.d.ts +1 -0
  12. package/dist/types/data-structures/base/iterable-entry-base.d.ts +8 -8
  13. package/dist/types/data-structures/base/linear-base.d.ts +3 -3
  14. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +288 -0
  15. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +336 -0
  16. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +618 -18
  17. package/dist/types/data-structures/binary-tree/bst.d.ts +676 -1
  18. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +456 -0
  19. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +144 -1
  20. package/dist/types/data-structures/binary-tree/tree-map.d.ts +3307 -399
  21. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +3285 -360
  22. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +2674 -325
  23. package/dist/types/data-structures/binary-tree/tree-set.d.ts +3072 -287
  24. package/dist/types/data-structures/graph/abstract-graph.d.ts +4 -4
  25. package/dist/types/data-structures/graph/directed-graph.d.ts +240 -0
  26. package/dist/types/data-structures/graph/undirected-graph.d.ts +216 -0
  27. package/dist/types/data-structures/hash/hash-map.d.ts +274 -10
  28. package/dist/types/data-structures/heap/heap.d.ts +336 -0
  29. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +411 -3
  30. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +363 -3
  31. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +434 -2
  32. package/dist/types/data-structures/matrix/matrix.d.ts +192 -0
  33. package/dist/types/data-structures/queue/deque.d.ts +364 -4
  34. package/dist/types/data-structures/queue/queue.d.ts +288 -0
  35. package/dist/types/data-structures/stack/stack.d.ts +240 -0
  36. package/dist/types/data-structures/trie/trie.d.ts +292 -4
  37. package/dist/types/interfaces/graph.d.ts +1 -1
  38. package/dist/types/types/common.d.ts +2 -2
  39. package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
  40. package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
  41. package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
  42. package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
  43. package/dist/types/types/data-structures/heap/heap.d.ts +1 -0
  44. package/dist/types/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
  45. package/dist/types/types/utils/validate-type.d.ts +4 -4
  46. package/dist/umd/singly-linked-list-typed.js +415 -49
  47. package/dist/umd/singly-linked-list-typed.js.map +1 -1
  48. package/dist/umd/singly-linked-list-typed.min.js +1 -1
  49. package/dist/umd/singly-linked-list-typed.min.js.map +1 -1
  50. package/package.json +2 -2
  51. package/src/common/error.ts +19 -1
  52. package/src/common/index.ts +1 -1
  53. package/src/data-structures/base/index.ts +1 -0
  54. package/src/data-structures/base/iterable-element-base.ts +3 -2
  55. package/src/data-structures/base/iterable-entry-base.ts +8 -8
  56. package/src/data-structures/base/linear-base.ts +3 -3
  57. package/src/data-structures/binary-tree/avl-tree.ts +299 -0
  58. package/src/data-structures/binary-tree/binary-indexed-tree.ts +341 -5
  59. package/src/data-structures/binary-tree/binary-tree.ts +606 -6
  60. package/src/data-structures/binary-tree/bst.ts +946 -7
  61. package/src/data-structures/binary-tree/red-black-tree.ts +472 -0
  62. package/src/data-structures/binary-tree/segment-tree.ts +145 -2
  63. package/src/data-structures/binary-tree/tree-map.ts +3423 -499
  64. package/src/data-structures/binary-tree/tree-multi-map.ts +3537 -596
  65. package/src/data-structures/binary-tree/tree-multi-set.ts +2855 -495
  66. package/src/data-structures/binary-tree/tree-set.ts +3209 -413
  67. package/src/data-structures/graph/abstract-graph.ts +6 -6
  68. package/src/data-structures/graph/directed-graph.ts +240 -0
  69. package/src/data-structures/graph/undirected-graph.ts +216 -0
  70. package/src/data-structures/hash/hash-map.ts +281 -19
  71. package/src/data-structures/heap/heap.ts +340 -4
  72. package/src/data-structures/heap/max-heap.ts +2 -2
  73. package/src/data-structures/linked-list/doubly-linked-list.ts +411 -3
  74. package/src/data-structures/linked-list/singly-linked-list.ts +363 -3
  75. package/src/data-structures/linked-list/skip-linked-list.ts +439 -7
  76. package/src/data-structures/matrix/matrix.ts +202 -10
  77. package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
  78. package/src/data-structures/queue/deque.ts +365 -5
  79. package/src/data-structures/queue/queue.ts +288 -0
  80. package/src/data-structures/stack/stack.ts +240 -0
  81. package/src/data-structures/trie/trie.ts +295 -7
  82. package/src/interfaces/graph.ts +1 -1
  83. package/src/types/common.ts +2 -2
  84. package/src/types/data-structures/binary-tree/bst.ts +1 -0
  85. package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
  86. package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
  87. package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
  88. package/src/types/data-structures/heap/heap.ts +1 -0
  89. package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
  90. package/src/types/utils/validate-type.ts +4 -4
@@ -5,6 +5,60 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
5
5
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
6
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
7
 
8
+ // src/common/error.ts
9
+ function raise(ErrorClass, message) {
10
+ throw new ErrorClass(message);
11
+ }
12
+ __name(raise, "raise");
13
+ var ERR = {
14
+ // Range / index
15
+ indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
16
+ invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
17
+ // Type / argument
18
+ invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
19
+ comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
20
+ invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
21
+ notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
22
+ invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
23
+ invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
24
+ invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
25
+ reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
26
+ callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
27
+ // State / operation
28
+ invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
29
+ // Matrix
30
+ matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
31
+ matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
32
+ matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
33
+ matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
34
+ matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch"),
35
+ // Order statistic
36
+ orderStatisticNotEnabled: /* @__PURE__ */ __name((method, ctx) => `${ctx ? ctx + ": " : ""}${method}() requires enableOrderStatistic: true.`, "orderStatisticNotEnabled")
37
+ };
38
+
39
+ // src/common/index.ts
40
+ var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
41
+ DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
42
+ DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
43
+ return DFSOperation2;
44
+ })(DFSOperation || {});
45
+ var _Range = class _Range {
46
+ constructor(low, high, includeLow = true, includeHigh = true) {
47
+ this.low = low;
48
+ this.high = high;
49
+ this.includeLow = includeLow;
50
+ this.includeHigh = includeHigh;
51
+ }
52
+ // Determine whether a key is within the range
53
+ isInRange(key, comparator) {
54
+ const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
55
+ const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
56
+ return lowCheck && highCheck;
57
+ }
58
+ };
59
+ __name(_Range, "Range");
60
+ var Range = _Range;
61
+
8
62
  // src/data-structures/base/iterable-element-base.ts
9
63
  var _IterableElementBase = class _IterableElementBase {
10
64
  /**
@@ -27,7 +81,7 @@ var _IterableElementBase = class _IterableElementBase {
27
81
  if (options) {
28
82
  const { toElementFn } = options;
29
83
  if (typeof toElementFn === "function") this._toElementFn = toElementFn;
30
- else if (toElementFn) throw new TypeError("toElementFn must be a function type");
84
+ else if (toElementFn) raise(TypeError, "toElementFn must be a function type");
31
85
  }
32
86
  }
33
87
  /**
@@ -183,7 +237,7 @@ var _IterableElementBase = class _IterableElementBase {
183
237
  acc = initialValue;
184
238
  } else {
185
239
  const first = iter.next();
186
- if (first.done) throw new TypeError("Reduce of empty structure with no initial value");
240
+ if (first.done) raise(TypeError, "Reduce of empty structure with no initial value");
187
241
  acc = first.value;
188
242
  index = 1;
189
243
  }
@@ -736,6 +790,30 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
736
790
 
737
791
 
738
792
 
793
+
794
+
795
+
796
+
797
+
798
+
799
+
800
+
801
+
802
+
803
+
804
+
805
+
806
+
807
+
808
+
809
+
810
+
811
+
812
+
813
+
814
+
815
+
816
+
739
817
  * @example
740
818
  * // basic SinglyLinkedList creation and push operation
741
819
  * // Create a simple SinglyLinkedList with initial values
@@ -779,6 +857,30 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
779
857
 
780
858
 
781
859
 
860
+
861
+
862
+
863
+
864
+
865
+
866
+
867
+
868
+
869
+
870
+
871
+
872
+
873
+
874
+
875
+
876
+
877
+
878
+
879
+
880
+
881
+
882
+
883
+
782
884
  * @example
783
885
  * // SinglyLinkedList pop and shift operations
784
886
  * const list = new SinglyLinkedList<number>([10, 20, 30, 40, 50]);
@@ -828,6 +930,30 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
828
930
 
829
931
 
830
932
 
933
+
934
+
935
+
936
+
937
+
938
+
939
+
940
+
941
+
942
+
943
+
944
+
945
+
946
+
947
+
948
+
949
+
950
+
951
+
952
+
953
+
954
+
955
+
956
+
831
957
  * @example
832
958
  * // Remove from the front
833
959
  * const list = new SinglyLinkedList<number>([10, 20, 30]);
@@ -858,6 +984,30 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
858
984
 
859
985
 
860
986
 
987
+
988
+
989
+
990
+
991
+
992
+
993
+
994
+
995
+
996
+
997
+
998
+
999
+
1000
+
1001
+
1002
+
1003
+
1004
+
1005
+
1006
+
1007
+
1008
+
1009
+
1010
+
861
1011
  * @example
862
1012
  * // SinglyLinkedList unshift and forward traversal
863
1013
  * const list = new SinglyLinkedList<number>([20, 30, 40]);
@@ -949,6 +1099,30 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
949
1099
 
950
1100
 
951
1101
 
1102
+
1103
+
1104
+
1105
+
1106
+
1107
+
1108
+
1109
+
1110
+
1111
+
1112
+
1113
+
1114
+
1115
+
1116
+
1117
+
1118
+
1119
+
1120
+
1121
+
1122
+
1123
+
1124
+
1125
+
952
1126
  * @example
953
1127
  * // Access element by index
954
1128
  * const list = new SinglyLinkedList<string>(['a', 'b', 'c', 'd']);
@@ -984,6 +1158,30 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
984
1158
 
985
1159
 
986
1160
 
1161
+
1162
+
1163
+
1164
+
1165
+
1166
+
1167
+
1168
+
1169
+
1170
+
1171
+
1172
+
1173
+
1174
+
1175
+
1176
+
1177
+
1178
+
1179
+
1180
+
1181
+
1182
+
1183
+
1184
+
987
1185
  * @example
988
1186
  * // Get node at index
989
1187
  * const list = new SinglyLinkedList<string>(['a', 'b', 'c']);
@@ -1008,6 +1206,30 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1008
1206
 
1009
1207
 
1010
1208
 
1209
+
1210
+
1211
+
1212
+
1213
+
1214
+
1215
+
1216
+
1217
+
1218
+
1219
+
1220
+
1221
+
1222
+
1223
+
1224
+
1225
+
1226
+
1227
+
1228
+
1229
+
1230
+
1231
+
1232
+
1011
1233
  * @example
1012
1234
  * // Remove by index
1013
1235
  * const list = new SinglyLinkedList<string>(['a', 'b', 'c']);
@@ -1038,6 +1260,30 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1038
1260
 
1039
1261
 
1040
1262
 
1263
+
1264
+
1265
+
1266
+
1267
+
1268
+
1269
+
1270
+
1271
+
1272
+
1273
+
1274
+
1275
+
1276
+
1277
+
1278
+
1279
+
1280
+
1281
+
1282
+
1283
+
1284
+
1285
+
1286
+
1041
1287
  * @example
1042
1288
  * // Remove first occurrence
1043
1289
  * const list = new SinglyLinkedList<number>([1, 2, 3, 2]);
@@ -1073,6 +1319,30 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1073
1319
 
1074
1320
 
1075
1321
 
1322
+
1323
+
1324
+
1325
+
1326
+
1327
+
1328
+
1329
+
1330
+
1331
+
1332
+
1333
+
1334
+
1335
+
1336
+
1337
+
1338
+
1339
+
1340
+
1341
+
1342
+
1343
+
1344
+
1345
+
1076
1346
  * @example
1077
1347
  * // Insert at index
1078
1348
  * const list = new SinglyLinkedList<number>([1, 3]);
@@ -1116,6 +1386,30 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1116
1386
 
1117
1387
 
1118
1388
 
1389
+
1390
+
1391
+
1392
+
1393
+
1394
+
1395
+
1396
+
1397
+
1398
+
1399
+
1400
+
1401
+
1402
+
1403
+
1404
+
1405
+
1406
+
1407
+
1408
+
1409
+
1410
+
1411
+
1412
+
1119
1413
  * @example
1120
1414
  * // Check empty
1121
1415
  * console.log(new SinglyLinkedList().isEmpty()); // true;
@@ -1136,6 +1430,30 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1136
1430
 
1137
1431
 
1138
1432
 
1433
+
1434
+
1435
+
1436
+
1437
+
1438
+
1439
+
1440
+
1441
+
1442
+
1443
+
1444
+
1445
+
1446
+
1447
+
1448
+
1449
+
1450
+
1451
+
1452
+
1453
+
1454
+
1455
+
1456
+
1139
1457
  * @example
1140
1458
  * // Remove all
1141
1459
  * const list = new SinglyLinkedList<number>([1, 2, 3]);
@@ -1162,6 +1480,30 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1162
1480
 
1163
1481
 
1164
1482
 
1483
+
1484
+
1485
+
1486
+
1487
+
1488
+
1489
+
1490
+
1491
+
1492
+
1493
+
1494
+
1495
+
1496
+
1497
+
1498
+
1499
+
1500
+
1501
+
1502
+
1503
+
1504
+
1505
+
1506
+
1165
1507
  * @example
1166
1508
  * // Reverse the list in-place
1167
1509
  * const list = new SinglyLinkedList<number>([1, 2, 3, 4]);
@@ -1354,6 +1696,30 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1354
1696
 
1355
1697
 
1356
1698
 
1699
+
1700
+
1701
+
1702
+
1703
+
1704
+
1705
+
1706
+
1707
+
1708
+
1709
+
1710
+
1711
+
1712
+
1713
+
1714
+
1715
+
1716
+
1717
+
1718
+
1719
+
1720
+
1721
+
1722
+
1357
1723
  * @example
1358
1724
  * // Deep copy
1359
1725
  * const list = new SinglyLinkedList<number>([1, 2, 3]);
@@ -1384,6 +1750,30 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1384
1750
 
1385
1751
 
1386
1752
 
1753
+
1754
+
1755
+
1756
+
1757
+
1758
+
1759
+
1760
+
1761
+
1762
+
1763
+
1764
+
1765
+
1766
+
1767
+
1768
+
1769
+
1770
+
1771
+
1772
+
1773
+
1774
+
1775
+
1776
+
1387
1777
  * @example
1388
1778
  * // SinglyLinkedList filter and map operations
1389
1779
  * const list = new SinglyLinkedList<number>([1, 2, 3, 4, 5]);
@@ -1442,6 +1832,30 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1442
1832
 
1443
1833
 
1444
1834
 
1835
+
1836
+
1837
+
1838
+
1839
+
1840
+
1841
+
1842
+
1843
+
1844
+
1845
+
1846
+
1847
+
1848
+
1849
+
1850
+
1851
+
1852
+
1853
+
1854
+
1855
+
1856
+
1857
+
1858
+
1445
1859
  * @example
1446
1860
  * // Transform elements
1447
1861
  * const list = new SinglyLinkedList<number>([1, 2, 3]);
@@ -1583,54 +1997,6 @@ function elementOrPredicate(input, equals) {
1583
1997
  return (node) => equals(node.value, value);
1584
1998
  }
1585
1999
  __name(elementOrPredicate, "elementOrPredicate");
1586
-
1587
- // src/common/error.ts
1588
- var ERR = {
1589
- // Range / index
1590
- indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
1591
- invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
1592
- // Type / argument
1593
- invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
1594
- comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
1595
- invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
1596
- notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
1597
- invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
1598
- invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
1599
- invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
1600
- reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
1601
- callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
1602
- // State / operation
1603
- invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
1604
- // Matrix
1605
- matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
1606
- matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
1607
- matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
1608
- matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
1609
- matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch")
1610
- };
1611
-
1612
- // src/common/index.ts
1613
- var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
1614
- DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
1615
- DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
1616
- return DFSOperation2;
1617
- })(DFSOperation || {});
1618
- var _Range = class _Range {
1619
- constructor(low, high, includeLow = true, includeHigh = true) {
1620
- this.low = low;
1621
- this.high = high;
1622
- this.includeLow = includeLow;
1623
- this.includeHigh = includeHigh;
1624
- }
1625
- // Determine whether a key is within the range
1626
- isInRange(key, comparator) {
1627
- const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
1628
- const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
1629
- return lowCheck && highCheck;
1630
- }
1631
- };
1632
- __name(_Range, "Range");
1633
- var Range = _Range;
1634
2000
  /**
1635
2001
  * data-structure-typed
1636
2002
  *
@@ -1644,5 +2010,6 @@ exports.ERR = ERR;
1644
2010
  exports.Range = Range;
1645
2011
  exports.SinglyLinkedList = SinglyLinkedList;
1646
2012
  exports.SinglyLinkedListNode = SinglyLinkedListNode;
2013
+ exports.raise = raise;
1647
2014
  //# sourceMappingURL=index.cjs.map
1648
2015
  //# sourceMappingURL=index.cjs.map