data-structure-typed 1.15.1 → 1.16.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.
Files changed (224) hide show
  1. package/README.md +398 -27
  2. package/dist/data-structures/binary-tree/binary-tree.d.ts +30 -30
  3. package/dist/data-structures/binary-tree/binary-tree.js +55 -55
  4. package/dist/data-structures/binary-tree/segment-tree.d.ts +17 -17
  5. package/dist/data-structures/binary-tree/segment-tree.js +30 -30
  6. package/dist/data-structures/graph/abstract-graph.d.ts +6 -6
  7. package/dist/data-structures/graph/abstract-graph.js +6 -6
  8. package/dist/data-structures/graph/directed-graph.d.ts +4 -4
  9. package/dist/data-structures/graph/directed-graph.js +6 -6
  10. package/dist/data-structures/graph/undirected-graph.d.ts +3 -3
  11. package/dist/data-structures/hash/coordinate-map.d.ts +2 -2
  12. package/dist/data-structures/hash/coordinate-set.d.ts +2 -2
  13. package/dist/data-structures/heap/heap.d.ts +40 -25
  14. package/dist/data-structures/heap/heap.js +72 -27
  15. package/dist/data-structures/heap/max-heap.d.ts +3 -3
  16. package/dist/data-structures/heap/min-heap.d.ts +3 -3
  17. package/dist/data-structures/index.d.ts +1 -0
  18. package/dist/data-structures/index.js +1 -0
  19. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +9 -9
  20. package/dist/data-structures/linked-list/doubly-linked-list.js +12 -12
  21. package/dist/data-structures/linked-list/singly-linked-list.d.ts +7 -7
  22. package/dist/data-structures/priority-queue/max-priority-queue.d.ts +4 -5
  23. package/dist/data-structures/priority-queue/max-priority-queue.js +30 -6
  24. package/dist/data-structures/priority-queue/min-priority-queue.d.ts +4 -5
  25. package/dist/data-structures/priority-queue/min-priority-queue.js +31 -6
  26. package/dist/data-structures/priority-queue/priority-queue.d.ts +20 -9
  27. package/dist/data-structures/priority-queue/priority-queue.js +34 -28
  28. package/dist/data-structures/queue/deque.d.ts +1 -1
  29. package/dist/data-structures/tree/index.d.ts +1 -0
  30. package/dist/data-structures/tree/index.js +17 -0
  31. package/dist/data-structures/tree/tree.d.ts +9 -0
  32. package/dist/data-structures/tree/tree.js +52 -0
  33. package/dist/data-structures/types/heap.d.ts +0 -4
  34. package/dist/utils/types/utils.d.ts +1 -3
  35. package/dist/utils/types/utils.js +0 -14
  36. package/dist/utils/utils.js +0 -197
  37. package/docs/.nojekyll +1 -0
  38. package/docs/assets/highlight.css +92 -0
  39. package/docs/assets/main.js +58 -0
  40. package/docs/assets/search.js +1 -0
  41. package/docs/assets/style.css +1367 -0
  42. package/docs/classes/AVLTree.html +2192 -0
  43. package/docs/classes/AVLTreeNode.html +574 -0
  44. package/docs/classes/AaTree.html +150 -0
  45. package/docs/classes/AbstractEdge.html +269 -0
  46. package/docs/classes/AbstractGraph.html +927 -0
  47. package/docs/classes/AbstractVertex.html +215 -0
  48. package/docs/classes/ArrayDeque.html +417 -0
  49. package/docs/classes/BST.html +2038 -0
  50. package/docs/classes/BSTNode.html +570 -0
  51. package/docs/classes/BTree.html +150 -0
  52. package/docs/classes/BinaryIndexedTree.html +289 -0
  53. package/docs/classes/BinaryTree.html +1827 -0
  54. package/docs/classes/BinaryTreeNode.html +533 -0
  55. package/docs/classes/Character.html +198 -0
  56. package/docs/classes/CoordinateMap.html +469 -0
  57. package/docs/classes/CoordinateSet.html +430 -0
  58. package/docs/classes/Deque.html +767 -0
  59. package/docs/classes/DirectedEdge.html +354 -0
  60. package/docs/classes/DirectedGraph.html +1243 -0
  61. package/docs/classes/DirectedVertex.html +226 -0
  62. package/docs/classes/DoublyLinkedList.html +733 -0
  63. package/docs/classes/DoublyLinkedListNode.html +258 -0
  64. package/docs/classes/Heap.html +482 -0
  65. package/docs/classes/HeapItem.html +233 -0
  66. package/docs/classes/Matrix2D.html +480 -0
  67. package/docs/classes/MatrixNTI2D.html +218 -0
  68. package/docs/classes/MaxHeap.html +500 -0
  69. package/docs/classes/MaxPriorityQueue.html +809 -0
  70. package/docs/classes/MinHeap.html +501 -0
  71. package/docs/classes/MinPriorityQueue.html +811 -0
  72. package/docs/classes/Navigator.html +291 -0
  73. package/docs/classes/ObjectDeque.html +423 -0
  74. package/docs/classes/PriorityQueue.html +733 -0
  75. package/docs/classes/Queue.html +370 -0
  76. package/docs/classes/RBTree.html +150 -0
  77. package/docs/classes/SegmentTree.html +345 -0
  78. package/docs/classes/SegmentTreeNode.html +418 -0
  79. package/docs/classes/SinglyLinkedList.html +1105 -0
  80. package/docs/classes/SinglyLinkedListNode.html +375 -0
  81. package/docs/classes/SplayTree.html +150 -0
  82. package/docs/classes/Stack.html +346 -0
  83. package/docs/classes/TreeMultiSet.html +2036 -0
  84. package/docs/classes/TreeNode.html +236 -0
  85. package/docs/classes/Trie.html +350 -0
  86. package/docs/classes/TrieNode.html +258 -0
  87. package/docs/classes/TwoThreeTree.html +150 -0
  88. package/docs/classes/UndirectedEdge.html +313 -0
  89. package/docs/classes/UndirectedGraph.html +1080 -0
  90. package/docs/classes/UndirectedVertex.html +226 -0
  91. package/docs/classes/Vector2D.html +783 -0
  92. package/docs/enums/CP.html +159 -0
  93. package/docs/enums/FamilyPosition.html +159 -0
  94. package/docs/enums/LoopType.html +160 -0
  95. package/docs/index.html +494 -0
  96. package/docs/interfaces/AVLTreeDeleted.html +161 -0
  97. package/docs/interfaces/BinaryTreeNodeObj.html +168 -0
  98. package/docs/interfaces/HeapOptions.html +167 -0
  99. package/docs/interfaces/IDirectedGraph.html +243 -0
  100. package/docs/interfaces/IGraph.html +427 -0
  101. package/docs/interfaces/NavigatorParams.html +197 -0
  102. package/docs/interfaces/PriorityQueueOptions.html +168 -0
  103. package/docs/modules.html +218 -0
  104. package/docs/types/BSTComparator.html +140 -0
  105. package/docs/types/BSTDeletedResult.html +137 -0
  106. package/docs/types/BinaryTreeDeleted.html +137 -0
  107. package/docs/types/BinaryTreeNodeId.html +125 -0
  108. package/docs/types/BinaryTreeNodePropertyName.html +125 -0
  109. package/docs/types/DFSOrderPattern.html +125 -0
  110. package/docs/types/DijkstraResult.html +145 -0
  111. package/docs/types/Direction.html +125 -0
  112. package/docs/types/DoublyLinkedListGetBy.html +125 -0
  113. package/docs/types/NodeOrPropertyName.html +125 -0
  114. package/docs/types/PriorityQueueComparator.html +145 -0
  115. package/docs/types/PriorityQueueDFSOrderPattern.html +125 -0
  116. package/docs/types/ResultByProperty.html +130 -0
  117. package/docs/types/ResultsByProperty.html +130 -0
  118. package/docs/types/SegmentTreeNodeVal.html +125 -0
  119. package/docs/types/SpecifyOptional.html +132 -0
  120. package/docs/types/Thunk.html +133 -0
  121. package/docs/types/ToThunkFn.html +133 -0
  122. package/docs/types/TopologicalStatus.html +125 -0
  123. package/docs/types/TreeMultiSetDeletedResult.html +137 -0
  124. package/docs/types/TrlAsyncFn.html +138 -0
  125. package/docs/types/TrlFn.html +138 -0
  126. package/docs/types/Turning.html +125 -0
  127. package/docs/types/VertexId.html +125 -0
  128. package/{tests/unit/data-structures/binary-tree → notes}/bst.test.ts +11 -15
  129. package/notes/note.md +23 -0
  130. package/package.json +2 -4
  131. package/.idea/data-structure-typed.iml +0 -14
  132. package/.idea/modules.xml +0 -8
  133. package/.idea/vcs.xml +0 -6
  134. package/src/assets/complexities-diff.jpg +0 -0
  135. package/src/assets/data-structure-complexities.jpg +0 -0
  136. package/src/assets/logo.png +0 -0
  137. package/src/data-structures/binary-tree/aa-tree.ts +0 -3
  138. package/src/data-structures/binary-tree/avl-tree.ts +0 -293
  139. package/src/data-structures/binary-tree/b-tree.ts +0 -3
  140. package/src/data-structures/binary-tree/binary-indexed-tree.ts +0 -69
  141. package/src/data-structures/binary-tree/binary-tree.ts +0 -1485
  142. package/src/data-structures/binary-tree/bst.ts +0 -497
  143. package/src/data-structures/binary-tree/diagrams/avl-tree-inserting.gif +0 -0
  144. package/src/data-structures/binary-tree/diagrams/bst-rotation.gif +0 -0
  145. package/src/data-structures/binary-tree/diagrams/segment-tree.png +0 -0
  146. package/src/data-structures/binary-tree/index.ts +0 -11
  147. package/src/data-structures/binary-tree/rb-tree.ts +0 -3
  148. package/src/data-structures/binary-tree/segment-tree.ts +0 -248
  149. package/src/data-structures/binary-tree/splay-tree.ts +0 -3
  150. package/src/data-structures/binary-tree/tree-multiset.ts +0 -53
  151. package/src/data-structures/binary-tree/two-three-tree.ts +0 -3
  152. package/src/data-structures/diagrams/README.md +0 -5
  153. package/src/data-structures/graph/abstract-graph.ts +0 -956
  154. package/src/data-structures/graph/diagrams/adjacency-list-pros-cons.jpg +0 -0
  155. package/src/data-structures/graph/diagrams/adjacency-list.jpg +0 -0
  156. package/src/data-structures/graph/diagrams/adjacency-matrix-pros-cons.jpg +0 -0
  157. package/src/data-structures/graph/diagrams/adjacency-matrix.jpg +0 -0
  158. package/src/data-structures/graph/diagrams/dfs-can-do.jpg +0 -0
  159. package/src/data-structures/graph/diagrams/edge-list-pros-cons.jpg +0 -0
  160. package/src/data-structures/graph/diagrams/edge-list.jpg +0 -0
  161. package/src/data-structures/graph/diagrams/max-flow.jpg +0 -0
  162. package/src/data-structures/graph/diagrams/mst.jpg +0 -0
  163. package/src/data-structures/graph/diagrams/tarjan-articulation-point-bridge.png +0 -0
  164. package/src/data-structures/graph/diagrams/tarjan-complicate-simple.png +0 -0
  165. package/src/data-structures/graph/diagrams/tarjan-strongly-connected-component.png +0 -0
  166. package/src/data-structures/graph/diagrams/tarjan.mp4 +0 -0
  167. package/src/data-structures/graph/diagrams/tarjan.webp +0 -0
  168. package/src/data-structures/graph/directed-graph.ts +0 -424
  169. package/src/data-structures/graph/index.ts +0 -3
  170. package/src/data-structures/graph/undirected-graph.ts +0 -254
  171. package/src/data-structures/hash/coordinate-map.ts +0 -71
  172. package/src/data-structures/hash/coordinate-set.ts +0 -60
  173. package/src/data-structures/hash/hash-table.ts +0 -1
  174. package/src/data-structures/hash/index.ts +0 -6
  175. package/src/data-structures/hash/pair.ts +0 -1
  176. package/src/data-structures/hash/tree-map.ts +0 -1
  177. package/src/data-structures/hash/tree-set.ts +0 -1
  178. package/src/data-structures/heap/heap.ts +0 -156
  179. package/src/data-structures/heap/index.ts +0 -3
  180. package/src/data-structures/heap/max-heap.ts +0 -31
  181. package/src/data-structures/heap/min-heap.ts +0 -34
  182. package/src/data-structures/index.ts +0 -13
  183. package/src/data-structures/linked-list/doubly-linked-list.ts +0 -351
  184. package/src/data-structures/linked-list/index.ts +0 -2
  185. package/src/data-structures/linked-list/singly-linked-list.ts +0 -748
  186. package/src/data-structures/linked-list/skip-linked-list.ts +0 -1
  187. package/src/data-structures/matrix/index.ts +0 -4
  188. package/src/data-structures/matrix/matrix.ts +0 -27
  189. package/src/data-structures/matrix/matrix2d.ts +0 -208
  190. package/src/data-structures/matrix/navigator.ts +0 -122
  191. package/src/data-structures/matrix/vector2d.ts +0 -316
  192. package/src/data-structures/priority-queue/index.ts +0 -3
  193. package/src/data-structures/priority-queue/max-priority-queue.ts +0 -24
  194. package/src/data-structures/priority-queue/min-priority-queue.ts +0 -24
  195. package/src/data-structures/priority-queue/priority-queue.ts +0 -346
  196. package/src/data-structures/queue/deque.ts +0 -241
  197. package/src/data-structures/queue/index.ts +0 -2
  198. package/src/data-structures/queue/queue.ts +0 -120
  199. package/src/data-structures/stack/index.ts +0 -1
  200. package/src/data-structures/stack/stack.ts +0 -98
  201. package/src/data-structures/trie/index.ts +0 -1
  202. package/src/data-structures/trie/trie.ts +0 -225
  203. package/src/data-structures/types/abstract-graph.ts +0 -51
  204. package/src/data-structures/types/avl-tree.ts +0 -6
  205. package/src/data-structures/types/binary-tree.ts +0 -15
  206. package/src/data-structures/types/bst.ts +0 -5
  207. package/src/data-structures/types/directed-graph.ts +0 -18
  208. package/src/data-structures/types/doubly-linked-list.ts +0 -1
  209. package/src/data-structures/types/heap.ts +0 -8
  210. package/src/data-structures/types/index.ts +0 -13
  211. package/src/data-structures/types/navigator.ts +0 -13
  212. package/src/data-structures/types/priority-queue.ts +0 -9
  213. package/src/data-structures/types/segment-tree.ts +0 -1
  214. package/src/data-structures/types/singly-linked-list.ts +0 -1
  215. package/src/data-structures/types/tree-multiset.ts +0 -3
  216. package/src/index.ts +0 -1
  217. package/src/utils/index.ts +0 -2
  218. package/src/utils/types/index.ts +0 -1
  219. package/src/utils/types/utils.ts +0 -176
  220. package/src/utils/utils.ts +0 -290
  221. package/tests/unit/data-structures/graph/abstract-graph.ts +0 -0
  222. package/tests/unit/data-structures/graph/directed-graph.test.ts +0 -495
  223. package/tests/unit/data-structures/graph/index.ts +0 -3
  224. package/tests/unit/data-structures/graph/undirected-graph.ts +0 -0
@@ -51,9 +51,9 @@ var PriorityQueue = /** @class */ (function () {
51
51
  };
52
52
  var nodes = options.nodes, comparator = options.comparator, _a = options.isFix, isFix = _a === void 0 ? true : _a;
53
53
  this._comparator = comparator;
54
- if (nodes && nodes instanceof Array && nodes.length > 0) {
54
+ if (nodes && Array.isArray(nodes) && nodes.length > 0) {
55
55
  // TODO support distinct
56
- this._nodes = Array.isArray(nodes) ? __spreadArray([], __read(nodes), false) : [];
56
+ this._nodes = __spreadArray([], __read(nodes), false);
57
57
  isFix && this._fix();
58
58
  }
59
59
  }
@@ -67,12 +67,6 @@ var PriorityQueue = /** @class */ (function () {
67
67
  enumerable: false,
68
68
  configurable: true
69
69
  });
70
- /**
71
- * Starting from TypeScript version 5.0 and onwards, the use of distinct access modifiers for Getters and Setters is not permitted. As an alternative, to ensure compatibility, it is necessary to adopt a Java-style approach for Setters (using the same name as the property) while utilizing separate method names for Getters.
72
- */
73
- PriorityQueue.prototype.getNodes = function () {
74
- return this._nodes;
75
- };
76
70
  Object.defineProperty(PriorityQueue.prototype, "size", {
77
71
  get: function () {
78
72
  return this.nodes.length;
@@ -100,7 +94,13 @@ var PriorityQueue = /** @class */ (function () {
100
94
  * @returns the result of calling the `isValid()` method on a new instance of the `PriorityQueue` class.
101
95
  */
102
96
  PriorityQueue.isPriorityQueueified = function (options) {
103
- return new PriorityQueue(__assign(__assign({}, options), { isFix: true })).isValid();
97
+ return new PriorityQueue(__assign(__assign({}, options), { isFix: false })).isValid();
98
+ };
99
+ /**
100
+ * Starting from TypeScript version 5.0 and onwards, the use of distinct access modifiers for Getters and Setters is not permitted. As an alternative, to ensure compatibility, it is necessary to adopt a Java-style approach for Setters (using the same name as the property) while utilizing separate method names for Getters.
101
+ */
102
+ PriorityQueue.prototype.getNodes = function () {
103
+ return this._nodes;
104
104
  };
105
105
  /**
106
106
  * The "add" function adds a node to the heap and ensures that the heap property is maintained.
@@ -111,6 +111,15 @@ var PriorityQueue = /** @class */ (function () {
111
111
  this.nodes.push(node);
112
112
  this._heapifyUp(this.size - 1);
113
113
  };
114
+ /**
115
+ * The "has" function checks if a given node is present in the list of nodes.
116
+ * @param {T} node - The parameter `node` is of type `T`, which means it can be any type. It represents the node that
117
+ * we want to check if it exists in the `nodes` array.
118
+ * @returns a boolean value indicating whether the given node is included in the array of nodes.
119
+ */
120
+ PriorityQueue.prototype.has = function (node) {
121
+ return this.nodes.includes(node);
122
+ };
114
123
  /**
115
124
  * The `peek` function returns the first element of the `nodes` array if it exists, otherwise it returns `null`.
116
125
  * @returns The `peek()` function is returning the first element (`T`) of the `nodes` array if the `size` is not zero.
@@ -182,31 +191,28 @@ var PriorityQueue = /** @class */ (function () {
182
191
  * @returns The function `isValid()` returns a boolean value.
183
192
  */
184
193
  PriorityQueue.prototype.isValid = function () {
185
- var _this = this;
186
- var isValidRecursive = function (parentIndex) {
187
- var isValidLeft = true;
188
- var isValidRight = true;
189
- if (_this._getLeft(parentIndex) !== -1) {
190
- var leftChildIndex = (parentIndex * 2) + 1;
191
- if (!_this._compare(parentIndex, leftChildIndex))
192
- return false;
193
- isValidLeft = isValidRecursive(leftChildIndex);
194
+ for (var i = 0; i < this.nodes.length; i++) {
195
+ var leftChildIndex = this._getLeft(i);
196
+ var rightChildIndex = this._getRight(i);
197
+ if (this._isValidIndex(leftChildIndex) && !this._compare(leftChildIndex, i)) {
198
+ return false;
194
199
  }
195
- if (_this._getRight(parentIndex) !== -1) {
196
- var rightChildIndex = (parentIndex * 2) + 2;
197
- if (!_this._compare(parentIndex, rightChildIndex))
198
- return false;
199
- isValidRight = isValidRecursive(rightChildIndex);
200
+ if (this._isValidIndex(rightChildIndex) && !this._compare(rightChildIndex, i)) {
201
+ return false;
200
202
  }
201
- return isValidLeft && isValidRight;
202
- };
203
- return isValidRecursive(0);
203
+ }
204
+ return true;
204
205
  };
205
206
  /**
206
- * The function sorts the elements in a data structure and returns them in ascending order.
207
- * @returns The `sort()` function is returning an array of type `T[]`.
207
+ * Plan to support sorting of duplicate elements.
208
+ */
209
+ /**
210
+ * The function sorts the elements in a data structure and returns them in an array.
211
+ * Plan to support sorting of duplicate elements.
212
+ * @returns The `sort()` method is returning an array of type `T[]`.
208
213
  */
209
214
  PriorityQueue.prototype.sort = function () {
215
+ // TODO Plan to support sorting of duplicate elements.
210
216
  var visitedNode = [];
211
217
  while (this.size !== 0) {
212
218
  var top = this.poll();
@@ -9,6 +9,7 @@ import { DoublyLinkedList } from '../linked-list';
9
9
  export declare class Deque<T> extends DoublyLinkedList<T> {
10
10
  }
11
11
  export declare class ObjectDeque<T> {
12
+ constructor(capacity?: number);
12
13
  private _nodes;
13
14
  get nodes(): {
14
15
  [p: number]: T;
@@ -28,7 +29,6 @@ export declare class ObjectDeque<T> {
28
29
  private _size;
29
30
  get size(): number;
30
31
  protected set size(value: number);
31
- constructor(capacity?: number);
32
32
  addFirst(value: T): void;
33
33
  addLast(value: T): void;
34
34
  pollFirst(): T | undefined;
@@ -0,0 +1 @@
1
+ export * from './tree';
@@ -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("./tree"), exports);
@@ -0,0 +1,9 @@
1
+ export declare class TreeNode<T = number> {
2
+ id: string;
3
+ name?: string | undefined;
4
+ value?: T | undefined;
5
+ children?: TreeNode<T>[] | undefined;
6
+ constructor(id: string, name?: string, value?: T, children?: TreeNode<T>[]);
7
+ addChildren(children: TreeNode<T> | TreeNode<T>[]): void;
8
+ getHeight(): number;
9
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TreeNode = void 0;
4
+ var TreeNode = /** @class */ (function () {
5
+ function TreeNode(id, name, value, children) {
6
+ this.id = id;
7
+ this.name = name || '';
8
+ this.value = value || undefined;
9
+ this.children = children || [];
10
+ }
11
+ // TODO get set
12
+ // get name (): string | undefined {
13
+ // return this.name;
14
+ // }
15
+ //
16
+ // set name (name: string | undefined) {
17
+ // this.name = name;
18
+ // }
19
+ TreeNode.prototype.addChildren = function (children) {
20
+ if (!this.children) {
21
+ this.children = [];
22
+ }
23
+ if (children instanceof TreeNode) {
24
+ this.children.push(children);
25
+ }
26
+ else {
27
+ this.children = this.children.concat(children);
28
+ }
29
+ };
30
+ TreeNode.prototype.getHeight = function () {
31
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
32
+ var beginRoot = this;
33
+ var maxDepth = 1;
34
+ if (beginRoot) {
35
+ var bfs_1 = function (node, level) {
36
+ if (level > maxDepth) {
37
+ maxDepth = level;
38
+ }
39
+ var children = node.children;
40
+ if (children) {
41
+ for (var i = 0, len = children.length; i < len; i++) {
42
+ bfs_1(children[i], level + 1);
43
+ }
44
+ }
45
+ };
46
+ bfs_1(beginRoot, 1);
47
+ }
48
+ return maxDepth;
49
+ };
50
+ return TreeNode;
51
+ }());
52
+ exports.TreeNode = TreeNode;
@@ -1,7 +1,3 @@
1
1
  export interface HeapOptions<T> {
2
2
  priority?: (element: T) => number;
3
3
  }
4
- export interface HeapItem<T> {
5
- priority: number;
6
- element: T | null;
7
- }
@@ -1,9 +1,7 @@
1
- /**
2
- * A function that emits a side effect and does not return anything.
3
- */
4
1
  export type ToThunkFn = () => ReturnType<TrlFn>;
5
2
  export type Thunk = () => ReturnType<ToThunkFn> & {
6
3
  __THUNK__: Symbol;
7
4
  };
8
5
  export type TrlFn = (...args: any[]) => any;
9
6
  export type TrlAsyncFn = (...args: any[]) => any;
7
+ export type SpecifyOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
@@ -1,16 +1,2 @@
1
1
  "use strict";
2
- // export type JSONSerializable = {
3
- // [key: string]: any
4
- // }
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- // export type CaseType =
7
- // 'camel'
8
- // | 'snake'
9
- // | 'pascal'
10
- // | 'constant'
11
- // | 'kebab'
12
- // | 'lower'
13
- // | 'title'
14
- // | 'sentence'
15
- // | 'path'
16
- // | 'dot';
@@ -1,6 +1,4 @@
1
1
  "use strict";
2
- // import _ from 'lodash';
3
- // import type {AnyFunction, CaseType, JSONObject, JSONSerializable} from './types';
4
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -71,201 +69,6 @@ var uuidV4 = function () {
71
69
  });
72
70
  };
73
71
  exports.uuidV4 = uuidV4;
74
- // export const isObject = (object: string | JSONObject | boolean | AnyFunction | number) => object != null && typeof object === 'object';
75
- // export const deepObjectStrictEqual = (object1: JSONSerializable, object2: JSONSerializable) => {
76
- // const keys1 = Object.keys(object1);
77
- // const keys2 = Object.keys(object2);
78
- // if (keys1.length !== keys2.length) {
79
- // return false;
80
- // }
81
- // for (const key of keys1) {
82
- // const val1 = object1[key];
83
- // const val2 = object2[key];
84
- // const areObjects = isObject(val1) && isObject(val2);
85
- // if (
86
- // areObjects && !deepObjectStrictEqual(val1, val2) ||
87
- // !areObjects && val1 !== val2
88
- // ) {
89
- // return false;
90
- // }
91
- // }
92
- // return true;
93
- // };
94
- // export class StringUtil {
95
- // // camelCase
96
- // static toCamelCase(str: string) {
97
- // return _.camelCase(str);
98
- // }
99
- //
100
- // // snake_case
101
- // static toSnakeCase(str: string) {
102
- // return _.snakeCase(str);
103
- // }
104
- //
105
- // // PascalCase
106
- // static toPascalCase(str: string) {
107
- // return _.startCase(_.camelCase(str)).replace(/ /g, '');
108
- // }
109
- //
110
- // // CONSTANT_CASE
111
- // static toConstantCase(str: string) {
112
- // return _.upperCase(str).replace(/ /g, '_');
113
- // }
114
- //
115
- // // kebab-case
116
- // static toKebabCase(str: string) {
117
- // return _.kebabCase(str);
118
- // }
119
- //
120
- // // lowercase
121
- // static toLowerCase(str: string) {
122
- // return _.lowerCase(str).replace(/ /g, '');
123
- // }
124
- //
125
- // // Title Case
126
- // static toTitleCase(str: string) {
127
- // return _.startCase(_.camelCase(str));
128
- // }
129
- //
130
- // // Sentence case
131
- // static toSentenceCase(str: string) {
132
- // return _.upperFirst(_.lowerCase(str));
133
- // }
134
- //
135
- // // path/case
136
- // static toPathCase(str: string) {
137
- // return _.lowerCase(str).replace(/ /g, '/');
138
- // }
139
- //
140
- // // dot.case
141
- // static toDotCase(str: string) {
142
- // return _.lowerCase(str).replace(/ /g, '.');
143
- // }
144
- // }
145
- // export const deepKeysConvert = (obj: any, toType?: CaseType): any => {
146
- // const _toType = toType || 'snake';
147
- // if (Array.isArray(obj)) {
148
- // return obj.map(v => deepKeysConvert(v, _toType));
149
- // } else if (obj !== null && obj.constructor === Object) {
150
- // return Object.keys(obj).reduce(
151
- // (result, key) => {
152
- // let newKey = '';
153
- // switch (_toType) {
154
- // case 'camel':
155
- // newKey = StringUtil.toCamelCase(key);
156
- // break;
157
- // case 'snake':
158
- // newKey = StringUtil.toSnakeCase(key);
159
- // break;
160
- // case 'pascal':
161
- // newKey = StringUtil.toPascalCase(key);
162
- // break;
163
- // case 'constant':
164
- // newKey = StringUtil.toConstantCase(key);
165
- // break;
166
- // case 'kebab':
167
- // newKey = StringUtil.toKebabCase(key);
168
- // break;
169
- // case 'lower':
170
- // newKey = StringUtil.toLowerCase(key);
171
- // break;
172
- // case 'title':
173
- // newKey = StringUtil.toTitleCase(key);
174
- // break;
175
- // case 'sentence':
176
- // newKey = StringUtil.toSentenceCase(key);
177
- // break;
178
- // case 'path':
179
- // newKey = StringUtil.toPathCase(key);
180
- // break;
181
- // case 'dot':
182
- // newKey = StringUtil.toDotCase(key);
183
- // break;
184
- // default:
185
- // newKey = StringUtil.toDotCase(key);
186
- // break;
187
- // }
188
- // return {
189
- // ...result,
190
- // [newKey]: deepKeysConvert(obj[key], _toType),
191
- // };
192
- // },
193
- // {},
194
- // );
195
- // }
196
- // return obj;
197
- // };
198
- // export const deepRemoveByKey = (obj: any, keysToBeRemoved: string[]) => {
199
- // const result = _.transform(obj, function (result: JSONSerializable, value: any, key: string) {
200
- // if (_.isObject(value)) {
201
- // value = deepRemoveByKey(value, keysToBeRemoved);
202
- // }
203
- // if (!keysToBeRemoved.includes(key)) {
204
- // _.isArray(obj) ? result.push(value) : result[key] = value;
205
- // }
206
- // });
207
- // return result as typeof obj;
208
- // };
209
- // export const deepRenameKeys = (obj: JSONSerializable, keysMap: { [key in string]: string }) => {
210
- // return _.transform(obj, function (result: JSONSerializable, value: any, key: string | number) {
211
- // const currentKey = keysMap[key] || key;
212
- // result[currentKey] = _.isObject(value) ? deepRenameKeys(value, keysMap) : value;
213
- // });
214
- // };
215
- // export const deepReplaceValues = (obj: JSONSerializable, keyReducerMap: { [key in string]: (item: JSONSerializable) => any }) => {
216
- // const newObject = _.clone(obj) as JSONSerializable;
217
- // _.each(obj, (val: any, key: string) => {
218
- // for (const item in keyReducerMap) {
219
- // if (key === item) {
220
- // newObject[key] = keyReducerMap[item](newObject);
221
- // } else if (typeof (val) === 'object' || val instanceof Array) {
222
- // newObject[key] = deepReplaceValues(val, keyReducerMap);
223
- // }
224
- // }
225
- // });
226
- // return newObject;
227
- // };
228
- // TODO determine depth and pass root node as a param through callback
229
- // export const deepAdd = (obj: JSONSerializable, keyReducerMap: { [key in string]: (item: JSONSerializable) => any }, isItemRootParent?: boolean) => {
230
- // const newObject = _.clone(obj) as JSONObject | [];
231
- // if (_.isObject(newObject) && !_.isArray(newObject)) {
232
- // for (const item in keyReducerMap) {
233
- // newObject[item] = keyReducerMap[item](newObject);
234
- // }
235
- // }
236
- // _.each(obj, (val: any, key: string | number) => {
237
- // if (_.isObject(val)) {
238
- // for (const item in keyReducerMap) {
239
- // // @ts-ignore
240
- // newObject[key] = deepAdd(val, keyReducerMap, isItemRootParent);
241
- // }
242
- // }
243
- // });
244
- // return newObject;
245
- // };
246
- // const styleString = (color: string) => `color: ${color}; font-weight: bold`;
247
- // const styleHeader = (header: string) => `%c[${header}]`;
248
- // export const bunnyConsole = {
249
- // log: (headerLog = 'bunny', ...args: any[]) => {
250
- // return console.log(styleHeader(headerLog), styleString('black'), ...args);
251
- // },
252
- // warn: (headerLog = 'bunny', ...args: any[]) => {
253
- // return console.warn(styleHeader(headerLog), styleString('orange'), ...args);
254
- // },
255
- // error: (headerLog = 'bunny', ...args: any[]) => {
256
- // return console.error(styleHeader(headerLog), styleString('red'), ...args);
257
- // }
258
- // };
259
- // export const timeStart = () => {
260
- // return performance ? performance.now() : new Date().getTime();
261
- // };
262
- // export const timeEnd = (startTime: number, headerLog?: string, consoleConditionFn?: (timeSpent: number) => boolean) => {
263
- // const timeSpent = (performance ? performance.now() : new Date().getTime()) - startTime;
264
- // const isPassCondition = consoleConditionFn ? consoleConditionFn(timeSpent) : true;
265
- // if (isPassCondition) {
266
- // bunnyConsole.log(headerLog ? headerLog : 'time spent', timeSpent.toFixed(2));
267
- // }
268
- // };
269
72
  var arrayRemove = function (array, predicate) {
270
73
  var i = -1, len = array ? array.length : 0;
271
74
  var result = [];
package/docs/.nojekyll ADDED
@@ -0,0 +1 @@
1
+ TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
@@ -0,0 +1,92 @@
1
+ :root {
2
+ --light-hl-0: #795E26;
3
+ --dark-hl-0: #DCDCAA;
4
+ --light-hl-1: #000000;
5
+ --dark-hl-1: #D4D4D4;
6
+ --light-hl-2: #A31515;
7
+ --dark-hl-2: #CE9178;
8
+ --light-hl-3: #AF00DB;
9
+ --dark-hl-3: #C586C0;
10
+ --light-hl-4: #001080;
11
+ --dark-hl-4: #9CDCFE;
12
+ --light-hl-5: #0000FF;
13
+ --dark-hl-5: #569CD6;
14
+ --light-hl-6: #0070C1;
15
+ --dark-hl-6: #4FC1FF;
16
+ --light-hl-7: #098658;
17
+ --dark-hl-7: #B5CEA8;
18
+ --light-hl-8: #267F99;
19
+ --dark-hl-8: #4EC9B0;
20
+ --light-hl-9: #008000;
21
+ --dark-hl-9: #6A9955;
22
+ --light-code-background: #FFFFFF;
23
+ --dark-code-background: #1E1E1E;
24
+ }
25
+
26
+ @media (prefers-color-scheme: light) { :root {
27
+ --hl-0: var(--light-hl-0);
28
+ --hl-1: var(--light-hl-1);
29
+ --hl-2: var(--light-hl-2);
30
+ --hl-3: var(--light-hl-3);
31
+ --hl-4: var(--light-hl-4);
32
+ --hl-5: var(--light-hl-5);
33
+ --hl-6: var(--light-hl-6);
34
+ --hl-7: var(--light-hl-7);
35
+ --hl-8: var(--light-hl-8);
36
+ --hl-9: var(--light-hl-9);
37
+ --code-background: var(--light-code-background);
38
+ } }
39
+
40
+ @media (prefers-color-scheme: dark) { :root {
41
+ --hl-0: var(--dark-hl-0);
42
+ --hl-1: var(--dark-hl-1);
43
+ --hl-2: var(--dark-hl-2);
44
+ --hl-3: var(--dark-hl-3);
45
+ --hl-4: var(--dark-hl-4);
46
+ --hl-5: var(--dark-hl-5);
47
+ --hl-6: var(--dark-hl-6);
48
+ --hl-7: var(--dark-hl-7);
49
+ --hl-8: var(--dark-hl-8);
50
+ --hl-9: var(--dark-hl-9);
51
+ --code-background: var(--dark-code-background);
52
+ } }
53
+
54
+ :root[data-theme='light'] {
55
+ --hl-0: var(--light-hl-0);
56
+ --hl-1: var(--light-hl-1);
57
+ --hl-2: var(--light-hl-2);
58
+ --hl-3: var(--light-hl-3);
59
+ --hl-4: var(--light-hl-4);
60
+ --hl-5: var(--light-hl-5);
61
+ --hl-6: var(--light-hl-6);
62
+ --hl-7: var(--light-hl-7);
63
+ --hl-8: var(--light-hl-8);
64
+ --hl-9: var(--light-hl-9);
65
+ --code-background: var(--light-code-background);
66
+ }
67
+
68
+ :root[data-theme='dark'] {
69
+ --hl-0: var(--dark-hl-0);
70
+ --hl-1: var(--dark-hl-1);
71
+ --hl-2: var(--dark-hl-2);
72
+ --hl-3: var(--dark-hl-3);
73
+ --hl-4: var(--dark-hl-4);
74
+ --hl-5: var(--dark-hl-5);
75
+ --hl-6: var(--dark-hl-6);
76
+ --hl-7: var(--dark-hl-7);
77
+ --hl-8: var(--dark-hl-8);
78
+ --hl-9: var(--dark-hl-9);
79
+ --code-background: var(--dark-code-background);
80
+ }
81
+
82
+ .hl-0 { color: var(--hl-0); }
83
+ .hl-1 { color: var(--hl-1); }
84
+ .hl-2 { color: var(--hl-2); }
85
+ .hl-3 { color: var(--hl-3); }
86
+ .hl-4 { color: var(--hl-4); }
87
+ .hl-5 { color: var(--hl-5); }
88
+ .hl-6 { color: var(--hl-6); }
89
+ .hl-7 { color: var(--hl-7); }
90
+ .hl-8 { color: var(--hl-8); }
91
+ .hl-9 { color: var(--hl-9); }
92
+ pre, code { background: var(--code-background); }