queue-typed 2.5.1 → 2.5.3

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 (75) hide show
  1. package/dist/cjs/index.cjs +399 -51
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs-legacy/index.cjs +398 -50
  4. package/dist/cjs-legacy/index.cjs.map +1 -1
  5. package/dist/esm/index.mjs +399 -52
  6. package/dist/esm/index.mjs.map +1 -1
  7. package/dist/esm-legacy/index.mjs +398 -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/binary-tree/avl-tree.d.ts +86 -2
  12. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +98 -0
  13. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +189 -13
  14. package/dist/types/data-structures/binary-tree/bst.d.ts +270 -3
  15. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +136 -8
  16. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +42 -0
  17. package/dist/types/data-structures/binary-tree/tree-map.d.ts +1089 -161
  18. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +1243 -350
  19. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +980 -255
  20. package/dist/types/data-structures/binary-tree/tree-set.d.ts +1174 -284
  21. package/dist/types/data-structures/graph/directed-graph.d.ts +70 -0
  22. package/dist/types/data-structures/graph/undirected-graph.d.ts +63 -0
  23. package/dist/types/data-structures/hash/hash-map.d.ts +84 -6
  24. package/dist/types/data-structures/heap/heap.d.ts +140 -12
  25. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +126 -0
  26. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +106 -1
  27. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +126 -0
  28. package/dist/types/data-structures/matrix/matrix.d.ts +56 -0
  29. package/dist/types/data-structures/queue/deque.d.ts +127 -0
  30. package/dist/types/data-structures/queue/queue.d.ts +97 -0
  31. package/dist/types/data-structures/stack/stack.d.ts +72 -2
  32. package/dist/types/data-structures/trie/trie.d.ts +84 -0
  33. package/dist/types/interfaces/binary-tree.d.ts +2 -3
  34. package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
  35. package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
  36. package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
  37. package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
  38. package/dist/umd/queue-typed.js +396 -49
  39. package/dist/umd/queue-typed.js.map +1 -1
  40. package/dist/umd/queue-typed.min.js +1 -1
  41. package/dist/umd/queue-typed.min.js.map +1 -1
  42. package/package.json +2 -2
  43. package/src/common/error.ts +19 -1
  44. package/src/common/index.ts +1 -1
  45. package/src/data-structures/base/iterable-element-base.ts +3 -2
  46. package/src/data-structures/binary-tree/avl-tree.ts +99 -5
  47. package/src/data-structures/binary-tree/binary-indexed-tree.ts +102 -4
  48. package/src/data-structures/binary-tree/binary-tree.ts +239 -78
  49. package/src/data-structures/binary-tree/bst.ts +542 -13
  50. package/src/data-structures/binary-tree/red-black-tree.ts +155 -15
  51. package/src/data-structures/binary-tree/segment-tree.ts +42 -0
  52. package/src/data-structures/binary-tree/tree-map.ts +1223 -261
  53. package/src/data-structures/binary-tree/tree-multi-map.ts +939 -30
  54. package/src/data-structures/binary-tree/tree-multi-set.ts +746 -10
  55. package/src/data-structures/binary-tree/tree-set.ts +1018 -99
  56. package/src/data-structures/graph/abstract-graph.ts +2 -2
  57. package/src/data-structures/graph/directed-graph.ts +71 -1
  58. package/src/data-structures/graph/undirected-graph.ts +64 -1
  59. package/src/data-structures/hash/hash-map.ts +102 -16
  60. package/src/data-structures/heap/heap.ts +153 -23
  61. package/src/data-structures/heap/max-heap.ts +2 -2
  62. package/src/data-structures/linked-list/doubly-linked-list.ts +139 -0
  63. package/src/data-structures/linked-list/singly-linked-list.ts +106 -1
  64. package/src/data-structures/linked-list/skip-linked-list.ts +131 -5
  65. package/src/data-structures/matrix/matrix.ts +65 -9
  66. package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
  67. package/src/data-structures/queue/deque.ts +130 -0
  68. package/src/data-structures/queue/queue.ts +109 -0
  69. package/src/data-structures/stack/stack.ts +75 -5
  70. package/src/data-structures/trie/trie.ts +86 -2
  71. package/src/interfaces/binary-tree.ts +1 -9
  72. package/src/types/data-structures/binary-tree/bst.ts +1 -0
  73. package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
  74. package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
  75. package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
@@ -3,6 +3,61 @@
3
3
  var __defProp = Object.defineProperty;
4
4
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
5
 
6
+ // src/common/error.ts
7
+ function raise(ErrorClass, message) {
8
+ throw new ErrorClass(message);
9
+ }
10
+ __name(raise, "raise");
11
+ var ERR = {
12
+ // Range / index
13
+ indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
14
+ invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
15
+ // Type / argument
16
+ invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
17
+ comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
18
+ invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
19
+ notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
20
+ invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
21
+ invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
22
+ invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
23
+ reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
24
+ callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
25
+ // State / operation
26
+ invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
27
+ // Matrix
28
+ matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
29
+ matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
30
+ matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
31
+ matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
32
+ matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch"),
33
+ // Order statistic
34
+ orderStatisticNotEnabled: /* @__PURE__ */ __name((method, ctx) => `${ctx ? ctx + ": " : ""}${method}() requires enableOrderStatistic: true.`, "orderStatisticNotEnabled")
35
+ };
36
+
37
+ // src/common/index.ts
38
+ var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
39
+ DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
40
+ DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
41
+ return DFSOperation2;
42
+ })(DFSOperation || {});
43
+ var Range = class {
44
+ constructor(low, high, includeLow = true, includeHigh = true) {
45
+ this.low = low;
46
+ this.high = high;
47
+ this.includeLow = includeLow;
48
+ this.includeHigh = includeHigh;
49
+ }
50
+ static {
51
+ __name(this, "Range");
52
+ }
53
+ // Determine whether a key is within the range
54
+ isInRange(key, comparator) {
55
+ const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
56
+ const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
57
+ return lowCheck && highCheck;
58
+ }
59
+ };
60
+
6
61
  // src/data-structures/base/iterable-element-base.ts
7
62
  var IterableElementBase = class {
8
63
  static {
@@ -21,7 +76,7 @@ var IterableElementBase = class {
21
76
  if (options) {
22
77
  const { toElementFn } = options;
23
78
  if (typeof toElementFn === "function") this._toElementFn = toElementFn;
24
- else if (toElementFn) throw new TypeError("toElementFn must be a function type");
79
+ else if (toElementFn) raise(TypeError, "toElementFn must be a function type");
25
80
  }
26
81
  }
27
82
  /**
@@ -184,7 +239,7 @@ var IterableElementBase = class {
184
239
  acc = initialValue;
185
240
  } else {
186
241
  const first = iter.next();
187
- if (first.done) throw new TypeError("Reduce of empty structure with no initial value");
242
+ if (first.done) raise(TypeError, "Reduce of empty structure with no initial value");
188
243
  acc = first.value;
189
244
  index = 1;
190
245
  }
@@ -753,6 +808,13 @@ var SinglyLinkedList = class extends LinearLinkedBase {
753
808
 
754
809
 
755
810
 
811
+
812
+
813
+
814
+
815
+
816
+
817
+
756
818
 
757
819
 
758
820
 
@@ -817,6 +879,13 @@ var SinglyLinkedList = class extends LinearLinkedBase {
817
879
 
818
880
 
819
881
 
882
+
883
+
884
+
885
+
886
+
887
+
888
+
820
889
 
821
890
 
822
891
 
@@ -886,6 +955,13 @@ var SinglyLinkedList = class extends LinearLinkedBase {
886
955
 
887
956
 
888
957
 
958
+
959
+
960
+
961
+
962
+
963
+
964
+
889
965
 
890
966
 
891
967
 
@@ -937,6 +1013,13 @@ var SinglyLinkedList = class extends LinearLinkedBase {
937
1013
 
938
1014
 
939
1015
 
1016
+
1017
+
1018
+
1019
+
1020
+
1021
+
1022
+
940
1023
 
941
1024
 
942
1025
 
@@ -1049,6 +1132,13 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1049
1132
 
1050
1133
 
1051
1134
 
1135
+
1136
+
1137
+
1138
+
1139
+
1140
+
1141
+
1052
1142
 
1053
1143
 
1054
1144
 
@@ -1105,6 +1195,13 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1105
1195
 
1106
1196
 
1107
1197
 
1198
+
1199
+
1200
+
1201
+
1202
+
1203
+
1204
+
1108
1205
 
1109
1206
 
1110
1207
 
@@ -1150,6 +1247,13 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1150
1247
 
1151
1248
 
1152
1249
 
1250
+
1251
+
1252
+
1253
+
1254
+
1255
+
1256
+
1153
1257
 
1154
1258
 
1155
1259
 
@@ -1201,6 +1305,13 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1201
1305
 
1202
1306
 
1203
1307
 
1308
+
1309
+
1310
+
1311
+
1312
+
1313
+
1314
+
1204
1315
 
1205
1316
 
1206
1317
 
@@ -1257,6 +1368,13 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1257
1368
 
1258
1369
 
1259
1370
 
1371
+
1372
+
1373
+
1374
+
1375
+
1376
+
1377
+
1260
1378
 
1261
1379
 
1262
1380
 
@@ -1321,6 +1439,13 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1321
1439
 
1322
1440
 
1323
1441
 
1442
+
1443
+
1444
+
1445
+
1446
+
1447
+
1448
+
1324
1449
 
1325
1450
 
1326
1451
 
@@ -1362,6 +1487,13 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1362
1487
 
1363
1488
 
1364
1489
 
1490
+
1491
+
1492
+
1493
+
1494
+
1495
+
1496
+
1365
1497
 
1366
1498
 
1367
1499
 
@@ -1409,6 +1541,13 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1409
1541
 
1410
1542
 
1411
1543
 
1544
+
1545
+
1546
+
1547
+
1548
+
1549
+
1550
+
1412
1551
 
1413
1552
 
1414
1553
 
@@ -1622,6 +1761,13 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1622
1761
 
1623
1762
 
1624
1763
 
1764
+
1765
+
1766
+
1767
+
1768
+
1769
+
1770
+
1625
1771
 
1626
1772
 
1627
1773
 
@@ -1673,6 +1819,13 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1673
1819
 
1674
1820
 
1675
1821
 
1822
+
1823
+
1824
+
1825
+
1826
+
1827
+
1828
+
1676
1829
 
1677
1830
 
1678
1831
 
@@ -1752,6 +1905,13 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1752
1905
 
1753
1906
 
1754
1907
 
1908
+
1909
+
1910
+
1911
+
1912
+
1913
+
1914
+
1755
1915
 
1756
1916
 
1757
1917
 
@@ -1900,55 +2060,6 @@ function elementOrPredicate(input, equals) {
1900
2060
  }
1901
2061
  __name(elementOrPredicate, "elementOrPredicate");
1902
2062
 
1903
- // src/common/error.ts
1904
- var ERR = {
1905
- // Range / index
1906
- indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
1907
- invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
1908
- // Type / argument
1909
- invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
1910
- comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
1911
- invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
1912
- notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
1913
- invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
1914
- invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
1915
- invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
1916
- reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
1917
- callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
1918
- // State / operation
1919
- invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
1920
- // Matrix
1921
- matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
1922
- matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
1923
- matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
1924
- matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
1925
- matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch")
1926
- };
1927
-
1928
- // src/common/index.ts
1929
- var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
1930
- DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
1931
- DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
1932
- return DFSOperation2;
1933
- })(DFSOperation || {});
1934
- var Range = class {
1935
- constructor(low, high, includeLow = true, includeHigh = true) {
1936
- this.low = low;
1937
- this.high = high;
1938
- this.includeLow = includeLow;
1939
- this.includeHigh = includeHigh;
1940
- }
1941
- static {
1942
- __name(this, "Range");
1943
- }
1944
- // Determine whether a key is within the range
1945
- isInRange(key, comparator) {
1946
- const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
1947
- const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
1948
- return lowCheck && highCheck;
1949
- }
1950
- };
1951
-
1952
2063
  // src/data-structures/queue/queue.ts
1953
2064
  var Queue = class _Queue extends LinearBase {
1954
2065
  static {
@@ -2033,6 +2144,13 @@ var Queue = class _Queue extends LinearBase {
2033
2144
 
2034
2145
 
2035
2146
 
2147
+
2148
+
2149
+
2150
+
2151
+
2152
+
2153
+
2036
2154
 
2037
2155
 
2038
2156
 
@@ -2080,6 +2198,13 @@ var Queue = class _Queue extends LinearBase {
2080
2198
 
2081
2199
 
2082
2200
 
2201
+
2202
+
2203
+
2204
+
2205
+
2206
+
2207
+
2083
2208
 
2084
2209
 
2085
2210
 
@@ -2097,6 +2222,14 @@ var Queue = class _Queue extends LinearBase {
2097
2222
  get first() {
2098
2223
  return this.length > 0 ? this.elements[this._offset] : void 0;
2099
2224
  }
2225
+ /**
2226
+ * Peek at the front element without removing it (alias for `first`).
2227
+ * @remarks Time O(1), Space O(1)
2228
+ * @returns Front element or undefined.
2229
+ */
2230
+ peek() {
2231
+ return this.first;
2232
+ }
2100
2233
  /**
2101
2234
  * Get the last element (back) without removing it.
2102
2235
  * @remarks Time O(1), Space O(1)
@@ -2143,6 +2276,13 @@ var Queue = class _Queue extends LinearBase {
2143
2276
 
2144
2277
 
2145
2278
 
2279
+
2280
+
2281
+
2282
+
2283
+
2284
+
2285
+
2146
2286
 
2147
2287
 
2148
2288
 
@@ -2202,6 +2342,13 @@ var Queue = class _Queue extends LinearBase {
2202
2342
 
2203
2343
 
2204
2344
 
2345
+
2346
+
2347
+
2348
+
2349
+
2350
+
2351
+
2205
2352
 
2206
2353
 
2207
2354
 
@@ -2268,6 +2415,13 @@ var Queue = class _Queue extends LinearBase {
2268
2415
 
2269
2416
 
2270
2417
 
2418
+
2419
+
2420
+
2421
+
2422
+
2423
+
2424
+
2271
2425
 
2272
2426
 
2273
2427
 
@@ -2324,6 +2478,13 @@ var Queue = class _Queue extends LinearBase {
2324
2478
 
2325
2479
 
2326
2480
 
2481
+
2482
+
2483
+
2484
+
2485
+
2486
+
2487
+
2327
2488
 
2328
2489
 
2329
2490
 
@@ -2373,6 +2534,13 @@ var Queue = class _Queue extends LinearBase {
2373
2534
 
2374
2535
 
2375
2536
 
2537
+
2538
+
2539
+
2540
+
2541
+
2542
+
2543
+
2376
2544
 
2377
2545
 
2378
2546
 
@@ -2427,6 +2595,21 @@ var Queue = class _Queue extends LinearBase {
2427
2595
  this._elements[this._offset + index] = newElement;
2428
2596
  return true;
2429
2597
  }
2598
+ /**
2599
+ * Delete the first element that satisfies a predicate.
2600
+ * @remarks Time O(N), Space O(N)
2601
+ * @param predicate - Function (value, index, queue) → boolean to decide deletion.
2602
+ * @returns True if a match was removed.
2603
+ */
2604
+ deleteWhere(predicate) {
2605
+ for (let i = 0; i < this.length; i++) {
2606
+ if (predicate(this._elements[this._offset + i], i, this)) {
2607
+ this.deleteAt(i);
2608
+ return true;
2609
+ }
2610
+ }
2611
+ return false;
2612
+ }
2430
2613
  /**
2431
2614
  * Reverse the queue in-place by compacting then reversing.
2432
2615
  * @remarks Time O(N), Space O(N)
@@ -2463,6 +2646,13 @@ var Queue = class _Queue extends LinearBase {
2463
2646
 
2464
2647
 
2465
2648
 
2649
+
2650
+
2651
+
2652
+
2653
+
2654
+
2655
+
2466
2656
 
2467
2657
 
2468
2658
 
@@ -2506,6 +2696,13 @@ var Queue = class _Queue extends LinearBase {
2506
2696
 
2507
2697
 
2508
2698
 
2699
+
2700
+
2701
+
2702
+
2703
+
2704
+
2705
+
2509
2706
 
2510
2707
 
2511
2708
 
@@ -2572,6 +2769,13 @@ var Queue = class _Queue extends LinearBase {
2572
2769
 
2573
2770
 
2574
2771
 
2772
+
2773
+
2774
+
2775
+
2776
+
2777
+
2778
+
2575
2779
 
2576
2780
 
2577
2781
 
@@ -2622,6 +2826,13 @@ var Queue = class _Queue extends LinearBase {
2622
2826
 
2623
2827
 
2624
2828
 
2829
+
2830
+
2831
+
2832
+
2833
+
2834
+
2835
+
2625
2836
 
2626
2837
 
2627
2838
 
@@ -2676,6 +2887,13 @@ var Queue = class _Queue extends LinearBase {
2676
2887
 
2677
2888
 
2678
2889
 
2890
+
2891
+
2892
+
2893
+
2894
+
2895
+
2896
+
2679
2897
 
2680
2898
 
2681
2899
 
@@ -2952,6 +3170,12 @@ var Deque = class extends LinearBase {
2952
3170
 
2953
3171
 
2954
3172
 
3173
+
3174
+
3175
+
3176
+
3177
+
3178
+
2955
3179
 
2956
3180
 
2957
3181
 
@@ -2972,6 +3196,31 @@ var Deque = class extends LinearBase {
2972
3196
  * console.log(last); // 50;
2973
3197
  *
2974
3198
  * // Length unchanged
3199
+ * console.log(deque.length); // 5;
3200
+ */
3201
+ /**
3202
+ * Peek at the front element without removing it (alias for `first`).
3203
+ * @remarks Time O(1), Space O(1)
3204
+ * @returns Front element or undefined.
3205
+ */
3206
+ peek() {
3207
+ return this.first;
3208
+ }
3209
+ /**
3210
+ * Deque peek at both ends
3211
+ * @example
3212
+ * // Deque peek at both ends
3213
+ * const deque = new Deque<number>([10, 20, 30, 40, 50]);
3214
+ *
3215
+ * // Get first element without removing
3216
+ * const first = deque.at(0);
3217
+ * console.log(first); // 10;
3218
+ *
3219
+ * // Get last element without removing
3220
+ * const last = deque.at(deque.length - 1);
3221
+ * console.log(last); // 50;
3222
+ *
3223
+ * // Length unchanged
2975
3224
  * console.log(deque.length); // 5;
2976
3225
  */
2977
3226
  get first() {
@@ -3006,6 +3255,13 @@ var Deque = class extends LinearBase {
3006
3255
 
3007
3256
 
3008
3257
 
3258
+
3259
+
3260
+
3261
+
3262
+
3263
+
3264
+
3009
3265
 
3010
3266
 
3011
3267
 
@@ -3066,6 +3322,13 @@ var Deque = class extends LinearBase {
3066
3322
 
3067
3323
 
3068
3324
 
3325
+
3326
+
3327
+
3328
+
3329
+
3330
+
3331
+
3069
3332
 
3070
3333
 
3071
3334
 
@@ -3139,6 +3402,13 @@ var Deque = class extends LinearBase {
3139
3402
 
3140
3403
 
3141
3404
 
3405
+
3406
+
3407
+
3408
+
3409
+
3410
+
3411
+
3142
3412
 
3143
3413
 
3144
3414
 
@@ -3199,6 +3469,13 @@ var Deque = class extends LinearBase {
3199
3469
 
3200
3470
 
3201
3471
 
3472
+
3473
+
3474
+
3475
+
3476
+
3477
+
3478
+
3202
3479
 
3203
3480
 
3204
3481
 
@@ -3260,6 +3537,13 @@ var Deque = class extends LinearBase {
3260
3537
 
3261
3538
 
3262
3539
 
3540
+
3541
+
3542
+
3543
+
3544
+
3545
+
3546
+
3263
3547
 
3264
3548
 
3265
3549
 
@@ -3362,6 +3646,13 @@ var Deque = class extends LinearBase {
3362
3646
 
3363
3647
 
3364
3648
 
3649
+
3650
+
3651
+
3652
+
3653
+
3654
+
3655
+
3365
3656
 
3366
3657
 
3367
3658
 
@@ -3404,6 +3695,13 @@ var Deque = class extends LinearBase {
3404
3695
 
3405
3696
 
3406
3697
 
3698
+
3699
+
3700
+
3701
+
3702
+
3703
+
3704
+
3407
3705
 
3408
3706
 
3409
3707
 
@@ -3450,6 +3748,13 @@ var Deque = class extends LinearBase {
3450
3748
 
3451
3749
 
3452
3750
 
3751
+
3752
+
3753
+
3754
+
3755
+
3756
+
3757
+
3453
3758
 
3454
3759
 
3455
3760
 
@@ -3647,6 +3952,13 @@ var Deque = class extends LinearBase {
3647
3952
 
3648
3953
 
3649
3954
 
3955
+
3956
+
3957
+
3958
+
3959
+
3960
+
3961
+
3650
3962
 
3651
3963
 
3652
3964
 
@@ -3731,6 +4043,13 @@ var Deque = class extends LinearBase {
3731
4043
 
3732
4044
 
3733
4045
 
4046
+
4047
+
4048
+
4049
+
4050
+
4051
+
4052
+
3734
4053
 
3735
4054
 
3736
4055
 
@@ -3840,6 +4159,13 @@ var Deque = class extends LinearBase {
3840
4159
 
3841
4160
 
3842
4161
 
4162
+
4163
+
4164
+
4165
+
4166
+
4167
+
4168
+
3843
4169
 
3844
4170
 
3845
4171
 
@@ -3908,6 +4234,13 @@ var Deque = class extends LinearBase {
3908
4234
 
3909
4235
 
3910
4236
 
4237
+
4238
+
4239
+
4240
+
4241
+
4242
+
4243
+
3911
4244
 
3912
4245
 
3913
4246
 
@@ -3959,6 +4292,13 @@ var Deque = class extends LinearBase {
3959
4292
 
3960
4293
 
3961
4294
 
4295
+
4296
+
4297
+
4298
+
4299
+
4300
+
4301
+
3962
4302
 
3963
4303
 
3964
4304
 
@@ -4030,6 +4370,13 @@ var Deque = class extends LinearBase {
4030
4370
 
4031
4371
 
4032
4372
 
4373
+
4374
+
4375
+
4376
+
4377
+
4378
+
4379
+
4033
4380
 
4034
4381
 
4035
4382
 
@@ -4180,5 +4527,6 @@ exports.ERR = ERR;
4180
4527
  exports.LinkedListQueue = LinkedListQueue;
4181
4528
  exports.Queue = Queue;
4182
4529
  exports.Range = Range;
4530
+ exports.raise = raise;
4183
4531
  //# sourceMappingURL=index.cjs.map
4184
4532
  //# sourceMappingURL=index.cjs.map