data-structure-typed 2.4.5 → 2.5.1
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/.vitepress/cache/deps_temp_51f5f1b0/chunk-7OIKW5WK.js +12984 -0
- package/.vitepress/cache/deps_temp_51f5f1b0/package.json +3 -0
- package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vue_devtools-api.js +4505 -0
- package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vueuse_core.js +9731 -0
- package/.vitepress/cache/deps_temp_51f5f1b0/vue.js +347 -0
- package/CHANGELOG.md +3 -1
- package/README.md +78 -31
- package/dist/cjs/binary-tree.cjs +23698 -0
- package/dist/cjs/graph.cjs +5236 -0
- package/dist/cjs/hash.cjs +1262 -0
- package/dist/cjs/heap.cjs +1540 -0
- package/dist/cjs/index.cjs +24509 -2899
- package/dist/cjs/linked-list.cjs +4370 -0
- package/dist/cjs/matrix.cjs +1042 -0
- package/dist/cjs/priority-queue.cjs +1314 -0
- package/dist/cjs/queue.cjs +4090 -0
- package/dist/cjs/stack.cjs +861 -0
- package/dist/cjs/trie.cjs +1173 -0
- package/dist/cjs-legacy/binary-tree.cjs +23730 -0
- package/dist/cjs-legacy/graph.cjs +5234 -0
- package/dist/cjs-legacy/hash.cjs +1262 -0
- package/dist/cjs-legacy/heap.cjs +1537 -0
- package/dist/cjs-legacy/index.cjs +32555 -10936
- package/dist/cjs-legacy/linked-list.cjs +4376 -0
- package/dist/cjs-legacy/matrix.cjs +1045 -0
- package/dist/cjs-legacy/priority-queue.cjs +1312 -0
- package/dist/cjs-legacy/queue.cjs +4088 -0
- package/dist/cjs-legacy/stack.cjs +861 -0
- package/dist/cjs-legacy/trie.cjs +1172 -0
- package/dist/esm/binary-tree.mjs +23683 -0
- package/dist/esm/graph.mjs +5223 -0
- package/dist/esm/hash.mjs +1259 -0
- package/dist/esm/heap.mjs +1534 -0
- package/dist/esm/index.mjs +24507 -2898
- package/dist/esm/linked-list.mjs +4363 -0
- package/dist/esm/matrix.mjs +1038 -0
- package/dist/esm/priority-queue.mjs +1310 -0
- package/dist/esm/queue.mjs +4086 -0
- package/dist/esm/stack.mjs +859 -0
- package/dist/esm/trie.mjs +1170 -0
- package/dist/esm-legacy/binary-tree.mjs +23715 -0
- package/dist/esm-legacy/graph.mjs +5221 -0
- package/dist/esm-legacy/hash.mjs +1259 -0
- package/dist/esm-legacy/heap.mjs +1531 -0
- package/dist/esm-legacy/index.mjs +32553 -10935
- package/dist/esm-legacy/linked-list.mjs +4369 -0
- package/dist/esm-legacy/matrix.mjs +1041 -0
- package/dist/esm-legacy/priority-queue.mjs +1308 -0
- package/dist/esm-legacy/queue.mjs +4084 -0
- package/dist/esm-legacy/stack.mjs +859 -0
- package/dist/esm-legacy/trie.mjs +1169 -0
- package/dist/types/data-structures/base/index.d.ts +1 -0
- package/dist/types/data-structures/base/iterable-element-base.d.ts +1 -1
- package/dist/types/data-structures/base/iterable-entry-base.d.ts +8 -8
- package/dist/types/data-structures/base/linear-base.d.ts +3 -3
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +368 -51
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +473 -147
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +931 -80
- package/dist/types/data-structures/binary-tree/bst.d.ts +792 -29
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +592 -32
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +320 -135
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +3662 -6
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +3487 -201
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +2778 -65
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +3414 -6
- package/dist/types/data-structures/graph/abstract-graph.d.ts +4 -4
- package/dist/types/data-structures/graph/directed-graph.d.ts +419 -47
- package/dist/types/data-structures/graph/map-graph.d.ts +59 -1
- package/dist/types/data-structures/graph/undirected-graph.d.ts +384 -59
- package/dist/types/data-structures/hash/hash-map.d.ts +462 -89
- package/dist/types/data-structures/heap/heap.d.ts +567 -99
- package/dist/types/data-structures/heap/max-heap.d.ts +46 -0
- package/dist/types/data-structures/heap/min-heap.d.ts +59 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +631 -49
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +581 -68
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +775 -12
- package/dist/types/data-structures/matrix/matrix.d.ts +491 -0
- package/dist/types/data-structures/priority-queue/max-priority-queue.d.ts +57 -0
- package/dist/types/data-structures/priority-queue/min-priority-queue.d.ts +60 -0
- package/dist/types/data-structures/priority-queue/priority-queue.d.ts +60 -0
- package/dist/types/data-structures/queue/deque.d.ts +578 -71
- package/dist/types/data-structures/queue/queue.d.ts +451 -42
- package/dist/types/data-structures/stack/stack.d.ts +374 -32
- package/dist/types/data-structures/trie/trie.d.ts +458 -48
- package/dist/types/interfaces/graph.d.ts +1 -1
- package/dist/types/types/common.d.ts +2 -2
- package/dist/types/types/data-structures/binary-tree/segment-tree.d.ts +1 -1
- package/dist/types/types/data-structures/heap/heap.d.ts +1 -0
- package/dist/types/types/data-structures/linked-list/skip-linked-list.d.ts +1 -4
- package/dist/types/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
- package/dist/types/types/utils/validate-type.d.ts +4 -4
- package/dist/umd/data-structure-typed.js +32432 -10808
- package/dist/umd/data-structure-typed.min.js +10 -4
- package/docs-site-docusaurus/README.md +41 -0
- package/docs-site-docusaurus/docs/api/README.md +52 -0
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +6130 -0
- package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +282 -0
- package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +2266 -0
- package/docs-site-docusaurus/docs/api/classes/BST.md +5831 -0
- package/docs-site-docusaurus/docs/api/classes/BSTNode.md +333 -0
- package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +455 -0
- package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +4647 -0
- package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +331 -0
- package/docs-site-docusaurus/docs/api/classes/Deque.md +2767 -0
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +2999 -0
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +2685 -0
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +221 -0
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +253 -0
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +21 -0
- package/docs-site-docusaurus/docs/api/classes/HashMap.md +1333 -0
- package/docs-site-docusaurus/docs/api/classes/Heap.md +1881 -0
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +800 -0
- package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +644 -0
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +1632 -0
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +1853 -0
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +1108 -0
- package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +156 -0
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +2824 -0
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +2929 -0
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +1026 -0
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +1866 -0
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +1883 -0
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +1879 -0
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +1882 -0
- package/docs-site-docusaurus/docs/api/classes/Navigator.md +109 -0
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +1839 -0
- package/docs-site-docusaurus/docs/api/classes/Queue.md +2244 -0
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +6374 -0
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +372 -0
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +2897 -0
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +169 -0
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +1229 -0
- package/docs-site-docusaurus/docs/api/classes/Stack.md +1573 -0
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +1257 -0
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +1475 -0
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +1117 -0
- package/docs-site-docusaurus/docs/api/classes/Trie.md +1708 -0
- package/docs-site-docusaurus/docs/api/classes/TrieNode.md +199 -0
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +2979 -0
- package/docs-site-docusaurus/docs/guide/_category_.json +6 -0
- package/docs-site-docusaurus/docs/guide/architecture.md +613 -0
- package/docs-site-docusaurus/docs/guide/concepts.md +420 -0
- package/docs-site-docusaurus/docs/guide/guides.md +611 -0
- package/docs-site-docusaurus/docs/guide/installation.md +60 -0
- package/docs-site-docusaurus/docs/guide/integrations.md +823 -0
- package/docs-site-docusaurus/docs/guide/overview.md +638 -0
- package/docs-site-docusaurus/docs/guide/performance.md +833 -0
- package/docs-site-docusaurus/docs/guide/quick-start.md +73 -0
- package/docs-site-docusaurus/docusaurus.config.ts +159 -0
- package/docs-site-docusaurus/fix-mdx-generics.mjs +75 -0
- package/docs-site-docusaurus/package-lock.json +18667 -0
- package/docs-site-docusaurus/package.json +50 -0
- package/docs-site-docusaurus/prefix-class-to-methods.mjs +48 -0
- package/docs-site-docusaurus/sidebars.ts +23 -0
- package/docs-site-docusaurus/sort-protected.mjs +87 -0
- package/docs-site-docusaurus/src/css/custom.css +96 -0
- package/docs-site-docusaurus/src/pages/index.module.css +13 -0
- package/docs-site-docusaurus/src/pages/index.tsx +71 -0
- package/docs-site-docusaurus/src/pages/markdown-page.md +7 -0
- package/docs-site-docusaurus/src/theme/TOCItems/index.tsx +34 -0
- package/docs-site-docusaurus/static/.nojekyll +0 -0
- package/docs-site-docusaurus/static/img/docusaurus-social-card.jpg +0 -0
- package/docs-site-docusaurus/static/img/docusaurus.png +0 -0
- package/docs-site-docusaurus/static/img/favicon.ico +0 -0
- package/docs-site-docusaurus/static/img/favicon.png +0 -0
- package/docs-site-docusaurus/static/img/logo-180.png +0 -0
- package/docs-site-docusaurus/static/img/logo.jpg +0 -0
- package/docs-site-docusaurus/static/img/logo.png +0 -0
- package/docs-site-docusaurus/static/img/logo.svg +1 -0
- package/docs-site-docusaurus/static/img/og-image.png +0 -0
- package/docs-site-docusaurus/static/img/undraw_docusaurus_mountain.svg +171 -0
- package/docs-site-docusaurus/static/img/undraw_docusaurus_react.svg +170 -0
- package/docs-site-docusaurus/static/img/undraw_docusaurus_tree.svg +40 -0
- package/docs-site-docusaurus/static/robots.txt +4 -0
- package/docs-site-docusaurus/typedoc.json +23 -0
- package/package.json +109 -12
- package/src/data-structures/base/index.ts +1 -0
- package/src/data-structures/base/iterable-element-base.ts +4 -5
- package/src/data-structures/base/iterable-entry-base.ts +8 -8
- package/src/data-structures/base/linear-base.ts +3 -3
- package/src/data-structures/binary-tree/avl-tree.ts +386 -51
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +596 -247
- package/src/data-structures/binary-tree/binary-tree.ts +956 -81
- package/src/data-structures/binary-tree/bst.ts +840 -35
- package/src/data-structures/binary-tree/red-black-tree.ts +689 -97
- package/src/data-structures/binary-tree/segment-tree.ts +498 -249
- package/src/data-structures/binary-tree/tree-map.ts +3784 -7
- package/src/data-structures/binary-tree/tree-multi-map.ts +3614 -211
- package/src/data-structures/binary-tree/tree-multi-set.ts +2874 -65
- package/src/data-structures/binary-tree/tree-set.ts +3531 -10
- package/src/data-structures/graph/abstract-graph.ts +4 -4
- package/src/data-structures/graph/directed-graph.ts +429 -47
- package/src/data-structures/graph/map-graph.ts +59 -1
- package/src/data-structures/graph/undirected-graph.ts +393 -59
- package/src/data-structures/hash/hash-map.ts +476 -92
- package/src/data-structures/heap/heap.ts +581 -99
- package/src/data-structures/heap/max-heap.ts +46 -0
- package/src/data-structures/heap/min-heap.ts +59 -0
- package/src/data-structures/linked-list/doubly-linked-list.ts +646 -47
- package/src/data-structures/linked-list/singly-linked-list.ts +596 -68
- package/src/data-structures/linked-list/skip-linked-list.ts +1067 -90
- package/src/data-structures/matrix/matrix.ts +584 -12
- package/src/data-structures/priority-queue/max-priority-queue.ts +57 -0
- package/src/data-structures/priority-queue/min-priority-queue.ts +60 -0
- package/src/data-structures/priority-queue/priority-queue.ts +60 -0
- package/src/data-structures/queue/deque.ts +592 -70
- package/src/data-structures/queue/queue.ts +463 -42
- package/src/data-structures/stack/stack.ts +384 -32
- package/src/data-structures/trie/trie.ts +470 -48
- package/src/interfaces/graph.ts +1 -1
- package/src/types/common.ts +2 -2
- package/src/types/data-structures/binary-tree/segment-tree.ts +1 -1
- package/src/types/data-structures/heap/heap.ts +1 -0
- package/src/types/data-structures/linked-list/skip-linked-list.ts +2 -1
- package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
- package/src/types/utils/validate-type.ts +4 -4
- package/vercel.json +6 -0
- package/dist/leetcode/avl-tree-counter.mjs +0 -2957
- package/dist/leetcode/avl-tree-multi-map.mjs +0 -2889
- package/dist/leetcode/avl-tree.mjs +0 -2720
- package/dist/leetcode/binary-tree.mjs +0 -1594
- package/dist/leetcode/bst.mjs +0 -2398
- package/dist/leetcode/deque.mjs +0 -683
- package/dist/leetcode/directed-graph.mjs +0 -1733
- package/dist/leetcode/doubly-linked-list.mjs +0 -709
- package/dist/leetcode/hash-map.mjs +0 -493
- package/dist/leetcode/heap.mjs +0 -542
- package/dist/leetcode/max-heap.mjs +0 -375
- package/dist/leetcode/max-priority-queue.mjs +0 -383
- package/dist/leetcode/min-heap.mjs +0 -363
- package/dist/leetcode/min-priority-queue.mjs +0 -371
- package/dist/leetcode/priority-queue.mjs +0 -363
- package/dist/leetcode/queue.mjs +0 -943
- package/dist/leetcode/red-black-tree.mjs +0 -2765
- package/dist/leetcode/singly-linked-list.mjs +0 -754
- package/dist/leetcode/stack.mjs +0 -217
- package/dist/leetcode/tree-counter.mjs +0 -3039
- package/dist/leetcode/tree-multi-map.mjs +0 -2913
- package/dist/leetcode/trie.mjs +0 -413
- package/dist/leetcode/undirected-graph.mjs +0 -1650
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "data-structure-typed",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"description": "Standard data structure",
|
|
5
5
|
"browser": "dist/umd/data-structure-typed.min.js",
|
|
6
6
|
"umd:main": "dist/umd/data-structure-typed.min.js",
|
|
@@ -30,7 +30,98 @@
|
|
|
30
30
|
"types": "./dist/types/index.d.ts",
|
|
31
31
|
"import": "./dist/esm-legacy/index.mjs",
|
|
32
32
|
"require": "./dist/cjs-legacy/index.cjs"
|
|
33
|
-
}
|
|
33
|
+
},
|
|
34
|
+
"./binary-tree": {
|
|
35
|
+
"types": "./dist/types/data-structures/binary-tree/index.d.ts",
|
|
36
|
+
"node": {
|
|
37
|
+
"import": "./dist/esm/binary-tree.mjs",
|
|
38
|
+
"require": "./dist/cjs/binary-tree.cjs"
|
|
39
|
+
},
|
|
40
|
+
"import": "./dist/esm-legacy/binary-tree.mjs",
|
|
41
|
+
"require": "./dist/cjs-legacy/binary-tree.cjs"
|
|
42
|
+
},
|
|
43
|
+
"./graph": {
|
|
44
|
+
"types": "./dist/types/data-structures/graph/index.d.ts",
|
|
45
|
+
"node": {
|
|
46
|
+
"import": "./dist/esm/graph.mjs",
|
|
47
|
+
"require": "./dist/cjs/graph.cjs"
|
|
48
|
+
},
|
|
49
|
+
"import": "./dist/esm-legacy/graph.mjs",
|
|
50
|
+
"require": "./dist/cjs-legacy/graph.cjs"
|
|
51
|
+
},
|
|
52
|
+
"./hash": {
|
|
53
|
+
"types": "./dist/types/data-structures/hash/index.d.ts",
|
|
54
|
+
"node": {
|
|
55
|
+
"import": "./dist/esm/hash.mjs",
|
|
56
|
+
"require": "./dist/cjs/hash.cjs"
|
|
57
|
+
},
|
|
58
|
+
"import": "./dist/esm-legacy/hash.mjs",
|
|
59
|
+
"require": "./dist/cjs-legacy/hash.cjs"
|
|
60
|
+
},
|
|
61
|
+
"./heap": {
|
|
62
|
+
"types": "./dist/types/data-structures/heap/index.d.ts",
|
|
63
|
+
"node": {
|
|
64
|
+
"import": "./dist/esm/heap.mjs",
|
|
65
|
+
"require": "./dist/cjs/heap.cjs"
|
|
66
|
+
},
|
|
67
|
+
"import": "./dist/esm-legacy/heap.mjs",
|
|
68
|
+
"require": "./dist/cjs-legacy/heap.cjs"
|
|
69
|
+
},
|
|
70
|
+
"./linked-list": {
|
|
71
|
+
"types": "./dist/types/data-structures/linked-list/index.d.ts",
|
|
72
|
+
"node": {
|
|
73
|
+
"import": "./dist/esm/linked-list.mjs",
|
|
74
|
+
"require": "./dist/cjs/linked-list.cjs"
|
|
75
|
+
},
|
|
76
|
+
"import": "./dist/esm-legacy/linked-list.mjs",
|
|
77
|
+
"require": "./dist/cjs-legacy/linked-list.cjs"
|
|
78
|
+
},
|
|
79
|
+
"./matrix": {
|
|
80
|
+
"types": "./dist/types/data-structures/matrix/index.d.ts",
|
|
81
|
+
"node": {
|
|
82
|
+
"import": "./dist/esm/matrix.mjs",
|
|
83
|
+
"require": "./dist/cjs/matrix.cjs"
|
|
84
|
+
},
|
|
85
|
+
"import": "./dist/esm-legacy/matrix.mjs",
|
|
86
|
+
"require": "./dist/cjs-legacy/matrix.cjs"
|
|
87
|
+
},
|
|
88
|
+
"./priority-queue": {
|
|
89
|
+
"types": "./dist/types/data-structures/priority-queue/index.d.ts",
|
|
90
|
+
"node": {
|
|
91
|
+
"import": "./dist/esm/priority-queue.mjs",
|
|
92
|
+
"require": "./dist/cjs/priority-queue.cjs"
|
|
93
|
+
},
|
|
94
|
+
"import": "./dist/esm-legacy/priority-queue.mjs",
|
|
95
|
+
"require": "./dist/cjs-legacy/priority-queue.cjs"
|
|
96
|
+
},
|
|
97
|
+
"./queue": {
|
|
98
|
+
"types": "./dist/types/data-structures/queue/index.d.ts",
|
|
99
|
+
"node": {
|
|
100
|
+
"import": "./dist/esm/queue.mjs",
|
|
101
|
+
"require": "./dist/cjs/queue.cjs"
|
|
102
|
+
},
|
|
103
|
+
"import": "./dist/esm-legacy/queue.mjs",
|
|
104
|
+
"require": "./dist/cjs-legacy/queue.cjs"
|
|
105
|
+
},
|
|
106
|
+
"./stack": {
|
|
107
|
+
"types": "./dist/types/data-structures/stack/index.d.ts",
|
|
108
|
+
"node": {
|
|
109
|
+
"import": "./dist/esm/stack.mjs",
|
|
110
|
+
"require": "./dist/cjs/stack.cjs"
|
|
111
|
+
},
|
|
112
|
+
"import": "./dist/esm-legacy/stack.mjs",
|
|
113
|
+
"require": "./dist/cjs-legacy/stack.cjs"
|
|
114
|
+
},
|
|
115
|
+
"./trie": {
|
|
116
|
+
"types": "./dist/types/data-structures/trie/index.d.ts",
|
|
117
|
+
"node": {
|
|
118
|
+
"import": "./dist/esm/trie.mjs",
|
|
119
|
+
"require": "./dist/cjs/trie.cjs"
|
|
120
|
+
},
|
|
121
|
+
"import": "./dist/esm-legacy/trie.mjs",
|
|
122
|
+
"require": "./dist/cjs-legacy/trie.cjs"
|
|
123
|
+
},
|
|
124
|
+
"./package.json": "./package.json"
|
|
34
125
|
},
|
|
35
126
|
"sideEffects": false,
|
|
36
127
|
"engines": {
|
|
@@ -44,8 +135,9 @@
|
|
|
44
135
|
"build:types": "rm -rf dist/types && tsc -p tsconfig.types.json",
|
|
45
136
|
"build:ecut": "npm run build:node && npm run build:types && npm run build:umd",
|
|
46
137
|
"build:leetcode": "tsup --config tsup.leetcode.config.js",
|
|
47
|
-
"build:
|
|
48
|
-
"build:docs
|
|
138
|
+
"build:typedoc-plugin": "tsc scripts/typedoc-plugin-example-rewrite.ts --outDir scripts --esModuleInterop --module commonjs --target es2020 --moduleResolution node --skipLibCheck",
|
|
139
|
+
"build:docs": "npm run gen:examples && npm run generate:schema && npm run build:typedoc-plugin && typedoc --plugin ./scripts/typedoc-plugin-example-rewrite.js --out docs/api ./src",
|
|
140
|
+
"build:docs-class": "npm run gen:examples && npm run build:typedoc-plugin && typedoc --plugin ./scripts/typedoc-plugin-example-rewrite.js --out docs/api ./src/data-structures",
|
|
49
141
|
"gen:examples": "ts-node scripts/test-to-example.ts",
|
|
50
142
|
"test:in-band": "jest --runInBand",
|
|
51
143
|
"test": "npm run test:in-band",
|
|
@@ -75,7 +167,11 @@
|
|
|
75
167
|
"publish:subs": "npm run copy:to-subs && sh scripts/publish_all_subs.sh",
|
|
76
168
|
"publish:docs": "sh scripts/publish_docs.sh",
|
|
77
169
|
"publish:all": "npm run ci && npm publish && npm run publish:docs && npm run check:exist-latest && npm run publish:subs",
|
|
78
|
-
"generate:schema": "ts-node scripts/generate-schema.ts"
|
|
170
|
+
"generate:schema": "ts-node scripts/generate-schema.ts",
|
|
171
|
+
"docs:api": "npm run gen:examples && npm run build:typedoc-plugin && cd docs-site-docusaurus && npx typedoc --options typedoc.json && node sort-protected.mjs",
|
|
172
|
+
"docs:dev": "cd docs-site-docusaurus && npm run start",
|
|
173
|
+
"docs:build": "cd docs-site-docusaurus && rm -rf docs/api && npx typedoc --options typedoc.json && node sort-protected.mjs && npm run build",
|
|
174
|
+
"docs:preview": "cd docs-site-docusaurus && npm run serve"
|
|
79
175
|
},
|
|
80
176
|
"repository": {
|
|
81
177
|
"type": "git",
|
|
@@ -101,11 +197,11 @@
|
|
|
101
197
|
"@typescript-eslint/eslint-plugin": "^8.12.1",
|
|
102
198
|
"@typescript-eslint/parser": "^8.12.1",
|
|
103
199
|
"auto-changelog": "^2.5.0",
|
|
104
|
-
"avl-tree-typed": "^
|
|
200
|
+
"avl-tree-typed": "^2.5.0",
|
|
105
201
|
"benchmark": "^2.1.4",
|
|
106
|
-
"binary-tree-typed": "^
|
|
107
|
-
"bst-typed": "^
|
|
108
|
-
"data-structure-typed": "^2.
|
|
202
|
+
"binary-tree-typed": "^2.5.0",
|
|
203
|
+
"bst-typed": "^2.5.0",
|
|
204
|
+
"data-structure-typed": "^2.5.0",
|
|
109
205
|
"dependency-cruiser": "^16.5.0",
|
|
110
206
|
"doctoc": "^2.2.1",
|
|
111
207
|
"eslint": "^9.13.0",
|
|
@@ -114,7 +210,7 @@
|
|
|
114
210
|
"eslint-import-resolver-typescript": "^3.6.3",
|
|
115
211
|
"eslint-plugin-import": "^2.31.0",
|
|
116
212
|
"fast-glob": "^3.3.2",
|
|
117
|
-
"heap-typed": "^
|
|
213
|
+
"heap-typed": "^2.5.0",
|
|
118
214
|
"istanbul-badges-readme": "^1.9.0",
|
|
119
215
|
"jest": "^29.7.0",
|
|
120
216
|
"js-sdsl": "^4.4.2",
|
|
@@ -124,8 +220,9 @@
|
|
|
124
220
|
"ts-morph": "^27.0.2",
|
|
125
221
|
"ts-node": "^10.9.2",
|
|
126
222
|
"tsup": "^8.5.1",
|
|
127
|
-
"typedoc": "^0.
|
|
128
|
-
"
|
|
223
|
+
"typedoc": "^0.28.18",
|
|
224
|
+
"typedoc-plugin-markdown": "^4.11.0",
|
|
225
|
+
"typescript": "~5.9"
|
|
129
226
|
},
|
|
130
227
|
"keywords": [
|
|
131
228
|
"data structures typescript",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ElementCallback, IterableElementBaseOptions, ReduceElementCallback } from '../../types';
|
|
2
|
-
import { ERR } from '../../common';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* Base class that makes a data structure iterable and provides common
|
|
@@ -26,7 +25,7 @@ export abstract class IterableElementBase<E, R> implements Iterable<E> {
|
|
|
26
25
|
if (options) {
|
|
27
26
|
const { toElementFn } = options;
|
|
28
27
|
if (typeof toElementFn === 'function') this._toElementFn = toElementFn;
|
|
29
|
-
else if (toElementFn) throw new TypeError(
|
|
28
|
+
else if (toElementFn) throw new TypeError('toElementFn must be a function type');
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
31
|
|
|
@@ -36,7 +35,7 @@ export abstract class IterableElementBase<E, R> implements Iterable<E> {
|
|
|
36
35
|
* @remarks
|
|
37
36
|
* Time O(1), Space O(1).
|
|
38
37
|
*/
|
|
39
|
-
protected
|
|
38
|
+
protected _toElementFn?: (rawElement: R) => E;
|
|
40
39
|
|
|
41
40
|
/**
|
|
42
41
|
* Exposes the current `toElementFn`, if configured.
|
|
@@ -225,12 +224,12 @@ export abstract class IterableElementBase<E, R> implements Iterable<E> {
|
|
|
225
224
|
acc = initialValue as U;
|
|
226
225
|
} else {
|
|
227
226
|
const first = iter.next();
|
|
228
|
-
if (first.done) throw new TypeError(
|
|
227
|
+
if (first.done) throw new TypeError('Reduce of empty structure with no initial value');
|
|
229
228
|
acc = first.value as unknown as U;
|
|
230
229
|
index = 1;
|
|
231
230
|
}
|
|
232
231
|
|
|
233
|
-
for (const value of iter) {
|
|
232
|
+
for (const value of iter as unknown as Iterable<E>) {
|
|
234
233
|
acc = callbackfn(acc, value, index++, this);
|
|
235
234
|
}
|
|
236
235
|
return acc;
|
|
@@ -19,7 +19,7 @@ export abstract class IterableEntryBase<K = any, V = any> {
|
|
|
19
19
|
* @returns Iterator of `[K, V]`.
|
|
20
20
|
* @remarks Time O(n) to iterate, Space O(1)
|
|
21
21
|
*/
|
|
22
|
-
*[Symbol.iterator](...args:
|
|
22
|
+
*[Symbol.iterator](...args: unknown[]): IterableIterator<[K, V]> {
|
|
23
23
|
yield* this._getIterator(...args);
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -63,7 +63,7 @@ export abstract class IterableEntryBase<K = any, V = any> {
|
|
|
63
63
|
* @returns `true` if all pass; otherwise `false`.
|
|
64
64
|
* @remarks Time O(n), Space O(1)
|
|
65
65
|
*/
|
|
66
|
-
every(predicate: EntryCallback<K, V, boolean>, thisArg?:
|
|
66
|
+
every(predicate: EntryCallback<K, V, boolean>, thisArg?: unknown): boolean {
|
|
67
67
|
let index = 0;
|
|
68
68
|
for (const item of this) {
|
|
69
69
|
if (!predicate.call(thisArg, item[1], item[0], index++, this)) {
|
|
@@ -80,7 +80,7 @@ export abstract class IterableEntryBase<K = any, V = any> {
|
|
|
80
80
|
* @returns `true` if any passes; otherwise `false`.
|
|
81
81
|
* @remarks Time O(n), Space O(1)
|
|
82
82
|
*/
|
|
83
|
-
some(predicate: EntryCallback<K, V, boolean>, thisArg?:
|
|
83
|
+
some(predicate: EntryCallback<K, V, boolean>, thisArg?: unknown): boolean {
|
|
84
84
|
let index = 0;
|
|
85
85
|
for (const item of this) {
|
|
86
86
|
if (predicate.call(thisArg, item[1], item[0], index++, this)) {
|
|
@@ -96,7 +96,7 @@ export abstract class IterableEntryBase<K = any, V = any> {
|
|
|
96
96
|
* @param thisArg - Optional `this` for callback.
|
|
97
97
|
* @remarks Time O(n), Space O(1)
|
|
98
98
|
*/
|
|
99
|
-
forEach(callbackfn: EntryCallback<K, V, void>, thisArg?:
|
|
99
|
+
forEach(callbackfn: EntryCallback<K, V, void>, thisArg?: unknown): void {
|
|
100
100
|
let index = 0;
|
|
101
101
|
for (const item of this) {
|
|
102
102
|
const [key, value] = item;
|
|
@@ -111,7 +111,7 @@ export abstract class IterableEntryBase<K = any, V = any> {
|
|
|
111
111
|
* @returns Matching `[key, value]` or `undefined`.
|
|
112
112
|
* @remarks Time O(n), Space O(1)
|
|
113
113
|
*/
|
|
114
|
-
find(callbackfn: EntryCallback<K, V, boolean>, thisArg?:
|
|
114
|
+
find(callbackfn: EntryCallback<K, V, boolean>, thisArg?: unknown): [K, V] | undefined {
|
|
115
115
|
let index = 0;
|
|
116
116
|
for (const item of this) {
|
|
117
117
|
const [key, value] = item;
|
|
@@ -228,19 +228,19 @@ export abstract class IterableEntryBase<K = any, V = any> {
|
|
|
228
228
|
* Map entries using an implementation-specific strategy.
|
|
229
229
|
* @remarks Time O(n), Space O(n)
|
|
230
230
|
*/
|
|
231
|
-
abstract map(...args:
|
|
231
|
+
abstract map(...args: unknown[]): unknown;
|
|
232
232
|
|
|
233
233
|
/**
|
|
234
234
|
* Filter entries and return the same-species structure.
|
|
235
235
|
* @returns A new instance of the same concrete class (`this` type).
|
|
236
236
|
* @remarks Time O(n), Space O(n)
|
|
237
237
|
*/
|
|
238
|
-
abstract filter(...args:
|
|
238
|
+
abstract filter(...args: unknown[]): this;
|
|
239
239
|
|
|
240
240
|
/**
|
|
241
241
|
* Underlying iterator for the default iteration protocol.
|
|
242
242
|
* @returns Iterator of `[K, V]`.
|
|
243
243
|
* @remarks Time O(n), Space O(1)
|
|
244
244
|
*/
|
|
245
|
-
protected abstract _getIterator(...args:
|
|
245
|
+
protected abstract _getIterator(...args: unknown[]): IterableIterator<[K, V]>;
|
|
246
246
|
}
|
|
@@ -148,7 +148,7 @@ export abstract class LinearBase<
|
|
|
148
148
|
* @returns Index or `-1`.
|
|
149
149
|
* @remarks Time O(n), Space O(1)
|
|
150
150
|
*/
|
|
151
|
-
findIndex(predicate: ElementCallback<E, R, boolean>, thisArg?:
|
|
151
|
+
findIndex(predicate: ElementCallback<E, R, boolean>, thisArg?: unknown): number {
|
|
152
152
|
for (let i = 0; i < this.length; i++) {
|
|
153
153
|
const item = this.at(i);
|
|
154
154
|
if (item !== undefined && predicate.call(thisArg, item, i, this)) return i;
|
|
@@ -389,7 +389,7 @@ export abstract class LinearBase<
|
|
|
389
389
|
* @returns Iterator of elements from tail to head.
|
|
390
390
|
* @remarks Time O(n), Space O(1)
|
|
391
391
|
*/
|
|
392
|
-
protected abstract _getReverseIterator(...args:
|
|
392
|
+
protected abstract _getReverseIterator(...args: unknown[]): IterableIterator<E>;
|
|
393
393
|
}
|
|
394
394
|
|
|
395
395
|
/**
|
|
@@ -621,7 +621,7 @@ export abstract class LinearLinkedBase<
|
|
|
621
621
|
* @returns Iterator over nodes.
|
|
622
622
|
* @remarks Time O(n), Space O(1)
|
|
623
623
|
*/
|
|
624
|
-
protected abstract _getNodeIterator(...args:
|
|
624
|
+
protected abstract _getNodeIterator(...args: unknown[]): IterableIterator<NODE>;
|
|
625
625
|
|
|
626
626
|
/**
|
|
627
627
|
* Get previous node of a given node.
|