data-structure-typed 2.5.1 → 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.
- package/CHANGELOG.md +3 -1
- package/README.md +75 -17
- package/dist/cjs/binary-tree.cjs +2723 -139
- package/dist/cjs/graph.cjs +192 -6
- package/dist/cjs/hash.cjs +63 -15
- package/dist/cjs/heap.cjs +93 -31
- package/dist/cjs/index.cjs +3514 -379
- package/dist/cjs/linked-list.cjs +237 -31
- package/dist/cjs/matrix.cjs +47 -9
- package/dist/cjs/priority-queue.cjs +92 -30
- package/dist/cjs/queue.cjs +176 -2
- package/dist/cjs/stack.cjs +48 -2
- package/dist/cjs/trie.cjs +78 -28
- package/dist/cjs-legacy/binary-tree.cjs +2725 -136
- package/dist/cjs-legacy/graph.cjs +192 -6
- package/dist/cjs-legacy/hash.cjs +63 -15
- package/dist/cjs-legacy/heap.cjs +93 -31
- package/dist/cjs-legacy/index.cjs +3389 -249
- package/dist/cjs-legacy/linked-list.cjs +237 -31
- package/dist/cjs-legacy/matrix.cjs +47 -9
- package/dist/cjs-legacy/priority-queue.cjs +92 -30
- package/dist/cjs-legacy/queue.cjs +176 -2
- package/dist/cjs-legacy/stack.cjs +48 -2
- package/dist/cjs-legacy/trie.cjs +78 -28
- package/dist/esm/binary-tree.mjs +2723 -139
- package/dist/esm/graph.mjs +192 -6
- package/dist/esm/hash.mjs +63 -15
- package/dist/esm/heap.mjs +93 -31
- package/dist/esm/index.mjs +3514 -380
- package/dist/esm/linked-list.mjs +237 -31
- package/dist/esm/matrix.mjs +47 -9
- package/dist/esm/priority-queue.mjs +92 -30
- package/dist/esm/queue.mjs +176 -2
- package/dist/esm/stack.mjs +48 -2
- package/dist/esm/trie.mjs +78 -28
- package/dist/esm-legacy/binary-tree.mjs +2725 -136
- package/dist/esm-legacy/graph.mjs +192 -6
- package/dist/esm-legacy/hash.mjs +63 -15
- package/dist/esm-legacy/heap.mjs +93 -31
- package/dist/esm-legacy/index.mjs +3389 -250
- package/dist/esm-legacy/linked-list.mjs +237 -31
- package/dist/esm-legacy/matrix.mjs +47 -9
- package/dist/esm-legacy/priority-queue.mjs +92 -30
- package/dist/esm-legacy/queue.mjs +176 -2
- package/dist/esm-legacy/stack.mjs +48 -2
- package/dist/esm-legacy/trie.mjs +78 -28
- 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 +48 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +56 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +102 -2
- package/dist/types/data-structures/binary-tree/bst.d.ts +195 -0
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +76 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +24 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +528 -0
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +531 -6
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +435 -6
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +505 -0
- package/dist/types/data-structures/graph/directed-graph.d.ts +40 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +36 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +44 -0
- package/dist/types/data-structures/heap/heap.d.ts +56 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +68 -0
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +60 -0
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +72 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +32 -0
- package/dist/types/data-structures/queue/deque.d.ts +60 -0
- package/dist/types/data-structures/queue/queue.d.ts +48 -0
- package/dist/types/data-structures/stack/stack.d.ts +40 -0
- package/dist/types/data-structures/trie/trie.d.ts +48 -0
- 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/data-structure-typed.js +3404 -265
- package/dist/umd/data-structure-typed.min.js +5 -5
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +650 -136
- package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +11 -11
- package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +71 -71
- package/docs-site-docusaurus/docs/api/classes/BST.md +591 -129
- package/docs-site-docusaurus/docs/api/classes/BSTNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +15 -15
- package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +107 -107
- package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/Deque.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +74 -74
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +9 -9
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
- package/docs-site-docusaurus/docs/api/classes/HashMap.md +47 -47
- package/docs-site-docusaurus/docs/api/classes/Heap.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +25 -25
- package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +33 -33
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +50 -50
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +55 -55
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +49 -49
- package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +78 -78
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +31 -31
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/Navigator.md +5 -5
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +44 -44
- package/docs-site-docusaurus/docs/api/classes/Queue.md +60 -60
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +660 -146
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -10
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +78 -78
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +44 -44
- package/docs-site-docusaurus/docs/api/classes/Stack.md +39 -39
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +165 -33
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +162 -46
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +161 -32
- package/docs-site-docusaurus/docs/api/classes/Trie.md +47 -47
- package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +81 -81
- package/docs-site-docusaurus/docs/guide/architecture.md +2 -0
- package/docs-site-docusaurus/docs/guide/concepts.md +32 -1
- package/docs-site-docusaurus/docs/guide/faq.md +180 -0
- package/docs-site-docusaurus/docs/guide/guides.md +40 -54
- package/docs-site-docusaurus/docs/guide/installation.md +2 -0
- package/docs-site-docusaurus/docs/guide/integrations.md +2 -0
- package/docs-site-docusaurus/docs/guide/overview.md +7 -0
- package/docs-site-docusaurus/docs/guide/performance.md +2 -0
- package/docs-site-docusaurus/docs/guide/quick-start.md +31 -0
- package/docs-site-docusaurus/docs/guide/use-cases/_category_.json +6 -0
- package/docs-site-docusaurus/docs/guide/use-cases/array-sort-alternative.md +158 -0
- package/docs-site-docusaurus/docs/guide/use-cases/heap-vs-sorting.md +92 -0
- package/docs-site-docusaurus/docs/guide/use-cases/map-vs-treemap.md +151 -0
- package/docs-site-docusaurus/docs/guide/use-cases/priority-queue-typescript.md +113 -0
- package/docs-site-docusaurus/docs/guide/use-cases/treemap-javascript.md +151 -0
- package/docs-site-docusaurus/docusaurus.config.ts +1 -1
- package/docs-site-docusaurus/src/pages/index.tsx +51 -2
- package/docs-site-docusaurus/static/llms.txt +37 -0
- package/llms.txt +37 -0
- package/package.json +64 -56
- 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 +47 -0
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +46 -4
- package/src/data-structures/binary-tree/binary-tree.ts +79 -4
- package/src/data-structures/binary-tree/bst.ts +441 -6
- package/src/data-structures/binary-tree/red-black-tree.ts +73 -0
- package/src/data-structures/binary-tree/segment-tree.ts +18 -0
- package/src/data-structures/binary-tree/tree-map.ts +434 -9
- package/src/data-structures/binary-tree/tree-multi-map.ts +426 -5
- package/src/data-structures/binary-tree/tree-multi-set.ts +350 -6
- package/src/data-structures/binary-tree/tree-set.ts +410 -8
- package/src/data-structures/graph/abstract-graph.ts +2 -2
- package/src/data-structures/graph/directed-graph.ts +30 -0
- package/src/data-structures/graph/undirected-graph.ts +27 -0
- package/src/data-structures/hash/hash-map.ts +35 -4
- package/src/data-structures/heap/heap.ts +46 -4
- package/src/data-structures/heap/max-heap.ts +2 -2
- package/src/data-structures/linked-list/doubly-linked-list.ts +51 -0
- package/src/data-structures/linked-list/singly-linked-list.ts +45 -0
- package/src/data-structures/linked-list/skip-linked-list.ts +59 -5
- package/src/data-structures/matrix/matrix.ts +33 -9
- package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
- package/src/data-structures/queue/deque.ts +45 -0
- package/src/data-structures/queue/queue.ts +36 -0
- package/src/data-structures/stack/stack.ts +30 -0
- package/src/data-structures/trie/trie.ts +38 -2
- 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
|
@@ -27,6 +27,10 @@ var arrayRemove = /* @__PURE__ */ __name(function(array, predicate) {
|
|
|
27
27
|
}, "arrayRemove");
|
|
28
28
|
|
|
29
29
|
// src/common/error.ts
|
|
30
|
+
function raise(ErrorClass, message) {
|
|
31
|
+
throw new ErrorClass(message);
|
|
32
|
+
}
|
|
33
|
+
__name(raise, "raise");
|
|
30
34
|
var ERR = {
|
|
31
35
|
// Range / index
|
|
32
36
|
indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
|
|
@@ -48,7 +52,9 @@ var ERR = {
|
|
|
48
52
|
matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
|
|
49
53
|
matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
|
|
50
54
|
matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
|
|
51
|
-
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch")
|
|
55
|
+
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch"),
|
|
56
|
+
// Order statistic
|
|
57
|
+
orderStatisticNotEnabled: /* @__PURE__ */ __name((method, ctx) => `${ctx ? ctx + ": " : ""}${method}() requires enableOrderStatistic: true.`, "orderStatisticNotEnabled")
|
|
52
58
|
};
|
|
53
59
|
|
|
54
60
|
// src/data-structures/base/iterable-entry-base.ts
|
|
@@ -254,7 +260,7 @@ var _IterableElementBase = class _IterableElementBase {
|
|
|
254
260
|
if (options) {
|
|
255
261
|
const { toElementFn } = options;
|
|
256
262
|
if (typeof toElementFn === "function") this._toElementFn = toElementFn;
|
|
257
|
-
else if (toElementFn)
|
|
263
|
+
else if (toElementFn) raise(TypeError, "toElementFn must be a function type");
|
|
258
264
|
}
|
|
259
265
|
}
|
|
260
266
|
/**
|
|
@@ -410,7 +416,7 @@ var _IterableElementBase = class _IterableElementBase {
|
|
|
410
416
|
acc = initialValue;
|
|
411
417
|
} else {
|
|
412
418
|
const first = iter.next();
|
|
413
|
-
if (first.done)
|
|
419
|
+
if (first.done) raise(TypeError, "Reduce of empty structure with no initial value");
|
|
414
420
|
acc = first.value;
|
|
415
421
|
index = 1;
|
|
416
422
|
}
|
|
@@ -661,7 +667,7 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
661
667
|
__publicField(this, "_elements", []);
|
|
662
668
|
__publicField(this, "_DEFAULT_COMPARATOR", /* @__PURE__ */ __name((a, b) => {
|
|
663
669
|
if (typeof a === "object" || typeof b === "object") {
|
|
664
|
-
|
|
670
|
+
raise(TypeError, ERR.comparatorRequired("Heap"));
|
|
665
671
|
}
|
|
666
672
|
if (a > b) return 1;
|
|
667
673
|
if (a < b) return -1;
|
|
@@ -712,6 +718,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
712
718
|
|
|
713
719
|
|
|
714
720
|
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
|
|
715
725
|
|
|
716
726
|
|
|
717
727
|
|
|
@@ -795,6 +805,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
795
805
|
|
|
796
806
|
|
|
797
807
|
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
|
|
798
812
|
|
|
799
813
|
|
|
800
814
|
|
|
@@ -848,6 +862,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
848
862
|
|
|
849
863
|
|
|
850
864
|
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
|
|
851
869
|
|
|
852
870
|
|
|
853
871
|
|
|
@@ -903,6 +921,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
903
921
|
|
|
904
922
|
|
|
905
923
|
|
|
924
|
+
|
|
925
|
+
|
|
926
|
+
|
|
927
|
+
|
|
906
928
|
|
|
907
929
|
|
|
908
930
|
|
|
@@ -974,6 +996,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
974
996
|
|
|
975
997
|
|
|
976
998
|
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
|
|
977
1003
|
|
|
978
1004
|
|
|
979
1005
|
|
|
@@ -1070,6 +1096,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
1070
1096
|
|
|
1071
1097
|
|
|
1072
1098
|
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
|
|
1102
|
+
|
|
1073
1103
|
|
|
1074
1104
|
|
|
1075
1105
|
|
|
@@ -1113,6 +1143,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
1113
1143
|
|
|
1114
1144
|
|
|
1115
1145
|
|
|
1146
|
+
|
|
1147
|
+
|
|
1148
|
+
|
|
1149
|
+
|
|
1116
1150
|
|
|
1117
1151
|
|
|
1118
1152
|
|
|
@@ -1159,6 +1193,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
1159
1193
|
|
|
1160
1194
|
|
|
1161
1195
|
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
|
|
1199
|
+
|
|
1162
1200
|
|
|
1163
1201
|
|
|
1164
1202
|
|
|
@@ -1202,6 +1240,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
1202
1240
|
|
|
1203
1241
|
|
|
1204
1242
|
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
|
|
1246
|
+
|
|
1205
1247
|
|
|
1206
1248
|
|
|
1207
1249
|
|
|
@@ -1291,6 +1333,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
1291
1333
|
|
|
1292
1334
|
|
|
1293
1335
|
|
|
1336
|
+
|
|
1337
|
+
|
|
1338
|
+
|
|
1339
|
+
|
|
1294
1340
|
|
|
1295
1341
|
|
|
1296
1342
|
|
|
@@ -1367,6 +1413,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
1367
1413
|
|
|
1368
1414
|
|
|
1369
1415
|
|
|
1416
|
+
|
|
1417
|
+
|
|
1418
|
+
|
|
1419
|
+
|
|
1370
1420
|
|
|
1371
1421
|
|
|
1372
1422
|
|
|
@@ -1416,6 +1466,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
1416
1466
|
|
|
1417
1467
|
|
|
1418
1468
|
|
|
1469
|
+
|
|
1470
|
+
|
|
1471
|
+
|
|
1472
|
+
|
|
1419
1473
|
|
|
1420
1474
|
|
|
1421
1475
|
|
|
@@ -1464,6 +1518,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
1464
1518
|
|
|
1465
1519
|
|
|
1466
1520
|
|
|
1521
|
+
|
|
1522
|
+
|
|
1523
|
+
|
|
1524
|
+
|
|
1467
1525
|
|
|
1468
1526
|
|
|
1469
1527
|
|
|
@@ -1519,6 +1577,10 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
1519
1577
|
|
|
1520
1578
|
|
|
1521
1579
|
|
|
1580
|
+
|
|
1581
|
+
|
|
1582
|
+
|
|
1583
|
+
|
|
1522
1584
|
|
|
1523
1585
|
|
|
1524
1586
|
|
|
@@ -1532,7 +1594,7 @@ var _Heap = class _Heap extends IterableElementBase {
|
|
|
1532
1594
|
*/
|
|
1533
1595
|
map(callback, options, thisArg) {
|
|
1534
1596
|
const { comparator, toElementFn, ...rest } = options != null ? options : {};
|
|
1535
|
-
if (!comparator)
|
|
1597
|
+
if (!comparator) raise(TypeError, ERR.comparatorRequired("Heap.map"));
|
|
1536
1598
|
const out = this._createLike([], { ...rest, comparator, toElementFn });
|
|
1537
1599
|
let i = 0;
|
|
1538
1600
|
for (const x of this) {
|
|
@@ -1718,6 +1780,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1718
1780
|
|
|
1719
1781
|
|
|
1720
1782
|
|
|
1783
|
+
|
|
1784
|
+
|
|
1785
|
+
|
|
1786
|
+
|
|
1721
1787
|
|
|
1722
1788
|
|
|
1723
1789
|
|
|
@@ -1764,6 +1830,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1764
1830
|
|
|
1765
1831
|
|
|
1766
1832
|
|
|
1833
|
+
|
|
1834
|
+
|
|
1835
|
+
|
|
1836
|
+
|
|
1767
1837
|
|
|
1768
1838
|
|
|
1769
1839
|
|
|
@@ -1826,6 +1896,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1826
1896
|
|
|
1827
1897
|
|
|
1828
1898
|
|
|
1899
|
+
|
|
1900
|
+
|
|
1901
|
+
|
|
1902
|
+
|
|
1829
1903
|
|
|
1830
1904
|
|
|
1831
1905
|
|
|
@@ -1884,6 +1958,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1884
1958
|
|
|
1885
1959
|
|
|
1886
1960
|
|
|
1961
|
+
|
|
1962
|
+
|
|
1963
|
+
|
|
1964
|
+
|
|
1887
1965
|
|
|
1888
1966
|
|
|
1889
1967
|
|
|
@@ -1949,6 +2027,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
1949
2027
|
|
|
1950
2028
|
|
|
1951
2029
|
|
|
2030
|
+
|
|
2031
|
+
|
|
2032
|
+
|
|
2033
|
+
|
|
1952
2034
|
|
|
1953
2035
|
|
|
1954
2036
|
|
|
@@ -2004,6 +2086,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
2004
2086
|
|
|
2005
2087
|
|
|
2006
2088
|
|
|
2089
|
+
|
|
2090
|
+
|
|
2091
|
+
|
|
2092
|
+
|
|
2007
2093
|
|
|
2008
2094
|
|
|
2009
2095
|
|
|
@@ -2052,6 +2138,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
2052
2138
|
|
|
2053
2139
|
|
|
2054
2140
|
|
|
2141
|
+
|
|
2142
|
+
|
|
2143
|
+
|
|
2144
|
+
|
|
2055
2145
|
|
|
2056
2146
|
|
|
2057
2147
|
|
|
@@ -2141,6 +2231,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
2141
2231
|
|
|
2142
2232
|
|
|
2143
2233
|
|
|
2234
|
+
|
|
2235
|
+
|
|
2236
|
+
|
|
2237
|
+
|
|
2144
2238
|
|
|
2145
2239
|
|
|
2146
2240
|
|
|
@@ -2183,6 +2277,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
2183
2277
|
|
|
2184
2278
|
|
|
2185
2279
|
|
|
2280
|
+
|
|
2281
|
+
|
|
2282
|
+
|
|
2283
|
+
|
|
2186
2284
|
|
|
2187
2285
|
|
|
2188
2286
|
|
|
@@ -2248,6 +2346,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
2248
2346
|
|
|
2249
2347
|
|
|
2250
2348
|
|
|
2349
|
+
|
|
2350
|
+
|
|
2351
|
+
|
|
2352
|
+
|
|
2251
2353
|
|
|
2252
2354
|
|
|
2253
2355
|
|
|
@@ -2297,6 +2399,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
2297
2399
|
|
|
2298
2400
|
|
|
2299
2401
|
|
|
2402
|
+
|
|
2403
|
+
|
|
2404
|
+
|
|
2405
|
+
|
|
2300
2406
|
|
|
2301
2407
|
|
|
2302
2408
|
|
|
@@ -2350,6 +2456,10 @@ var _Queue = class _Queue extends LinearBase {
|
|
|
2350
2456
|
|
|
2351
2457
|
|
|
2352
2458
|
|
|
2459
|
+
|
|
2460
|
+
|
|
2461
|
+
|
|
2462
|
+
|
|
2353
2463
|
|
|
2354
2464
|
|
|
2355
2465
|
|
|
@@ -2589,7 +2699,7 @@ var _AbstractGraph = class _AbstractGraph extends IterableEntryBase {
|
|
|
2589
2699
|
const newEdge = this.createEdge(srcOrEdge, dest, weight, value);
|
|
2590
2700
|
return this._addEdge(newEdge);
|
|
2591
2701
|
} else {
|
|
2592
|
-
|
|
2702
|
+
raise(TypeError, ERR.invalidArgument("dest must be a Vertex or vertex key when srcOrEdge is an Edge.", "Graph"));
|
|
2593
2703
|
}
|
|
2594
2704
|
}
|
|
2595
2705
|
}
|
|
@@ -3488,6 +3598,10 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
|
|
|
3488
3598
|
|
|
3489
3599
|
|
|
3490
3600
|
|
|
3601
|
+
|
|
3602
|
+
|
|
3603
|
+
|
|
3604
|
+
|
|
3491
3605
|
|
|
3492
3606
|
|
|
3493
3607
|
|
|
@@ -3572,6 +3686,10 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
|
|
|
3572
3686
|
|
|
3573
3687
|
|
|
3574
3688
|
|
|
3689
|
+
|
|
3690
|
+
|
|
3691
|
+
|
|
3692
|
+
|
|
3575
3693
|
|
|
3576
3694
|
|
|
3577
3695
|
|
|
@@ -3654,6 +3772,10 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
|
|
|
3654
3772
|
|
|
3655
3773
|
|
|
3656
3774
|
|
|
3775
|
+
|
|
3776
|
+
|
|
3777
|
+
|
|
3778
|
+
|
|
3657
3779
|
|
|
3658
3780
|
|
|
3659
3781
|
|
|
@@ -3727,6 +3849,10 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
|
|
|
3727
3849
|
|
|
3728
3850
|
|
|
3729
3851
|
|
|
3852
|
+
|
|
3853
|
+
|
|
3854
|
+
|
|
3855
|
+
|
|
3730
3856
|
|
|
3731
3857
|
|
|
3732
3858
|
|
|
@@ -3777,6 +3903,10 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
|
|
|
3777
3903
|
|
|
3778
3904
|
|
|
3779
3905
|
|
|
3906
|
+
|
|
3907
|
+
|
|
3908
|
+
|
|
3909
|
+
|
|
3780
3910
|
|
|
3781
3911
|
|
|
3782
3912
|
|
|
@@ -3880,6 +4010,10 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
|
|
|
3880
4010
|
|
|
3881
4011
|
|
|
3882
4012
|
|
|
4013
|
+
|
|
4014
|
+
|
|
4015
|
+
|
|
4016
|
+
|
|
3883
4017
|
|
|
3884
4018
|
|
|
3885
4019
|
|
|
@@ -3964,6 +4098,10 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
|
|
|
3964
4098
|
|
|
3965
4099
|
|
|
3966
4100
|
|
|
4101
|
+
|
|
4102
|
+
|
|
4103
|
+
|
|
4104
|
+
|
|
3967
4105
|
|
|
3968
4106
|
|
|
3969
4107
|
|
|
@@ -4010,6 +4148,10 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
|
|
|
4010
4148
|
|
|
4011
4149
|
|
|
4012
4150
|
|
|
4151
|
+
|
|
4152
|
+
|
|
4153
|
+
|
|
4154
|
+
|
|
4013
4155
|
|
|
4014
4156
|
|
|
4015
4157
|
|
|
@@ -4109,6 +4251,10 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
|
|
|
4109
4251
|
|
|
4110
4252
|
|
|
4111
4253
|
|
|
4254
|
+
|
|
4255
|
+
|
|
4256
|
+
|
|
4257
|
+
|
|
4112
4258
|
|
|
4113
4259
|
|
|
4114
4260
|
|
|
@@ -4211,6 +4357,10 @@ var _DirectedGraph = class _DirectedGraph extends AbstractGraph {
|
|
|
4211
4357
|
|
|
4212
4358
|
|
|
4213
4359
|
|
|
4360
|
+
|
|
4361
|
+
|
|
4362
|
+
|
|
4363
|
+
|
|
4214
4364
|
|
|
4215
4365
|
|
|
4216
4366
|
|
|
@@ -4377,6 +4527,10 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
|
|
|
4377
4527
|
|
|
4378
4528
|
|
|
4379
4529
|
|
|
4530
|
+
|
|
4531
|
+
|
|
4532
|
+
|
|
4533
|
+
|
|
4380
4534
|
|
|
4381
4535
|
|
|
4382
4536
|
|
|
@@ -4458,6 +4612,10 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
|
|
|
4458
4612
|
|
|
4459
4613
|
|
|
4460
4614
|
|
|
4615
|
+
|
|
4616
|
+
|
|
4617
|
+
|
|
4618
|
+
|
|
4461
4619
|
|
|
4462
4620
|
|
|
4463
4621
|
|
|
@@ -4538,6 +4696,10 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
|
|
|
4538
4696
|
|
|
4539
4697
|
|
|
4540
4698
|
|
|
4699
|
+
|
|
4700
|
+
|
|
4701
|
+
|
|
4702
|
+
|
|
4541
4703
|
|
|
4542
4704
|
|
|
4543
4705
|
|
|
@@ -4633,6 +4795,10 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
|
|
|
4633
4795
|
|
|
4634
4796
|
|
|
4635
4797
|
|
|
4798
|
+
|
|
4799
|
+
|
|
4800
|
+
|
|
4801
|
+
|
|
4636
4802
|
|
|
4637
4803
|
|
|
4638
4804
|
|
|
@@ -4683,6 +4849,10 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
|
|
|
4683
4849
|
|
|
4684
4850
|
|
|
4685
4851
|
|
|
4852
|
+
|
|
4853
|
+
|
|
4854
|
+
|
|
4855
|
+
|
|
4686
4856
|
|
|
4687
4857
|
|
|
4688
4858
|
|
|
@@ -4803,6 +4973,10 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
|
|
|
4803
4973
|
|
|
4804
4974
|
|
|
4805
4975
|
|
|
4976
|
+
|
|
4977
|
+
|
|
4978
|
+
|
|
4979
|
+
|
|
4806
4980
|
|
|
4807
4981
|
|
|
4808
4982
|
|
|
@@ -4945,6 +5119,10 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
|
|
|
4945
5119
|
|
|
4946
5120
|
|
|
4947
5121
|
|
|
5122
|
+
|
|
5123
|
+
|
|
5124
|
+
|
|
5125
|
+
|
|
4948
5126
|
|
|
4949
5127
|
|
|
4950
5128
|
|
|
@@ -5009,6 +5187,10 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
|
|
|
5009
5187
|
|
|
5010
5188
|
|
|
5011
5189
|
|
|
5190
|
+
|
|
5191
|
+
|
|
5192
|
+
|
|
5193
|
+
|
|
5012
5194
|
|
|
5013
5195
|
|
|
5014
5196
|
|
|
@@ -5055,6 +5237,10 @@ var _UndirectedGraph = class _UndirectedGraph extends AbstractGraph {
|
|
|
5055
5237
|
|
|
5056
5238
|
|
|
5057
5239
|
|
|
5240
|
+
|
|
5241
|
+
|
|
5242
|
+
|
|
5243
|
+
|
|
5058
5244
|
|
|
5059
5245
|
|
|
5060
5246
|
|
package/dist/cjs-legacy/hash.cjs
CHANGED
|
@@ -186,18 +186,11 @@ var _IterableEntryBase = class _IterableEntryBase {
|
|
|
186
186
|
__name(_IterableEntryBase, "IterableEntryBase");
|
|
187
187
|
var IterableEntryBase = _IterableEntryBase;
|
|
188
188
|
|
|
189
|
-
// src/utils/utils.ts
|
|
190
|
-
var rangeCheck = /* @__PURE__ */ __name((index, min, max, message) => {
|
|
191
|
-
if (index < min || index > max) {
|
|
192
|
-
throw new RangeError(message != null ? message : `Index ${index} is out of range [${min}, ${max}].`);
|
|
193
|
-
}
|
|
194
|
-
}, "rangeCheck");
|
|
195
|
-
var isWeakKey = /* @__PURE__ */ __name((input) => {
|
|
196
|
-
const inputType = typeof input;
|
|
197
|
-
return inputType === "object" && input !== null || inputType === "function";
|
|
198
|
-
}, "isWeakKey");
|
|
199
|
-
|
|
200
189
|
// src/common/error.ts
|
|
190
|
+
function raise(ErrorClass, message) {
|
|
191
|
+
throw new ErrorClass(message);
|
|
192
|
+
}
|
|
193
|
+
__name(raise, "raise");
|
|
201
194
|
var ERR = {
|
|
202
195
|
// Range / index
|
|
203
196
|
indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
|
|
@@ -219,9 +212,22 @@ var ERR = {
|
|
|
219
212
|
matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
|
|
220
213
|
matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
|
|
221
214
|
matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
|
|
222
|
-
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch")
|
|
215
|
+
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch"),
|
|
216
|
+
// Order statistic
|
|
217
|
+
orderStatisticNotEnabled: /* @__PURE__ */ __name((method, ctx) => `${ctx ? ctx + ": " : ""}${method}() requires enableOrderStatistic: true.`, "orderStatisticNotEnabled")
|
|
223
218
|
};
|
|
224
219
|
|
|
220
|
+
// src/utils/utils.ts
|
|
221
|
+
var rangeCheck = /* @__PURE__ */ __name((index, min, max, message) => {
|
|
222
|
+
if (index < min || index > max) {
|
|
223
|
+
throw new RangeError(message != null ? message : `Index ${index} is out of range [${min}, ${max}].`);
|
|
224
|
+
}
|
|
225
|
+
}, "rangeCheck");
|
|
226
|
+
var isWeakKey = /* @__PURE__ */ __name((input) => {
|
|
227
|
+
const inputType = typeof input;
|
|
228
|
+
return inputType === "object" && input !== null || inputType === "function";
|
|
229
|
+
}, "isWeakKey");
|
|
230
|
+
|
|
225
231
|
// src/data-structures/hash/hash-map.ts
|
|
226
232
|
var _HashMap = class _HashMap extends IterableEntryBase {
|
|
227
233
|
/**
|
|
@@ -313,6 +319,10 @@ var _HashMap = class _HashMap extends IterableEntryBase {
|
|
|
313
319
|
|
|
314
320
|
|
|
315
321
|
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
316
326
|
|
|
317
327
|
|
|
318
328
|
|
|
@@ -354,6 +364,10 @@ var _HashMap = class _HashMap extends IterableEntryBase {
|
|
|
354
364
|
|
|
355
365
|
|
|
356
366
|
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
357
371
|
|
|
358
372
|
|
|
359
373
|
|
|
@@ -437,6 +451,14 @@ var _HashMap = class _HashMap extends IterableEntryBase {
|
|
|
437
451
|
|
|
438
452
|
|
|
439
453
|
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
|
440
462
|
|
|
441
463
|
|
|
442
464
|
|
|
@@ -505,6 +527,10 @@ var _HashMap = class _HashMap extends IterableEntryBase {
|
|
|
505
527
|
|
|
506
528
|
|
|
507
529
|
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
|
|
508
534
|
|
|
509
535
|
|
|
510
536
|
|
|
@@ -557,6 +583,10 @@ var _HashMap = class _HashMap extends IterableEntryBase {
|
|
|
557
583
|
|
|
558
584
|
|
|
559
585
|
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
|
|
560
590
|
|
|
561
591
|
|
|
562
592
|
|
|
@@ -621,6 +651,10 @@ var _HashMap = class _HashMap extends IterableEntryBase {
|
|
|
621
651
|
|
|
622
652
|
|
|
623
653
|
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
|
|
624
658
|
|
|
625
659
|
|
|
626
660
|
|
|
@@ -669,6 +703,10 @@ var _HashMap = class _HashMap extends IterableEntryBase {
|
|
|
669
703
|
|
|
670
704
|
|
|
671
705
|
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
|
|
672
710
|
|
|
673
711
|
|
|
674
712
|
|
|
@@ -735,6 +773,10 @@ var _HashMap = class _HashMap extends IterableEntryBase {
|
|
|
735
773
|
|
|
736
774
|
|
|
737
775
|
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
|
|
738
780
|
|
|
739
781
|
|
|
740
782
|
|
|
@@ -784,6 +826,10 @@ var _HashMap = class _HashMap extends IterableEntryBase {
|
|
|
784
826
|
|
|
785
827
|
|
|
786
828
|
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
|
|
832
|
+
|
|
787
833
|
|
|
788
834
|
|
|
789
835
|
|
|
@@ -835,6 +881,10 @@ var _HashMap = class _HashMap extends IterableEntryBase {
|
|
|
835
881
|
|
|
836
882
|
|
|
837
883
|
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
|
|
838
888
|
|
|
839
889
|
|
|
840
890
|
|
|
@@ -940,9 +990,7 @@ var _LinkedHashMap = class _LinkedHashMap extends IterableEntryBase {
|
|
|
940
990
|
if (this.isEntry(rawElement)) {
|
|
941
991
|
return rawElement;
|
|
942
992
|
}
|
|
943
|
-
|
|
944
|
-
ERR.invalidArgument("If elements do not adhere to [key, value], provide options.toEntryFn to transform raw records.", "HashMap")
|
|
945
|
-
);
|
|
993
|
+
raise(TypeError, ERR.invalidArgument("If elements do not adhere to [key, value], provide options.toEntryFn to transform raw records.", "HashMap"));
|
|
946
994
|
}, "_toEntryFn"));
|
|
947
995
|
__publicField(this, "_size", 0);
|
|
948
996
|
this._sentinel = {};
|