deque-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.
- package/dist/cjs/index.cjs +187 -51
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs-legacy/index.cjs +186 -50
- package/dist/cjs-legacy/index.cjs.map +1 -1
- package/dist/esm/index.mjs +187 -52
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm-legacy/index.mjs +186 -51
- package/dist/esm-legacy/index.mjs.map +1 -1
- package/dist/types/common/error.d.ts +9 -0
- package/dist/types/common/index.d.ts +1 -1
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +86 -2
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +98 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +189 -13
- package/dist/types/data-structures/binary-tree/bst.d.ts +270 -3
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +136 -8
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +42 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +1089 -161
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +1243 -350
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +980 -255
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +1174 -284
- package/dist/types/data-structures/graph/directed-graph.d.ts +70 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +63 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +84 -6
- package/dist/types/data-structures/heap/heap.d.ts +140 -12
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +126 -0
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +106 -1
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +126 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +56 -0
- package/dist/types/data-structures/queue/deque.d.ts +127 -0
- package/dist/types/data-structures/queue/queue.d.ts +97 -0
- package/dist/types/data-structures/stack/stack.d.ts +72 -2
- package/dist/types/data-structures/trie/trie.d.ts +84 -0
- package/dist/types/interfaces/binary-tree.d.ts +2 -3
- package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
- package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
- package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
- package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
- package/dist/umd/deque-typed.js +184 -49
- package/dist/umd/deque-typed.js.map +1 -1
- package/dist/umd/deque-typed.min.js +1 -1
- package/dist/umd/deque-typed.min.js.map +1 -1
- package/package.json +2 -2
- package/src/common/error.ts +19 -1
- package/src/common/index.ts +1 -1
- package/src/data-structures/base/iterable-element-base.ts +3 -2
- package/src/data-structures/binary-tree/avl-tree.ts +99 -5
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +102 -4
- package/src/data-structures/binary-tree/binary-tree.ts +239 -78
- package/src/data-structures/binary-tree/bst.ts +542 -13
- package/src/data-structures/binary-tree/red-black-tree.ts +155 -15
- package/src/data-structures/binary-tree/segment-tree.ts +42 -0
- package/src/data-structures/binary-tree/tree-map.ts +1223 -261
- package/src/data-structures/binary-tree/tree-multi-map.ts +939 -30
- package/src/data-structures/binary-tree/tree-multi-set.ts +746 -10
- package/src/data-structures/binary-tree/tree-set.ts +1018 -99
- package/src/data-structures/graph/abstract-graph.ts +2 -2
- package/src/data-structures/graph/directed-graph.ts +71 -1
- package/src/data-structures/graph/undirected-graph.ts +64 -1
- package/src/data-structures/hash/hash-map.ts +102 -16
- package/src/data-structures/heap/heap.ts +153 -23
- package/src/data-structures/heap/max-heap.ts +2 -2
- package/src/data-structures/linked-list/doubly-linked-list.ts +139 -0
- package/src/data-structures/linked-list/singly-linked-list.ts +106 -1
- package/src/data-structures/linked-list/skip-linked-list.ts +131 -5
- package/src/data-structures/matrix/matrix.ts +65 -9
- package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
- package/src/data-structures/queue/deque.ts +130 -0
- package/src/data-structures/queue/queue.ts +109 -0
- package/src/data-structures/stack/stack.ts +75 -5
- package/src/data-structures/trie/trie.ts +86 -2
- package/src/interfaces/binary-tree.ts +1 -9
- package/src/types/data-structures/binary-tree/bst.ts +1 -0
- package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
- package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
- package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
|
@@ -13,6 +13,60 @@ var rangeCheck = /* @__PURE__ */ __name((index, min, max, message) => {
|
|
|
13
13
|
}, "rangeCheck");
|
|
14
14
|
var calcMinUnitsRequired = /* @__PURE__ */ __name((totalQuantity, unitSize) => Math.floor((totalQuantity + unitSize - 1) / unitSize), "calcMinUnitsRequired");
|
|
15
15
|
|
|
16
|
+
// src/common/error.ts
|
|
17
|
+
function raise(ErrorClass, message) {
|
|
18
|
+
throw new ErrorClass(message);
|
|
19
|
+
}
|
|
20
|
+
__name(raise, "raise");
|
|
21
|
+
var ERR = {
|
|
22
|
+
// Range / index
|
|
23
|
+
indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
|
|
24
|
+
invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
|
|
25
|
+
// Type / argument
|
|
26
|
+
invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
|
|
27
|
+
comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
|
|
28
|
+
invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
|
|
29
|
+
notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
|
|
30
|
+
invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
|
|
31
|
+
invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
|
|
32
|
+
invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
|
|
33
|
+
reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
|
|
34
|
+
callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
|
|
35
|
+
// State / operation
|
|
36
|
+
invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
|
|
37
|
+
// Matrix
|
|
38
|
+
matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
|
|
39
|
+
matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
|
|
40
|
+
matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
|
|
41
|
+
matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
|
|
42
|
+
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch"),
|
|
43
|
+
// Order statistic
|
|
44
|
+
orderStatisticNotEnabled: /* @__PURE__ */ __name((method, ctx) => `${ctx ? ctx + ": " : ""}${method}() requires enableOrderStatistic: true.`, "orderStatisticNotEnabled")
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// src/common/index.ts
|
|
48
|
+
var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
|
|
49
|
+
DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
|
|
50
|
+
DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
|
|
51
|
+
return DFSOperation2;
|
|
52
|
+
})(DFSOperation || {});
|
|
53
|
+
var _Range = class _Range {
|
|
54
|
+
constructor(low, high, includeLow = true, includeHigh = true) {
|
|
55
|
+
this.low = low;
|
|
56
|
+
this.high = high;
|
|
57
|
+
this.includeLow = includeLow;
|
|
58
|
+
this.includeHigh = includeHigh;
|
|
59
|
+
}
|
|
60
|
+
// Determine whether a key is within the range
|
|
61
|
+
isInRange(key, comparator) {
|
|
62
|
+
const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
|
|
63
|
+
const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
|
|
64
|
+
return lowCheck && highCheck;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
__name(_Range, "Range");
|
|
68
|
+
var Range = _Range;
|
|
69
|
+
|
|
16
70
|
// src/data-structures/base/iterable-element-base.ts
|
|
17
71
|
var _IterableElementBase = class _IterableElementBase {
|
|
18
72
|
/**
|
|
@@ -35,7 +89,7 @@ var _IterableElementBase = class _IterableElementBase {
|
|
|
35
89
|
if (options) {
|
|
36
90
|
const { toElementFn } = options;
|
|
37
91
|
if (typeof toElementFn === "function") this._toElementFn = toElementFn;
|
|
38
|
-
else if (toElementFn)
|
|
92
|
+
else if (toElementFn) raise(TypeError, "toElementFn must be a function type");
|
|
39
93
|
}
|
|
40
94
|
}
|
|
41
95
|
/**
|
|
@@ -191,7 +245,7 @@ var _IterableElementBase = class _IterableElementBase {
|
|
|
191
245
|
acc = initialValue;
|
|
192
246
|
} else {
|
|
193
247
|
const first = iter.next();
|
|
194
|
-
if (first.done)
|
|
248
|
+
if (first.done) raise(TypeError, "Reduce of empty structure with no initial value");
|
|
195
249
|
acc = first.value;
|
|
196
250
|
index = 1;
|
|
197
251
|
}
|
|
@@ -577,6 +631,12 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
577
631
|
|
|
578
632
|
|
|
579
633
|
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
580
640
|
|
|
581
641
|
|
|
582
642
|
|
|
@@ -597,6 +657,31 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
597
657
|
* console.log(last); // 50;
|
|
598
658
|
*
|
|
599
659
|
* // Length unchanged
|
|
660
|
+
* console.log(deque.length); // 5;
|
|
661
|
+
*/
|
|
662
|
+
/**
|
|
663
|
+
* Peek at the front element without removing it (alias for `first`).
|
|
664
|
+
* @remarks Time O(1), Space O(1)
|
|
665
|
+
* @returns Front element or undefined.
|
|
666
|
+
*/
|
|
667
|
+
peek() {
|
|
668
|
+
return this.first;
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Deque peek at both ends
|
|
672
|
+
* @example
|
|
673
|
+
* // Deque peek at both ends
|
|
674
|
+
* const deque = new Deque<number>([10, 20, 30, 40, 50]);
|
|
675
|
+
*
|
|
676
|
+
* // Get first element without removing
|
|
677
|
+
* const first = deque.at(0);
|
|
678
|
+
* console.log(first); // 10;
|
|
679
|
+
*
|
|
680
|
+
* // Get last element without removing
|
|
681
|
+
* const last = deque.at(deque.length - 1);
|
|
682
|
+
* console.log(last); // 50;
|
|
683
|
+
*
|
|
684
|
+
* // Length unchanged
|
|
600
685
|
* console.log(deque.length); // 5;
|
|
601
686
|
*/
|
|
602
687
|
get first() {
|
|
@@ -631,6 +716,13 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
631
716
|
|
|
632
717
|
|
|
633
718
|
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
|
|
634
726
|
|
|
635
727
|
|
|
636
728
|
|
|
@@ -691,6 +783,13 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
691
783
|
|
|
692
784
|
|
|
693
785
|
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
|
|
694
793
|
|
|
695
794
|
|
|
696
795
|
|
|
@@ -764,6 +863,13 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
764
863
|
|
|
765
864
|
|
|
766
865
|
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
|
|
767
873
|
|
|
768
874
|
|
|
769
875
|
|
|
@@ -824,6 +930,13 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
824
930
|
|
|
825
931
|
|
|
826
932
|
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
|
|
827
940
|
|
|
828
941
|
|
|
829
942
|
|
|
@@ -885,6 +998,13 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
885
998
|
|
|
886
999
|
|
|
887
1000
|
|
|
1001
|
+
|
|
1002
|
+
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
|
|
1006
|
+
|
|
1007
|
+
|
|
888
1008
|
|
|
889
1009
|
|
|
890
1010
|
|
|
@@ -987,6 +1107,13 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
987
1107
|
|
|
988
1108
|
|
|
989
1109
|
|
|
1110
|
+
|
|
1111
|
+
|
|
1112
|
+
|
|
1113
|
+
|
|
1114
|
+
|
|
1115
|
+
|
|
1116
|
+
|
|
990
1117
|
|
|
991
1118
|
|
|
992
1119
|
|
|
@@ -1029,6 +1156,13 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1029
1156
|
|
|
1030
1157
|
|
|
1031
1158
|
|
|
1159
|
+
|
|
1160
|
+
|
|
1161
|
+
|
|
1162
|
+
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
|
|
1032
1166
|
|
|
1033
1167
|
|
|
1034
1168
|
|
|
@@ -1075,6 +1209,13 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1075
1209
|
|
|
1076
1210
|
|
|
1077
1211
|
|
|
1212
|
+
|
|
1213
|
+
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
|
|
1217
|
+
|
|
1218
|
+
|
|
1078
1219
|
|
|
1079
1220
|
|
|
1080
1221
|
|
|
@@ -1272,6 +1413,13 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1272
1413
|
|
|
1273
1414
|
|
|
1274
1415
|
|
|
1416
|
+
|
|
1417
|
+
|
|
1418
|
+
|
|
1419
|
+
|
|
1420
|
+
|
|
1421
|
+
|
|
1422
|
+
|
|
1275
1423
|
|
|
1276
1424
|
|
|
1277
1425
|
|
|
@@ -1356,6 +1504,13 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1356
1504
|
|
|
1357
1505
|
|
|
1358
1506
|
|
|
1507
|
+
|
|
1508
|
+
|
|
1509
|
+
|
|
1510
|
+
|
|
1511
|
+
|
|
1512
|
+
|
|
1513
|
+
|
|
1359
1514
|
|
|
1360
1515
|
|
|
1361
1516
|
|
|
@@ -1465,6 +1620,13 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1465
1620
|
|
|
1466
1621
|
|
|
1467
1622
|
|
|
1623
|
+
|
|
1624
|
+
|
|
1625
|
+
|
|
1626
|
+
|
|
1627
|
+
|
|
1628
|
+
|
|
1629
|
+
|
|
1468
1630
|
|
|
1469
1631
|
|
|
1470
1632
|
|
|
@@ -1533,6 +1695,13 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1533
1695
|
|
|
1534
1696
|
|
|
1535
1697
|
|
|
1698
|
+
|
|
1699
|
+
|
|
1700
|
+
|
|
1701
|
+
|
|
1702
|
+
|
|
1703
|
+
|
|
1704
|
+
|
|
1536
1705
|
|
|
1537
1706
|
|
|
1538
1707
|
|
|
@@ -1584,6 +1753,13 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1584
1753
|
|
|
1585
1754
|
|
|
1586
1755
|
|
|
1756
|
+
|
|
1757
|
+
|
|
1758
|
+
|
|
1759
|
+
|
|
1760
|
+
|
|
1761
|
+
|
|
1762
|
+
|
|
1587
1763
|
|
|
1588
1764
|
|
|
1589
1765
|
|
|
@@ -1655,6 +1831,13 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1655
1831
|
|
|
1656
1832
|
|
|
1657
1833
|
|
|
1834
|
+
|
|
1835
|
+
|
|
1836
|
+
|
|
1837
|
+
|
|
1838
|
+
|
|
1839
|
+
|
|
1840
|
+
|
|
1658
1841
|
|
|
1659
1842
|
|
|
1660
1843
|
|
|
@@ -1793,54 +1976,6 @@ var _Deque = class _Deque extends LinearBase {
|
|
|
1793
1976
|
};
|
|
1794
1977
|
__name(_Deque, "Deque");
|
|
1795
1978
|
var Deque = _Deque;
|
|
1796
|
-
|
|
1797
|
-
// src/common/error.ts
|
|
1798
|
-
var ERR = {
|
|
1799
|
-
// Range / index
|
|
1800
|
-
indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
|
|
1801
|
-
invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
|
|
1802
|
-
// Type / argument
|
|
1803
|
-
invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
|
|
1804
|
-
comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
|
|
1805
|
-
invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
|
|
1806
|
-
notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
|
|
1807
|
-
invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
|
|
1808
|
-
invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
|
|
1809
|
-
invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
|
|
1810
|
-
reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
|
|
1811
|
-
callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
|
|
1812
|
-
// State / operation
|
|
1813
|
-
invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
|
|
1814
|
-
// Matrix
|
|
1815
|
-
matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
|
|
1816
|
-
matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
|
|
1817
|
-
matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
|
|
1818
|
-
matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
|
|
1819
|
-
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch")
|
|
1820
|
-
};
|
|
1821
|
-
|
|
1822
|
-
// src/common/index.ts
|
|
1823
|
-
var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
|
|
1824
|
-
DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
|
|
1825
|
-
DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
|
|
1826
|
-
return DFSOperation2;
|
|
1827
|
-
})(DFSOperation || {});
|
|
1828
|
-
var _Range = class _Range {
|
|
1829
|
-
constructor(low, high, includeLow = true, includeHigh = true) {
|
|
1830
|
-
this.low = low;
|
|
1831
|
-
this.high = high;
|
|
1832
|
-
this.includeLow = includeLow;
|
|
1833
|
-
this.includeHigh = includeHigh;
|
|
1834
|
-
}
|
|
1835
|
-
// Determine whether a key is within the range
|
|
1836
|
-
isInRange(key, comparator) {
|
|
1837
|
-
const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
|
|
1838
|
-
const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
|
|
1839
|
-
return lowCheck && highCheck;
|
|
1840
|
-
}
|
|
1841
|
-
};
|
|
1842
|
-
__name(_Range, "Range");
|
|
1843
|
-
var Range = _Range;
|
|
1844
1979
|
/**
|
|
1845
1980
|
* data-structure-typed
|
|
1846
1981
|
*
|
|
@@ -1853,5 +1988,6 @@ exports.DFSOperation = DFSOperation;
|
|
|
1853
1988
|
exports.Deque = Deque;
|
|
1854
1989
|
exports.ERR = ERR;
|
|
1855
1990
|
exports.Range = Range;
|
|
1991
|
+
exports.raise = raise;
|
|
1856
1992
|
//# sourceMappingURL=index.cjs.map
|
|
1857
1993
|
//# sourceMappingURL=index.cjs.map
|