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
package/dist/esm/index.mjs
CHANGED
|
@@ -9,6 +9,61 @@ var rangeCheck = /* @__PURE__ */ __name((index, min, max, message) => {
|
|
|
9
9
|
}, "rangeCheck");
|
|
10
10
|
var calcMinUnitsRequired = /* @__PURE__ */ __name((totalQuantity, unitSize) => Math.floor((totalQuantity + unitSize - 1) / unitSize), "calcMinUnitsRequired");
|
|
11
11
|
|
|
12
|
+
// src/common/error.ts
|
|
13
|
+
function raise(ErrorClass, message) {
|
|
14
|
+
throw new ErrorClass(message);
|
|
15
|
+
}
|
|
16
|
+
__name(raise, "raise");
|
|
17
|
+
var ERR = {
|
|
18
|
+
// Range / index
|
|
19
|
+
indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
|
|
20
|
+
invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
|
|
21
|
+
// Type / argument
|
|
22
|
+
invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
|
|
23
|
+
comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
|
|
24
|
+
invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
|
|
25
|
+
notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
|
|
26
|
+
invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
|
|
27
|
+
invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
|
|
28
|
+
invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
|
|
29
|
+
reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
|
|
30
|
+
callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
|
|
31
|
+
// State / operation
|
|
32
|
+
invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
|
|
33
|
+
// Matrix
|
|
34
|
+
matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
|
|
35
|
+
matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
|
|
36
|
+
matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
|
|
37
|
+
matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
|
|
38
|
+
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch"),
|
|
39
|
+
// Order statistic
|
|
40
|
+
orderStatisticNotEnabled: /* @__PURE__ */ __name((method, ctx) => `${ctx ? ctx + ": " : ""}${method}() requires enableOrderStatistic: true.`, "orderStatisticNotEnabled")
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// src/common/index.ts
|
|
44
|
+
var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
|
|
45
|
+
DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
|
|
46
|
+
DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
|
|
47
|
+
return DFSOperation2;
|
|
48
|
+
})(DFSOperation || {});
|
|
49
|
+
var Range = class {
|
|
50
|
+
constructor(low, high, includeLow = true, includeHigh = true) {
|
|
51
|
+
this.low = low;
|
|
52
|
+
this.high = high;
|
|
53
|
+
this.includeLow = includeLow;
|
|
54
|
+
this.includeHigh = includeHigh;
|
|
55
|
+
}
|
|
56
|
+
static {
|
|
57
|
+
__name(this, "Range");
|
|
58
|
+
}
|
|
59
|
+
// Determine whether a key is within the range
|
|
60
|
+
isInRange(key, comparator) {
|
|
61
|
+
const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
|
|
62
|
+
const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
|
|
63
|
+
return lowCheck && highCheck;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
12
67
|
// src/data-structures/base/iterable-element-base.ts
|
|
13
68
|
var IterableElementBase = class {
|
|
14
69
|
static {
|
|
@@ -27,7 +82,7 @@ var IterableElementBase = class {
|
|
|
27
82
|
if (options) {
|
|
28
83
|
const { toElementFn } = options;
|
|
29
84
|
if (typeof toElementFn === "function") this._toElementFn = toElementFn;
|
|
30
|
-
else if (toElementFn)
|
|
85
|
+
else if (toElementFn) raise(TypeError, "toElementFn must be a function type");
|
|
31
86
|
}
|
|
32
87
|
}
|
|
33
88
|
/**
|
|
@@ -190,7 +245,7 @@ var IterableElementBase = class {
|
|
|
190
245
|
acc = initialValue;
|
|
191
246
|
} else {
|
|
192
247
|
const first = iter.next();
|
|
193
|
-
if (first.done)
|
|
248
|
+
if (first.done) raise(TypeError, "Reduce of empty structure with no initial value");
|
|
194
249
|
acc = first.value;
|
|
195
250
|
index = 1;
|
|
196
251
|
}
|
|
@@ -578,6 +633,12 @@ var Deque = class extends LinearBase {
|
|
|
578
633
|
|
|
579
634
|
|
|
580
635
|
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
|
|
581
642
|
|
|
582
643
|
|
|
583
644
|
|
|
@@ -598,6 +659,31 @@ var Deque = class extends LinearBase {
|
|
|
598
659
|
* console.log(last); // 50;
|
|
599
660
|
*
|
|
600
661
|
* // Length unchanged
|
|
662
|
+
* console.log(deque.length); // 5;
|
|
663
|
+
*/
|
|
664
|
+
/**
|
|
665
|
+
* Peek at the front element without removing it (alias for `first`).
|
|
666
|
+
* @remarks Time O(1), Space O(1)
|
|
667
|
+
* @returns Front element or undefined.
|
|
668
|
+
*/
|
|
669
|
+
peek() {
|
|
670
|
+
return this.first;
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Deque peek at both ends
|
|
674
|
+
* @example
|
|
675
|
+
* // Deque peek at both ends
|
|
676
|
+
* const deque = new Deque<number>([10, 20, 30, 40, 50]);
|
|
677
|
+
*
|
|
678
|
+
* // Get first element without removing
|
|
679
|
+
* const first = deque.at(0);
|
|
680
|
+
* console.log(first); // 10;
|
|
681
|
+
*
|
|
682
|
+
* // Get last element without removing
|
|
683
|
+
* const last = deque.at(deque.length - 1);
|
|
684
|
+
* console.log(last); // 50;
|
|
685
|
+
*
|
|
686
|
+
* // Length unchanged
|
|
601
687
|
* console.log(deque.length); // 5;
|
|
602
688
|
*/
|
|
603
689
|
get first() {
|
|
@@ -632,6 +718,13 @@ var Deque = class extends LinearBase {
|
|
|
632
718
|
|
|
633
719
|
|
|
634
720
|
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
|
|
635
728
|
|
|
636
729
|
|
|
637
730
|
|
|
@@ -692,6 +785,13 @@ var Deque = class extends LinearBase {
|
|
|
692
785
|
|
|
693
786
|
|
|
694
787
|
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
|
|
695
795
|
|
|
696
796
|
|
|
697
797
|
|
|
@@ -765,6 +865,13 @@ var Deque = class extends LinearBase {
|
|
|
765
865
|
|
|
766
866
|
|
|
767
867
|
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
|
|
768
875
|
|
|
769
876
|
|
|
770
877
|
|
|
@@ -825,6 +932,13 @@ var Deque = class extends LinearBase {
|
|
|
825
932
|
|
|
826
933
|
|
|
827
934
|
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
|
|
828
942
|
|
|
829
943
|
|
|
830
944
|
|
|
@@ -886,6 +1000,13 @@ var Deque = class extends LinearBase {
|
|
|
886
1000
|
|
|
887
1001
|
|
|
888
1002
|
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
|
|
1006
|
+
|
|
1007
|
+
|
|
1008
|
+
|
|
1009
|
+
|
|
889
1010
|
|
|
890
1011
|
|
|
891
1012
|
|
|
@@ -988,6 +1109,13 @@ var Deque = class extends LinearBase {
|
|
|
988
1109
|
|
|
989
1110
|
|
|
990
1111
|
|
|
1112
|
+
|
|
1113
|
+
|
|
1114
|
+
|
|
1115
|
+
|
|
1116
|
+
|
|
1117
|
+
|
|
1118
|
+
|
|
991
1119
|
|
|
992
1120
|
|
|
993
1121
|
|
|
@@ -1030,6 +1158,13 @@ var Deque = class extends LinearBase {
|
|
|
1030
1158
|
|
|
1031
1159
|
|
|
1032
1160
|
|
|
1161
|
+
|
|
1162
|
+
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
|
|
1033
1168
|
|
|
1034
1169
|
|
|
1035
1170
|
|
|
@@ -1076,6 +1211,13 @@ var Deque = class extends LinearBase {
|
|
|
1076
1211
|
|
|
1077
1212
|
|
|
1078
1213
|
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
|
|
1217
|
+
|
|
1218
|
+
|
|
1219
|
+
|
|
1220
|
+
|
|
1079
1221
|
|
|
1080
1222
|
|
|
1081
1223
|
|
|
@@ -1273,6 +1415,13 @@ var Deque = class extends LinearBase {
|
|
|
1273
1415
|
|
|
1274
1416
|
|
|
1275
1417
|
|
|
1418
|
+
|
|
1419
|
+
|
|
1420
|
+
|
|
1421
|
+
|
|
1422
|
+
|
|
1423
|
+
|
|
1424
|
+
|
|
1276
1425
|
|
|
1277
1426
|
|
|
1278
1427
|
|
|
@@ -1357,6 +1506,13 @@ var Deque = class extends LinearBase {
|
|
|
1357
1506
|
|
|
1358
1507
|
|
|
1359
1508
|
|
|
1509
|
+
|
|
1510
|
+
|
|
1511
|
+
|
|
1512
|
+
|
|
1513
|
+
|
|
1514
|
+
|
|
1515
|
+
|
|
1360
1516
|
|
|
1361
1517
|
|
|
1362
1518
|
|
|
@@ -1466,6 +1622,13 @@ var Deque = class extends LinearBase {
|
|
|
1466
1622
|
|
|
1467
1623
|
|
|
1468
1624
|
|
|
1625
|
+
|
|
1626
|
+
|
|
1627
|
+
|
|
1628
|
+
|
|
1629
|
+
|
|
1630
|
+
|
|
1631
|
+
|
|
1469
1632
|
|
|
1470
1633
|
|
|
1471
1634
|
|
|
@@ -1534,6 +1697,13 @@ var Deque = class extends LinearBase {
|
|
|
1534
1697
|
|
|
1535
1698
|
|
|
1536
1699
|
|
|
1700
|
+
|
|
1701
|
+
|
|
1702
|
+
|
|
1703
|
+
|
|
1704
|
+
|
|
1705
|
+
|
|
1706
|
+
|
|
1537
1707
|
|
|
1538
1708
|
|
|
1539
1709
|
|
|
@@ -1585,6 +1755,13 @@ var Deque = class extends LinearBase {
|
|
|
1585
1755
|
|
|
1586
1756
|
|
|
1587
1757
|
|
|
1758
|
+
|
|
1759
|
+
|
|
1760
|
+
|
|
1761
|
+
|
|
1762
|
+
|
|
1763
|
+
|
|
1764
|
+
|
|
1588
1765
|
|
|
1589
1766
|
|
|
1590
1767
|
|
|
@@ -1656,6 +1833,13 @@ var Deque = class extends LinearBase {
|
|
|
1656
1833
|
|
|
1657
1834
|
|
|
1658
1835
|
|
|
1836
|
+
|
|
1837
|
+
|
|
1838
|
+
|
|
1839
|
+
|
|
1840
|
+
|
|
1841
|
+
|
|
1842
|
+
|
|
1659
1843
|
|
|
1660
1844
|
|
|
1661
1845
|
|
|
@@ -1792,55 +1976,6 @@ var Deque = class extends LinearBase {
|
|
|
1792
1976
|
}
|
|
1793
1977
|
}
|
|
1794
1978
|
};
|
|
1795
|
-
|
|
1796
|
-
// src/common/error.ts
|
|
1797
|
-
var ERR = {
|
|
1798
|
-
// Range / index
|
|
1799
|
-
indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
|
|
1800
|
-
invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
|
|
1801
|
-
// Type / argument
|
|
1802
|
-
invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
|
|
1803
|
-
comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
|
|
1804
|
-
invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
|
|
1805
|
-
notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
|
|
1806
|
-
invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
|
|
1807
|
-
invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
|
|
1808
|
-
invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
|
|
1809
|
-
reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
|
|
1810
|
-
callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
|
|
1811
|
-
// State / operation
|
|
1812
|
-
invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
|
|
1813
|
-
// Matrix
|
|
1814
|
-
matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
|
|
1815
|
-
matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
|
|
1816
|
-
matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
|
|
1817
|
-
matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
|
|
1818
|
-
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch")
|
|
1819
|
-
};
|
|
1820
|
-
|
|
1821
|
-
// src/common/index.ts
|
|
1822
|
-
var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
|
|
1823
|
-
DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
|
|
1824
|
-
DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
|
|
1825
|
-
return DFSOperation2;
|
|
1826
|
-
})(DFSOperation || {});
|
|
1827
|
-
var Range = class {
|
|
1828
|
-
constructor(low, high, includeLow = true, includeHigh = true) {
|
|
1829
|
-
this.low = low;
|
|
1830
|
-
this.high = high;
|
|
1831
|
-
this.includeLow = includeLow;
|
|
1832
|
-
this.includeHigh = includeHigh;
|
|
1833
|
-
}
|
|
1834
|
-
static {
|
|
1835
|
-
__name(this, "Range");
|
|
1836
|
-
}
|
|
1837
|
-
// Determine whether a key is within the range
|
|
1838
|
-
isInRange(key, comparator) {
|
|
1839
|
-
const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
|
|
1840
|
-
const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
|
|
1841
|
-
return lowCheck && highCheck;
|
|
1842
|
-
}
|
|
1843
|
-
};
|
|
1844
1979
|
/**
|
|
1845
1980
|
* data-structure-typed
|
|
1846
1981
|
*
|
|
@@ -1849,6 +1984,6 @@ var Range = class {
|
|
|
1849
1984
|
* @license MIT License
|
|
1850
1985
|
*/
|
|
1851
1986
|
|
|
1852
|
-
export { DFSOperation, Deque, ERR, Range };
|
|
1987
|
+
export { DFSOperation, Deque, ERR, Range, raise };
|
|
1853
1988
|
//# sourceMappingURL=index.mjs.map
|
|
1854
1989
|
//# sourceMappingURL=index.mjs.map
|