data-structure-typed 0.8.18 → 1.12.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/.dependency-cruiser.js +449 -0
  2. package/.idea/data-structure-typed.iml +2 -0
  3. package/.idea/modules.xml +1 -1
  4. package/README.md +298 -2
  5. package/dist/data-structures/binary-tree/aa-tree.js +5 -2
  6. package/dist/data-structures/binary-tree/avl-tree.d.ts +58 -5
  7. package/dist/data-structures/binary-tree/avl-tree.js +150 -46
  8. package/dist/data-structures/binary-tree/b-tree.js +5 -2
  9. package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +28 -1
  10. package/dist/data-structures/binary-tree/binary-indexed-tree.js +41 -13
  11. package/dist/data-structures/binary-tree/binary-tree.d.ts +230 -36
  12. package/dist/data-structures/binary-tree/binary-tree.js +747 -369
  13. package/dist/data-structures/binary-tree/bst.d.ts +20 -8
  14. package/dist/data-structures/binary-tree/bst.js +164 -107
  15. package/dist/data-structures/binary-tree/rb-tree.js +5 -2
  16. package/dist/data-structures/binary-tree/segment-tree.d.ts +7 -3
  17. package/dist/data-structures/binary-tree/segment-tree.js +95 -61
  18. package/dist/data-structures/binary-tree/splay-tree.js +5 -2
  19. package/dist/data-structures/binary-tree/tree-multiset.d.ts +5 -5
  20. package/dist/data-structures/binary-tree/tree-multiset.js +35 -11
  21. package/dist/data-structures/binary-tree/two-three-tree.js +5 -2
  22. package/dist/data-structures/graph/abstract-graph.d.ts +168 -46
  23. package/dist/data-structures/graph/abstract-graph.js +712 -323
  24. package/dist/data-structures/graph/directed-graph.d.ts +114 -12
  25. package/dist/data-structures/graph/directed-graph.js +372 -128
  26. package/dist/data-structures/graph/undirected-graph.d.ts +67 -3
  27. package/dist/data-structures/graph/undirected-graph.js +233 -81
  28. package/dist/data-structures/hash/coordinate-map.d.ts +33 -1
  29. package/dist/data-structures/hash/coordinate-map.js +70 -20
  30. package/dist/data-structures/hash/coordinate-set.d.ts +25 -0
  31. package/dist/data-structures/hash/coordinate-set.js +58 -15
  32. package/dist/data-structures/hash/index.d.ts +5 -0
  33. package/dist/data-structures/hash/index.js +5 -0
  34. package/dist/data-structures/heap/heap.d.ts +26 -37
  35. package/dist/data-structures/heap/heap.js +56 -60
  36. package/dist/data-structures/heap/max-heap.d.ts +8 -2
  37. package/dist/data-structures/heap/max-heap.js +32 -9
  38. package/dist/data-structures/heap/min-heap.d.ts +9 -2
  39. package/dist/data-structures/heap/min-heap.js +33 -9
  40. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +14 -7
  41. package/dist/data-structures/linked-list/doubly-linked-list.js +101 -61
  42. package/dist/data-structures/linked-list/singly-linked-list.d.ts +18 -19
  43. package/dist/data-structures/linked-list/singly-linked-list.js +312 -174
  44. package/dist/data-structures/matrix/matrix.d.ts +9 -0
  45. package/dist/data-structures/matrix/matrix.js +19 -7
  46. package/dist/data-structures/matrix/matrix2d.d.ts +84 -4
  47. package/dist/data-structures/matrix/matrix2d.js +158 -61
  48. package/dist/data-structures/matrix/navigator.d.ts +34 -16
  49. package/dist/data-structures/matrix/navigator.js +65 -18
  50. package/dist/data-structures/matrix/vector2d.d.ts +153 -29
  51. package/dist/data-structures/matrix/vector2d.js +249 -102
  52. package/dist/data-structures/priority-queue/max-priority-queue.d.ts +11 -2
  53. package/dist/data-structures/priority-queue/max-priority-queue.js +33 -8
  54. package/dist/data-structures/priority-queue/min-priority-queue.d.ts +11 -2
  55. package/dist/data-structures/priority-queue/min-priority-queue.js +33 -8
  56. package/dist/data-structures/priority-queue/priority-queue.d.ts +145 -21
  57. package/dist/data-structures/priority-queue/priority-queue.js +285 -116
  58. package/dist/data-structures/queue/deque.d.ts +69 -0
  59. package/dist/data-structures/queue/deque.js +151 -56
  60. package/dist/data-structures/queue/queue.d.ts +34 -37
  61. package/dist/data-structures/queue/queue.js +59 -61
  62. package/dist/data-structures/stack/stack.d.ts +29 -35
  63. package/dist/data-structures/stack/stack.js +51 -56
  64. package/dist/data-structures/trie/trie.d.ts +36 -6
  65. package/dist/data-structures/trie/trie.js +256 -83
  66. package/dist/data-structures/types/abstract-graph.d.ts +29 -0
  67. package/dist/data-structures/types/abstract-graph.js +2 -0
  68. package/dist/data-structures/types/avl-tree.d.ts +5 -0
  69. package/dist/data-structures/types/avl-tree.js +2 -0
  70. package/dist/data-structures/types/binary-tree.d.ts +16 -0
  71. package/dist/data-structures/types/binary-tree.js +2 -0
  72. package/dist/data-structures/types/bst.d.ts +7 -0
  73. package/dist/data-structures/types/bst.js +2 -0
  74. package/dist/data-structures/types/directed-graph.d.ts +10 -0
  75. package/dist/data-structures/types/directed-graph.js +2 -0
  76. package/dist/data-structures/types/doubly-linked-list.d.ts +1 -0
  77. package/dist/data-structures/types/doubly-linked-list.js +2 -0
  78. package/dist/data-structures/types/heap.d.ts +7 -0
  79. package/dist/data-structures/types/heap.js +2 -0
  80. package/dist/data-structures/types/index.d.ts +13 -0
  81. package/dist/data-structures/types/index.js +29 -0
  82. package/dist/data-structures/types/navigator.d.ts +14 -0
  83. package/dist/data-structures/types/navigator.js +2 -0
  84. package/dist/data-structures/types/priority-queue.d.ts +7 -0
  85. package/dist/data-structures/types/priority-queue.js +2 -0
  86. package/dist/data-structures/types/segment-tree.d.ts +1 -0
  87. package/dist/data-structures/types/segment-tree.js +2 -0
  88. package/dist/data-structures/types/singly-linked-list.js +2 -0
  89. package/dist/data-structures/types/tree-multiset.d.ts +5 -0
  90. package/dist/data-structures/types/tree-multiset.js +2 -0
  91. package/dist/utils/trampoline.d.ts +14 -0
  92. package/dist/utils/trampoline.js +130 -0
  93. package/dist/utils/types/index.js +17 -0
  94. package/dist/{types → utils}/types/utils.d.ts +15 -1
  95. package/dist/{types → utils/types}/utils.js +21 -19
  96. package/dist/{utils.d.ts → utils/utils.d.ts} +5 -22
  97. package/dist/utils/utils.js +651 -0
  98. package/docs/.nojekyll +1 -0
  99. package/docs/assets/highlight.css +85 -0
  100. package/docs/assets/main.js +58 -0
  101. package/docs/assets/search.js +1 -0
  102. package/docs/assets/style.css +1367 -0
  103. package/docs/classes/AVLTree.html +2046 -0
  104. package/docs/classes/AVLTreeNode.html +423 -0
  105. package/docs/classes/AaTree.html +117 -0
  106. package/docs/classes/AbstractEdge.html +198 -0
  107. package/docs/classes/AbstractGraph.html +891 -0
  108. package/docs/classes/AbstractVertex.html +164 -0
  109. package/docs/classes/ArrayDeque.html +384 -0
  110. package/docs/classes/BST.html +1893 -0
  111. package/docs/classes/BSTNode.html +425 -0
  112. package/docs/classes/BTree.html +117 -0
  113. package/docs/classes/BinaryIndexedTree.html +244 -0
  114. package/docs/classes/BinaryTree.html +1754 -0
  115. package/docs/classes/BinaryTreeNode.html +396 -0
  116. package/docs/classes/Character.html +165 -0
  117. package/docs/classes/CoordinateMap.html +394 -0
  118. package/docs/classes/CoordinateSet.html +355 -0
  119. package/docs/classes/Deque.html +617 -0
  120. package/docs/classes/DirectedEdge.html +247 -0
  121. package/docs/classes/DirectedGraph.html +1207 -0
  122. package/docs/classes/DirectedVertex.html +154 -0
  123. package/docs/classes/DoublyLinkedList.html +619 -0
  124. package/docs/classes/DoublyLinkedListNode.html +160 -0
  125. package/docs/classes/Heap.html +315 -0
  126. package/docs/classes/Matrix2D.html +447 -0
  127. package/docs/classes/MatrixNTI2D.html +181 -0
  128. package/docs/classes/MaxHeap.html +325 -0
  129. package/docs/classes/MaxPriorityQueue.html +668 -0
  130. package/docs/classes/MinHeap.html +326 -0
  131. package/docs/classes/MinPriorityQueue.html +668 -0
  132. package/docs/classes/Navigator.html +285 -0
  133. package/docs/classes/ObjectDeque.html +289 -0
  134. package/docs/classes/PriorityQueue.html +643 -0
  135. package/docs/classes/Queue.html +337 -0
  136. package/docs/classes/RBTree.html +117 -0
  137. package/docs/classes/SegmentTree.html +234 -0
  138. package/docs/classes/SegmentTreeNode.html +302 -0
  139. package/docs/classes/SinglyLinkedList.html +1035 -0
  140. package/docs/classes/SinglyLinkedListNode.html +304 -0
  141. package/docs/classes/SplayTree.html +117 -0
  142. package/docs/classes/Stack.html +313 -0
  143. package/docs/classes/TreeMultiSet.html +1897 -0
  144. package/docs/classes/Trie.html +317 -0
  145. package/docs/classes/TrieNode.html +221 -0
  146. package/docs/classes/TwoThreeTree.html +117 -0
  147. package/docs/classes/UndirectedEdge.html +220 -0
  148. package/docs/classes/UndirectedGraph.html +1006 -0
  149. package/docs/classes/UndirectedVertex.html +154 -0
  150. package/docs/classes/Vector2D.html +746 -0
  151. package/docs/enums/CP.html +126 -0
  152. package/docs/enums/FamilyPosition.html +126 -0
  153. package/docs/enums/LoopType.html +119 -0
  154. package/docs/index.html +288 -0
  155. package/docs/modules.html +146 -0
  156. package/jest.config.js +5 -0
  157. package/package.json +33 -47
  158. package/rename_clear_files.sh +29 -0
  159. package/src/assets/complexities-diff.jpg +0 -0
  160. package/src/assets/data-structure-complexities.jpg +0 -0
  161. package/src/data-structures/binary-tree/avl-tree.ts +58 -6
  162. package/src/data-structures/binary-tree/binary-indexed-tree.ts +31 -4
  163. package/src/data-structures/binary-tree/binary-tree.ts +460 -145
  164. package/src/data-structures/binary-tree/bst.ts +31 -25
  165. package/src/data-structures/binary-tree/diagrams/avl-tree-inserting.gif +0 -0
  166. package/src/data-structures/binary-tree/diagrams/bst-rotation.gif +0 -0
  167. package/src/data-structures/binary-tree/diagrams/segment-tree.png +0 -0
  168. package/src/data-structures/binary-tree/segment-tree.ts +25 -12
  169. package/src/data-structures/binary-tree/tree-multiset.ts +5 -4
  170. package/src/data-structures/diagrams/README.md +5 -0
  171. package/src/data-structures/graph/abstract-graph.ts +224 -108
  172. package/src/data-structures/graph/diagrams/adjacency-list-pros-cons.jpg +0 -0
  173. package/src/data-structures/graph/diagrams/adjacency-list.jpg +0 -0
  174. package/src/data-structures/graph/diagrams/adjacency-matrix-pros-cons.jpg +0 -0
  175. package/src/data-structures/graph/diagrams/adjacency-matrix.jpg +0 -0
  176. package/src/data-structures/graph/diagrams/dfs-can-do.jpg +0 -0
  177. package/src/data-structures/graph/diagrams/edge-list-pros-cons.jpg +0 -0
  178. package/src/data-structures/graph/diagrams/edge-list.jpg +0 -0
  179. package/src/data-structures/graph/diagrams/max-flow.jpg +0 -0
  180. package/src/data-structures/graph/diagrams/mst.jpg +0 -0
  181. package/src/data-structures/graph/diagrams/tarjan-articulation-point-bridge.png +0 -0
  182. package/src/data-structures/graph/diagrams/tarjan-complicate-simple.png +0 -0
  183. package/src/data-structures/graph/diagrams/tarjan-strongly-connected-component.png +0 -0
  184. package/src/data-structures/graph/diagrams/tarjan.mp4 +0 -0
  185. package/src/data-structures/graph/diagrams/tarjan.webp +0 -0
  186. package/src/data-structures/graph/directed-graph.ts +132 -26
  187. package/src/data-structures/graph/undirected-graph.ts +78 -11
  188. package/src/data-structures/hash/coordinate-map.ts +33 -1
  189. package/src/data-structures/hash/coordinate-set.ts +25 -0
  190. package/src/data-structures/hash/index.ts +5 -0
  191. package/src/data-structures/heap/heap.ts +27 -41
  192. package/src/data-structures/heap/max-heap.ts +8 -2
  193. package/src/data-structures/heap/min-heap.ts +9 -2
  194. package/src/data-structures/linked-list/doubly-linked-list.ts +50 -17
  195. package/src/data-structures/linked-list/singly-linked-list.ts +56 -39
  196. package/src/data-structures/matrix/matrix.ts +11 -0
  197. package/src/data-structures/matrix/matrix2d.ts +90 -10
  198. package/src/data-structures/matrix/navigator.ts +34 -14
  199. package/src/data-structures/matrix/vector2d.ts +187 -63
  200. package/src/data-structures/priority-queue/max-priority-queue.ts +12 -3
  201. package/src/data-structures/priority-queue/min-priority-queue.ts +12 -3
  202. package/src/data-structures/priority-queue/priority-queue.ts +200 -78
  203. package/src/data-structures/queue/deque.ts +71 -2
  204. package/src/data-structures/queue/queue.ts +37 -40
  205. package/src/data-structures/stack/stack.ts +32 -38
  206. package/src/data-structures/trie/trie.ts +83 -14
  207. package/src/data-structures/types/abstract-graph.ts +51 -0
  208. package/src/data-structures/types/avl-tree.ts +6 -0
  209. package/src/data-structures/types/binary-tree.ts +15 -0
  210. package/src/data-structures/types/bst.ts +5 -0
  211. package/src/data-structures/types/directed-graph.ts +18 -0
  212. package/src/data-structures/types/doubly-linked-list.ts +1 -0
  213. package/src/data-structures/types/heap.ts +8 -0
  214. package/src/data-structures/types/index.ts +13 -0
  215. package/src/data-structures/types/navigator.ts +13 -0
  216. package/src/data-structures/types/priority-queue.ts +9 -0
  217. package/src/data-structures/types/segment-tree.ts +1 -0
  218. package/src/data-structures/types/singly-linked-list.ts +1 -0
  219. package/src/data-structures/types/tree-multiset.ts +3 -0
  220. package/src/utils/index.ts +1 -0
  221. package/src/utils/trampoline.ts +51 -0
  222. package/src/utils/types/index.ts +1 -0
  223. package/src/{types → utils/types}/utils.ts +27 -5
  224. package/src/{utils.ts → utils/utils.ts} +41 -131
  225. package/tests/unit/data-structures/binary-tree/bst.test.ts +185 -0
  226. package/tests/unit/data-structures/graph/directed-graph.test.ts +71 -0
  227. package/{dist/types/data-structures/graph/index.d.ts → tests/unit/data-structures/graph/index.ts} +1 -1
  228. package/tests/unit/data-structures/graph/undirected-graph.ts +0 -0
  229. package/tsconfig.json +9 -6
  230. package/dist/data-structures/trampoline.d.ts +0 -25
  231. package/dist/data-structures/trampoline.js +0 -52
  232. package/dist/types/data-structures/binary-tree/aa-tree.d.ts +0 -2
  233. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +0 -21
  234. package/dist/types/data-structures/binary-tree/b-tree.d.ts +0 -2
  235. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -8
  236. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +0 -140
  237. package/dist/types/data-structures/binary-tree/bst.d.ts +0 -32
  238. package/dist/types/data-structures/binary-tree/index.d.ts +0 -4
  239. package/dist/types/data-structures/binary-tree/rb-tree.d.ts +0 -2
  240. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +0 -33
  241. package/dist/types/data-structures/binary-tree/splay-tree.d.ts +0 -2
  242. package/dist/types/data-structures/binary-tree/tree-multiset.d.ts +0 -11
  243. package/dist/types/data-structures/binary-tree/two-three-tree.d.ts +0 -2
  244. package/dist/types/data-structures/graph/abstract-graph.d.ts +0 -126
  245. package/dist/types/data-structures/graph/directed-graph.d.ts +0 -51
  246. package/dist/types/data-structures/graph/undirected-graph.d.ts +0 -24
  247. package/dist/types/data-structures/hash/coordinate-map.d.ts +0 -8
  248. package/dist/types/data-structures/hash/coordinate-set.d.ts +0 -7
  249. package/dist/types/data-structures/hash/index.d.ts +0 -1
  250. package/dist/types/data-structures/hash/pair.d.ts +0 -1
  251. package/dist/types/data-structures/hash/tree-map.d.ts +0 -1
  252. package/dist/types/data-structures/hash/tree-set.d.ts +0 -1
  253. package/dist/types/data-structures/heap/heap.d.ts +0 -72
  254. package/dist/types/data-structures/heap/index.d.ts +0 -3
  255. package/dist/types/data-structures/heap/max-heap.d.ts +0 -14
  256. package/dist/types/data-structures/heap/min-heap.d.ts +0 -14
  257. package/dist/types/data-structures/index.d.ts +0 -9
  258. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +0 -59
  259. package/dist/types/data-structures/linked-list/index.d.ts +0 -2
  260. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +0 -358
  261. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +0 -1
  262. package/dist/types/data-structures/matrix/index.d.ts +0 -3
  263. package/dist/types/data-structures/matrix/matrix.d.ts +0 -9
  264. package/dist/types/data-structures/matrix/matrix2d.d.ts +0 -25
  265. package/dist/types/data-structures/matrix/navigator.d.ts +0 -31
  266. package/dist/types/data-structures/matrix/vector2d.d.ts +0 -74
  267. package/dist/types/data-structures/priority-queue/index.d.ts +0 -3
  268. package/dist/types/data-structures/priority-queue/max-priority-queue.d.ts +0 -4
  269. package/dist/types/data-structures/priority-queue/min-priority-queue.d.ts +0 -4
  270. package/dist/types/data-structures/priority-queue/priority-queue.d.ts +0 -36
  271. package/dist/types/data-structures/queue/deque.d.ts +0 -37
  272. package/dist/types/data-structures/queue/index.d.ts +0 -1
  273. package/dist/types/data-structures/queue/queue.d.ts +0 -76
  274. package/dist/types/data-structures/stack/index.d.ts +0 -1
  275. package/dist/types/data-structures/stack/stack.d.ts +0 -69
  276. package/dist/types/data-structures/trampoline.d.ts +0 -25
  277. package/dist/types/data-structures/trie/index.d.ts +0 -1
  278. package/dist/types/data-structures/trie/trie.d.ts +0 -28
  279. package/dist/types/utils.d.ts +0 -46
  280. package/dist/utils.js +0 -569
  281. package/src/data-structures/trampoline.ts +0 -91
  282. package/src/types/index.ts +0 -1
  283. /package/dist/{types/data-structures/hash/hash-table.d.ts → data-structures/types/singly-linked-list.d.ts} +0 -0
  284. /package/dist/{types → utils}/index.d.ts +0 -0
  285. /package/dist/{types → utils}/index.js +0 -0
  286. /package/dist/{types → utils}/types/index.d.ts +0 -0
  287. /package/{src/types/patches/index.d.ts → tests/unit/data-structures/graph/abstract-graph.ts} +0 -0
@@ -0,0 +1,7 @@
1
+ import { BSTNode } from '../binary-tree';
2
+ import type { BinaryTreeNodeId } from './binary-tree';
3
+ export type BSTComparator = (a: BinaryTreeNodeId, b: BinaryTreeNodeId) => number;
4
+ export type BSTDeletedResult<T> = {
5
+ deleted: BSTNode<T> | null;
6
+ needBalanced: BSTNode<T> | null;
7
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { VertexId } from './abstract-graph';
2
+ export interface IDirectedGraph<V, E> {
3
+ incomingEdgesOf(vertex: V): E[];
4
+ outgoingEdgesOf(vertex: V): E[];
5
+ inDegreeOf(vertexOrId: V | VertexId): number;
6
+ outDegreeOf(vertexOrId: V | VertexId): number;
7
+ getEdgeSrc(e: E): V | null;
8
+ getEdgeDest(e: E): V | null;
9
+ }
10
+ export type TopologicalStatus = 0 | 1 | 2;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type DoublyLinkedListGetBy = 'node' | 'val';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ export interface HeapOptions<T> {
2
+ priority?: (element: T) => number;
3
+ }
4
+ export interface HeapItem<T> {
5
+ priority: number;
6
+ element: T | null;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ export * from './binary-tree';
2
+ export * from './bst';
3
+ export * from './avl-tree';
4
+ export * from './segment-tree';
5
+ export * from './tree-multiset';
6
+ export * from './abstract-graph';
7
+ export * from './directed-graph';
8
+ export * from './priority-queue';
9
+ export * from './heap';
10
+ export * from './singly-linked-list';
11
+ export * from './doubly-linked-list';
12
+ export * from './navigator';
13
+ export * from '../../utils/types/utils';
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./binary-tree"), exports);
18
+ __exportStar(require("./bst"), exports);
19
+ __exportStar(require("./avl-tree"), exports);
20
+ __exportStar(require("./segment-tree"), exports);
21
+ __exportStar(require("./tree-multiset"), exports);
22
+ __exportStar(require("./abstract-graph"), exports);
23
+ __exportStar(require("./directed-graph"), exports);
24
+ __exportStar(require("./priority-queue"), exports);
25
+ __exportStar(require("./heap"), exports);
26
+ __exportStar(require("./singly-linked-list"), exports);
27
+ __exportStar(require("./doubly-linked-list"), exports);
28
+ __exportStar(require("./navigator"), exports);
29
+ __exportStar(require("../../utils/types/utils"), exports);
@@ -0,0 +1,14 @@
1
+ export type Direction = 'up' | 'right' | 'down' | 'left';
2
+ export type Turning = {
3
+ [key in Direction]: Direction;
4
+ };
5
+ export interface NavigatorParams<T> {
6
+ matrix: T[][];
7
+ turning: Turning;
8
+ onMove: (cur: [number, number]) => void;
9
+ init: {
10
+ cur: [number, number];
11
+ charDir: Direction;
12
+ VISITED: T;
13
+ };
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ export type PriorityQueueComparator<T> = (a: T, b: T) => number;
2
+ export interface PriorityQueueOptions<T> {
3
+ nodes?: T[];
4
+ isFix?: boolean;
5
+ comparator: PriorityQueueComparator<T>;
6
+ }
7
+ export type PriorityQueueDFSOrderPattern = 'pre' | 'in' | 'post';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type SegmentTreeNodeVal = number;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import { BSTNode } from '../binary-tree';
2
+ export type TreeMultiSetDeletedResult<T> = {
3
+ deleted: BSTNode<T> | null;
4
+ needBalanced: BSTNode<T> | null;
5
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @copyright 2030 Tyler Zeng <zrwusa@gmail.com>
3
+ * @license MIT
4
+ */
5
+ import { Thunk, ToThunkFn, TrlAsyncFn, TrlFn } from './types';
6
+ export declare const THUNK_SYMBOL: unique symbol;
7
+ export declare const isThunk: (fnOrValue: any) => boolean;
8
+ export declare const toThunk: (fn: ToThunkFn) => Thunk;
9
+ export declare const trampoline: (fn: TrlFn) => ((...args: [...Parameters<TrlFn>]) => any) & {
10
+ cont: (...args: [...Parameters<TrlFn>]) => Thunk;
11
+ };
12
+ export declare const trampolineAsync: (fn: TrlAsyncFn) => ((...args: [...Parameters<TrlAsyncFn>]) => Promise<any>) & {
13
+ cont: (...args: [...Parameters<TrlAsyncFn>]) => Thunk;
14
+ };
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __read = (this && this.__read) || function (o, n) {
39
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
40
+ if (!m) return o;
41
+ var i = m.call(o), r, ar = [], e;
42
+ try {
43
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
44
+ }
45
+ catch (error) { e = { error: error }; }
46
+ finally {
47
+ try {
48
+ if (r && !r.done && (m = i["return"])) m.call(i);
49
+ }
50
+ finally { if (e) throw e.error; }
51
+ }
52
+ return ar;
53
+ };
54
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
55
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
56
+ if (ar || !(i in from)) {
57
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
58
+ ar[i] = from[i];
59
+ }
60
+ }
61
+ return to.concat(ar || Array.prototype.slice.call(from));
62
+ };
63
+ Object.defineProperty(exports, "__esModule", { value: true });
64
+ exports.trampolineAsync = exports.trampoline = exports.toThunk = exports.isThunk = exports.THUNK_SYMBOL = void 0;
65
+ exports.THUNK_SYMBOL = Symbol('thunk');
66
+ var isThunk = function (fnOrValue) {
67
+ return typeof fnOrValue === 'function' && fnOrValue.__THUNK__ === exports.THUNK_SYMBOL;
68
+ };
69
+ exports.isThunk = isThunk;
70
+ var toThunk = function (fn) {
71
+ var thunk = function () { return fn(); };
72
+ thunk.__THUNK__ = exports.THUNK_SYMBOL;
73
+ return thunk;
74
+ };
75
+ exports.toThunk = toThunk;
76
+ var trampoline = function (fn) {
77
+ var cont = function () {
78
+ var args = [];
79
+ for (var _i = 0; _i < arguments.length; _i++) {
80
+ args[_i] = arguments[_i];
81
+ }
82
+ return (0, exports.toThunk)(function () { return fn.apply(void 0, __spreadArray([], __read(args), false)); });
83
+ };
84
+ return Object.assign(function () {
85
+ var args = [];
86
+ for (var _i = 0; _i < arguments.length; _i++) {
87
+ args[_i] = arguments[_i];
88
+ }
89
+ var result = fn.apply(void 0, __spreadArray([], __read(args), false));
90
+ while ((0, exports.isThunk)(result) && typeof result === 'function') {
91
+ result = result();
92
+ }
93
+ return result;
94
+ }, { cont: cont });
95
+ };
96
+ exports.trampoline = trampoline;
97
+ var trampolineAsync = function (fn) {
98
+ var cont = function () {
99
+ var args = [];
100
+ for (var _i = 0; _i < arguments.length; _i++) {
101
+ args[_i] = arguments[_i];
102
+ }
103
+ return (0, exports.toThunk)(function () { return fn.apply(void 0, __spreadArray([], __read(args), false)); });
104
+ };
105
+ return Object.assign(function () {
106
+ var args = [];
107
+ for (var _i = 0; _i < arguments.length; _i++) {
108
+ args[_i] = arguments[_i];
109
+ }
110
+ return __awaiter(void 0, void 0, void 0, function () {
111
+ var result;
112
+ return __generator(this, function (_a) {
113
+ switch (_a.label) {
114
+ case 0: return [4 /*yield*/, fn.apply(void 0, __spreadArray([], __read(args), false))];
115
+ case 1:
116
+ result = _a.sent();
117
+ _a.label = 2;
118
+ case 2:
119
+ if (!((0, exports.isThunk)(result) && typeof result === 'function')) return [3 /*break*/, 4];
120
+ return [4 /*yield*/, result()];
121
+ case 3:
122
+ result = _a.sent();
123
+ return [3 /*break*/, 2];
124
+ case 4: return [2 /*return*/, result];
125
+ }
126
+ });
127
+ });
128
+ }, { cont: cont });
129
+ };
130
+ exports.trampolineAsync = trampolineAsync;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./utils"), exports);
@@ -26,8 +26,8 @@ export type DebounceOptions = {
26
26
  maxWait?: number;
27
27
  };
28
28
  export interface DebouncedFunction<F extends Procedure> {
29
- (this: ThisParameterType<F>, ...args: Parameters<F>): void;
30
29
  cancel: () => void;
30
+ (this: ThisParameterType<F>, ...args: [...Parameters<F>]): void;
31
31
  }
32
32
  export type MonthKey = 'January' | 'February' | 'March' | 'April' | 'May' | 'June' | 'July' | 'August' | 'September' | 'October' | 'November' | 'December';
33
33
  export type Month = {
@@ -44,3 +44,17 @@ export declare class TreeNode<T> {
44
44
  getHeight(): number;
45
45
  }
46
46
  export type OrderType = 'InOrder' | 'PreOrder' | 'PostOrder';
47
+ export type DeepProxy<T> = T extends (...args: any[]) => infer R ? (...args: [...Parameters<T>]) => DeepProxy<R> : T extends object ? {
48
+ [K in keyof T]: DeepProxy<T[K]>;
49
+ } : T;
50
+ export type DeepProxyOnChange = (target: any, property: string | symbol, value: any, receiver: any, descriptor: any, result: any) => void;
51
+ export type DeepProxyOnGet = (target: any, property: string | symbol, value: any, receiver: any, descriptor: any, result: any) => void;
52
+ export type CurryFunc<T> = T extends (...args: infer Args) => infer R ? Args extends [infer Arg, ...infer RestArgs] ? (arg: Arg) => CurryFunc<(...args: RestArgs) => R> : R : T;
53
+ export type ToThunkFn = () => ReturnType<TrlFn>;
54
+ declare const THUNK_SYMBOL: unique symbol;
55
+ export type Thunk = () => ReturnType<ToThunkFn> & {
56
+ __THUNK__: typeof THUNK_SYMBOL;
57
+ };
58
+ export type TrlFn = (...args: any[]) => any;
59
+ export type TrlAsyncFn = (...args: any[]) => any;
60
+ export {};
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TreeNode = void 0;
4
- const arr = ['1', 2, 4, 5, 6];
5
- const a = 2;
6
- class TreeNode {
7
- constructor(id, name, value, children) {
4
+ var arr = ['1', 2, 4, 5, 6];
5
+ var a = 2;
6
+ var TreeNode = /** @class */ (function () {
7
+ function TreeNode(id, name, value, children) {
8
8
  this.id = id;
9
9
  this.name = name || '';
10
10
  this.value = value || undefined;
@@ -18,36 +18,38 @@ class TreeNode {
18
18
  // set name (name: string | undefined) {
19
19
  // this.name = name;
20
20
  // }
21
- addChildren(children) {
21
+ TreeNode.prototype.addChildren = function (children) {
22
22
  if (!this.children) {
23
23
  this.children = [];
24
24
  }
25
- if (children instanceof Array) {
26
- this.children = this.children.concat(children);
25
+ if (children instanceof TreeNode) {
26
+ this.children.push(children);
27
27
  }
28
28
  else {
29
- this.children.push(children);
29
+ this.children = this.children.concat(children);
30
30
  }
31
- }
32
- getHeight() {
31
+ };
32
+ TreeNode.prototype.getHeight = function () {
33
33
  // eslint-disable-next-line @typescript-eslint/no-this-alias
34
- const beginRoot = this;
35
- let maxDepth = 1;
34
+ var beginRoot = this;
35
+ var maxDepth = 1;
36
36
  if (beginRoot) {
37
- const bfs = (node, level) => {
37
+ var bfs_1 = function (node, level) {
38
38
  if (level > maxDepth) {
39
39
  maxDepth = level;
40
40
  }
41
- const { children } = node;
41
+ var children = node.children;
42
42
  if (children) {
43
- for (let i = 0, len = children.length; i < len; i++) {
44
- bfs(children[i], level + 1);
43
+ for (var i = 0, len = children.length; i < len; i++) {
44
+ bfs_1(children[i], level + 1);
45
45
  }
46
46
  }
47
47
  };
48
- bfs(beginRoot, 1);
48
+ bfs_1(beginRoot, 1);
49
49
  }
50
50
  return maxDepth;
51
- }
52
- }
51
+ };
52
+ return TreeNode;
53
+ }());
53
54
  exports.TreeNode = TreeNode;
55
+ var THUNK_SYMBOL = Symbol('thunk');
@@ -21,12 +21,14 @@ export declare const looseEqual: (a: any, b: any) => boolean;
21
21
  export declare const strictEqual: (a: any, b: any) => boolean;
22
22
  export declare const strictObjectIsEqual: (a: any, b: any) => boolean;
23
23
  export declare const deepObjectStrictEqual: (object1: JSONSerializable, object2: JSONSerializable) => boolean;
24
- export declare const isTypeEqual: <T>(obj: unknown) => void;
25
24
  export declare function reverseColor(oldColor: string): string;
26
25
  export declare const isSameStructure: (objA: unknown, objB: unknown) => boolean;
27
26
  export declare const isLeafParent: (obj: JSONObject) => boolean;
28
27
  export declare const addDays: (date: Date, days: number) => Date;
29
28
  export declare class WaitManager {
29
+ private _time30;
30
+ private readonly _nXSpeed;
31
+ constructor(nXSpeed?: number);
30
32
  private _time1;
31
33
  get time1(): number;
32
34
  private _time2;
@@ -39,32 +41,14 @@ export declare class WaitManager {
39
41
  get time10(): number;
40
42
  private _time20;
41
43
  get time20(): number;
42
- private _time30;
43
44
  get time50(): number;
44
45
  private _time60;
45
46
  get time60(): number;
46
47
  private _cusTime;
47
48
  get cusTime(): number;
48
49
  set cusTime(v: number);
49
- private readonly _nXSpeed;
50
- constructor(nXSpeed?: number);
51
50
  }
52
51
  export declare const wait: (ms: number, resolveValue?: any) => Promise<unknown>;
53
- export declare class AuthAPIError extends Error {
54
- protected serverErrorStack: string | undefined;
55
- protected serverErrorCode: string | undefined;
56
- constructor(serverErrorMessage: string, serverErrorCode?: string, serverErrorStack?: string);
57
- }
58
- export declare class BunnyAPIError extends Error {
59
- protected serverErrorStack: string | undefined;
60
- protected serverErrorCode: string | undefined;
61
- constructor(serverErrorMessage: string, serverErrorCode?: string, serverErrorStack?: string);
62
- }
63
- export declare class NomicsAPIError extends Error {
64
- protected serverErrorStack: string | undefined;
65
- protected serverErrorCode: string | undefined;
66
- constructor(serverErrorMessage: string, serverErrorCode?: string, serverErrorStack?: string);
67
- }
68
52
  export declare function extractValue<Item>(data: {
69
53
  key: string;
70
54
  value: Item;
@@ -92,8 +76,8 @@ export declare class StringUtil {
92
76
  static toPathCase(str: string): string;
93
77
  static toDotCase(str: string): string;
94
78
  }
95
- type ToCase = 'camel' | 'snake' | 'pascal' | 'constant' | 'kebab' | 'lower' | 'title' | 'sentence' | 'path' | 'dot';
96
- export declare const deepKeysConvert: (obj: any, toType?: ToCase) => any;
79
+ export type CaseType = 'camel' | 'snake' | 'pascal' | 'constant' | 'kebab' | 'lower' | 'title' | 'sentence' | 'path' | 'dot';
80
+ export declare const deepKeysConvert: (obj: any, toType?: CaseType) => any;
97
81
  export declare const deepRemoveByKey: (obj: any, keysToBeRemoved: string[]) => any;
98
82
  export declare const deepRenameKeys: (obj: JSONSerializable, keysMap: {
99
83
  [x: string]: string;
@@ -119,4 +103,3 @@ export declare function zip<T = number, T1 = number>(array1: T[], array2: T1[],
119
103
  x: T;
120
104
  y: T1;
121
105
  }[];
122
- export {};