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.
- package/.dependency-cruiser.js +449 -0
- package/.idea/data-structure-typed.iml +2 -0
- package/.idea/modules.xml +1 -1
- package/README.md +298 -2
- package/dist/data-structures/binary-tree/aa-tree.js +5 -2
- package/dist/data-structures/binary-tree/avl-tree.d.ts +58 -5
- package/dist/data-structures/binary-tree/avl-tree.js +150 -46
- package/dist/data-structures/binary-tree/b-tree.js +5 -2
- package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +28 -1
- package/dist/data-structures/binary-tree/binary-indexed-tree.js +41 -13
- package/dist/data-structures/binary-tree/binary-tree.d.ts +230 -36
- package/dist/data-structures/binary-tree/binary-tree.js +747 -369
- package/dist/data-structures/binary-tree/bst.d.ts +20 -8
- package/dist/data-structures/binary-tree/bst.js +164 -107
- package/dist/data-structures/binary-tree/rb-tree.js +5 -2
- package/dist/data-structures/binary-tree/segment-tree.d.ts +7 -3
- package/dist/data-structures/binary-tree/segment-tree.js +95 -61
- package/dist/data-structures/binary-tree/splay-tree.js +5 -2
- package/dist/data-structures/binary-tree/tree-multiset.d.ts +5 -5
- package/dist/data-structures/binary-tree/tree-multiset.js +35 -11
- package/dist/data-structures/binary-tree/two-three-tree.js +5 -2
- package/dist/data-structures/graph/abstract-graph.d.ts +168 -46
- package/dist/data-structures/graph/abstract-graph.js +712 -323
- package/dist/data-structures/graph/directed-graph.d.ts +114 -12
- package/dist/data-structures/graph/directed-graph.js +372 -128
- package/dist/data-structures/graph/undirected-graph.d.ts +67 -3
- package/dist/data-structures/graph/undirected-graph.js +233 -81
- package/dist/data-structures/hash/coordinate-map.d.ts +33 -1
- package/dist/data-structures/hash/coordinate-map.js +70 -20
- package/dist/data-structures/hash/coordinate-set.d.ts +25 -0
- package/dist/data-structures/hash/coordinate-set.js +58 -15
- package/dist/data-structures/hash/index.d.ts +5 -0
- package/dist/data-structures/hash/index.js +5 -0
- package/dist/data-structures/heap/heap.d.ts +26 -37
- package/dist/data-structures/heap/heap.js +56 -60
- package/dist/data-structures/heap/max-heap.d.ts +8 -2
- package/dist/data-structures/heap/max-heap.js +32 -9
- package/dist/data-structures/heap/min-heap.d.ts +9 -2
- package/dist/data-structures/heap/min-heap.js +33 -9
- package/dist/data-structures/linked-list/doubly-linked-list.d.ts +14 -7
- package/dist/data-structures/linked-list/doubly-linked-list.js +101 -61
- package/dist/data-structures/linked-list/singly-linked-list.d.ts +18 -19
- package/dist/data-structures/linked-list/singly-linked-list.js +312 -174
- package/dist/data-structures/matrix/matrix.d.ts +9 -0
- package/dist/data-structures/matrix/matrix.js +19 -7
- package/dist/data-structures/matrix/matrix2d.d.ts +84 -4
- package/dist/data-structures/matrix/matrix2d.js +158 -61
- package/dist/data-structures/matrix/navigator.d.ts +34 -16
- package/dist/data-structures/matrix/navigator.js +65 -18
- package/dist/data-structures/matrix/vector2d.d.ts +153 -29
- package/dist/data-structures/matrix/vector2d.js +249 -102
- package/dist/data-structures/priority-queue/max-priority-queue.d.ts +11 -2
- package/dist/data-structures/priority-queue/max-priority-queue.js +33 -8
- package/dist/data-structures/priority-queue/min-priority-queue.d.ts +11 -2
- package/dist/data-structures/priority-queue/min-priority-queue.js +33 -8
- package/dist/data-structures/priority-queue/priority-queue.d.ts +145 -21
- package/dist/data-structures/priority-queue/priority-queue.js +285 -116
- package/dist/data-structures/queue/deque.d.ts +69 -0
- package/dist/data-structures/queue/deque.js +151 -56
- package/dist/data-structures/queue/queue.d.ts +34 -37
- package/dist/data-structures/queue/queue.js +59 -61
- package/dist/data-structures/stack/stack.d.ts +29 -35
- package/dist/data-structures/stack/stack.js +51 -56
- package/dist/data-structures/trie/trie.d.ts +36 -6
- package/dist/data-structures/trie/trie.js +256 -83
- package/dist/data-structures/types/abstract-graph.d.ts +29 -0
- package/dist/data-structures/types/abstract-graph.js +2 -0
- package/dist/data-structures/types/avl-tree.d.ts +5 -0
- package/dist/data-structures/types/avl-tree.js +2 -0
- package/dist/data-structures/types/binary-tree.d.ts +16 -0
- package/dist/data-structures/types/binary-tree.js +2 -0
- package/dist/data-structures/types/bst.d.ts +7 -0
- package/dist/data-structures/types/bst.js +2 -0
- package/dist/data-structures/types/directed-graph.d.ts +10 -0
- package/dist/data-structures/types/directed-graph.js +2 -0
- package/dist/data-structures/types/doubly-linked-list.d.ts +1 -0
- package/dist/data-structures/types/doubly-linked-list.js +2 -0
- package/dist/data-structures/types/heap.d.ts +7 -0
- package/dist/data-structures/types/heap.js +2 -0
- package/dist/data-structures/types/index.d.ts +13 -0
- package/dist/data-structures/types/index.js +29 -0
- package/dist/data-structures/types/navigator.d.ts +14 -0
- package/dist/data-structures/types/navigator.js +2 -0
- package/dist/data-structures/types/priority-queue.d.ts +7 -0
- package/dist/data-structures/types/priority-queue.js +2 -0
- package/dist/data-structures/types/segment-tree.d.ts +1 -0
- package/dist/data-structures/types/segment-tree.js +2 -0
- package/dist/data-structures/types/singly-linked-list.js +2 -0
- package/dist/data-structures/types/tree-multiset.d.ts +5 -0
- package/dist/data-structures/types/tree-multiset.js +2 -0
- package/dist/utils/trampoline.d.ts +14 -0
- package/dist/utils/trampoline.js +130 -0
- package/dist/utils/types/index.js +17 -0
- package/dist/{types → utils}/types/utils.d.ts +15 -1
- package/dist/{types → utils/types}/utils.js +21 -19
- package/dist/{utils.d.ts → utils/utils.d.ts} +5 -22
- package/dist/utils/utils.js +651 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +85 -0
- package/docs/assets/main.js +58 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1367 -0
- package/docs/classes/AVLTree.html +2046 -0
- package/docs/classes/AVLTreeNode.html +423 -0
- package/docs/classes/AaTree.html +117 -0
- package/docs/classes/AbstractEdge.html +198 -0
- package/docs/classes/AbstractGraph.html +891 -0
- package/docs/classes/AbstractVertex.html +164 -0
- package/docs/classes/ArrayDeque.html +384 -0
- package/docs/classes/BST.html +1893 -0
- package/docs/classes/BSTNode.html +425 -0
- package/docs/classes/BTree.html +117 -0
- package/docs/classes/BinaryIndexedTree.html +244 -0
- package/docs/classes/BinaryTree.html +1754 -0
- package/docs/classes/BinaryTreeNode.html +396 -0
- package/docs/classes/Character.html +165 -0
- package/docs/classes/CoordinateMap.html +394 -0
- package/docs/classes/CoordinateSet.html +355 -0
- package/docs/classes/Deque.html +617 -0
- package/docs/classes/DirectedEdge.html +247 -0
- package/docs/classes/DirectedGraph.html +1207 -0
- package/docs/classes/DirectedVertex.html +154 -0
- package/docs/classes/DoublyLinkedList.html +619 -0
- package/docs/classes/DoublyLinkedListNode.html +160 -0
- package/docs/classes/Heap.html +315 -0
- package/docs/classes/Matrix2D.html +447 -0
- package/docs/classes/MatrixNTI2D.html +181 -0
- package/docs/classes/MaxHeap.html +325 -0
- package/docs/classes/MaxPriorityQueue.html +668 -0
- package/docs/classes/MinHeap.html +326 -0
- package/docs/classes/MinPriorityQueue.html +668 -0
- package/docs/classes/Navigator.html +285 -0
- package/docs/classes/ObjectDeque.html +289 -0
- package/docs/classes/PriorityQueue.html +643 -0
- package/docs/classes/Queue.html +337 -0
- package/docs/classes/RBTree.html +117 -0
- package/docs/classes/SegmentTree.html +234 -0
- package/docs/classes/SegmentTreeNode.html +302 -0
- package/docs/classes/SinglyLinkedList.html +1035 -0
- package/docs/classes/SinglyLinkedListNode.html +304 -0
- package/docs/classes/SplayTree.html +117 -0
- package/docs/classes/Stack.html +313 -0
- package/docs/classes/TreeMultiSet.html +1897 -0
- package/docs/classes/Trie.html +317 -0
- package/docs/classes/TrieNode.html +221 -0
- package/docs/classes/TwoThreeTree.html +117 -0
- package/docs/classes/UndirectedEdge.html +220 -0
- package/docs/classes/UndirectedGraph.html +1006 -0
- package/docs/classes/UndirectedVertex.html +154 -0
- package/docs/classes/Vector2D.html +746 -0
- package/docs/enums/CP.html +126 -0
- package/docs/enums/FamilyPosition.html +126 -0
- package/docs/enums/LoopType.html +119 -0
- package/docs/index.html +288 -0
- package/docs/modules.html +146 -0
- package/jest.config.js +5 -0
- package/package.json +33 -47
- package/rename_clear_files.sh +29 -0
- package/src/assets/complexities-diff.jpg +0 -0
- package/src/assets/data-structure-complexities.jpg +0 -0
- package/src/data-structures/binary-tree/avl-tree.ts +58 -6
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +31 -4
- package/src/data-structures/binary-tree/binary-tree.ts +460 -145
- package/src/data-structures/binary-tree/bst.ts +31 -25
- package/src/data-structures/binary-tree/diagrams/avl-tree-inserting.gif +0 -0
- package/src/data-structures/binary-tree/diagrams/bst-rotation.gif +0 -0
- package/src/data-structures/binary-tree/diagrams/segment-tree.png +0 -0
- package/src/data-structures/binary-tree/segment-tree.ts +25 -12
- package/src/data-structures/binary-tree/tree-multiset.ts +5 -4
- package/src/data-structures/diagrams/README.md +5 -0
- package/src/data-structures/graph/abstract-graph.ts +224 -108
- package/src/data-structures/graph/diagrams/adjacency-list-pros-cons.jpg +0 -0
- package/src/data-structures/graph/diagrams/adjacency-list.jpg +0 -0
- package/src/data-structures/graph/diagrams/adjacency-matrix-pros-cons.jpg +0 -0
- package/src/data-structures/graph/diagrams/adjacency-matrix.jpg +0 -0
- package/src/data-structures/graph/diagrams/dfs-can-do.jpg +0 -0
- package/src/data-structures/graph/diagrams/edge-list-pros-cons.jpg +0 -0
- package/src/data-structures/graph/diagrams/edge-list.jpg +0 -0
- package/src/data-structures/graph/diagrams/max-flow.jpg +0 -0
- package/src/data-structures/graph/diagrams/mst.jpg +0 -0
- package/src/data-structures/graph/diagrams/tarjan-articulation-point-bridge.png +0 -0
- package/src/data-structures/graph/diagrams/tarjan-complicate-simple.png +0 -0
- package/src/data-structures/graph/diagrams/tarjan-strongly-connected-component.png +0 -0
- package/src/data-structures/graph/diagrams/tarjan.mp4 +0 -0
- package/src/data-structures/graph/diagrams/tarjan.webp +0 -0
- package/src/data-structures/graph/directed-graph.ts +132 -26
- package/src/data-structures/graph/undirected-graph.ts +78 -11
- package/src/data-structures/hash/coordinate-map.ts +33 -1
- package/src/data-structures/hash/coordinate-set.ts +25 -0
- package/src/data-structures/hash/index.ts +5 -0
- package/src/data-structures/heap/heap.ts +27 -41
- package/src/data-structures/heap/max-heap.ts +8 -2
- package/src/data-structures/heap/min-heap.ts +9 -2
- package/src/data-structures/linked-list/doubly-linked-list.ts +50 -17
- package/src/data-structures/linked-list/singly-linked-list.ts +56 -39
- package/src/data-structures/matrix/matrix.ts +11 -0
- package/src/data-structures/matrix/matrix2d.ts +90 -10
- package/src/data-structures/matrix/navigator.ts +34 -14
- package/src/data-structures/matrix/vector2d.ts +187 -63
- package/src/data-structures/priority-queue/max-priority-queue.ts +12 -3
- package/src/data-structures/priority-queue/min-priority-queue.ts +12 -3
- package/src/data-structures/priority-queue/priority-queue.ts +200 -78
- package/src/data-structures/queue/deque.ts +71 -2
- package/src/data-structures/queue/queue.ts +37 -40
- package/src/data-structures/stack/stack.ts +32 -38
- package/src/data-structures/trie/trie.ts +83 -14
- package/src/data-structures/types/abstract-graph.ts +51 -0
- package/src/data-structures/types/avl-tree.ts +6 -0
- package/src/data-structures/types/binary-tree.ts +15 -0
- package/src/data-structures/types/bst.ts +5 -0
- package/src/data-structures/types/directed-graph.ts +18 -0
- package/src/data-structures/types/doubly-linked-list.ts +1 -0
- package/src/data-structures/types/heap.ts +8 -0
- package/src/data-structures/types/index.ts +13 -0
- package/src/data-structures/types/navigator.ts +13 -0
- package/src/data-structures/types/priority-queue.ts +9 -0
- package/src/data-structures/types/segment-tree.ts +1 -0
- package/src/data-structures/types/singly-linked-list.ts +1 -0
- package/src/data-structures/types/tree-multiset.ts +3 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/trampoline.ts +51 -0
- package/src/utils/types/index.ts +1 -0
- package/src/{types → utils/types}/utils.ts +27 -5
- package/src/{utils.ts → utils/utils.ts} +41 -131
- package/tests/unit/data-structures/binary-tree/bst.test.ts +185 -0
- package/tests/unit/data-structures/graph/directed-graph.test.ts +71 -0
- package/{dist/types/data-structures/graph/index.d.ts → tests/unit/data-structures/graph/index.ts} +1 -1
- package/tests/unit/data-structures/graph/undirected-graph.ts +0 -0
- package/tsconfig.json +9 -6
- package/dist/data-structures/trampoline.d.ts +0 -25
- package/dist/data-structures/trampoline.js +0 -52
- package/dist/types/data-structures/binary-tree/aa-tree.d.ts +0 -2
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +0 -21
- package/dist/types/data-structures/binary-tree/b-tree.d.ts +0 -2
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -8
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +0 -140
- package/dist/types/data-structures/binary-tree/bst.d.ts +0 -32
- package/dist/types/data-structures/binary-tree/index.d.ts +0 -4
- package/dist/types/data-structures/binary-tree/rb-tree.d.ts +0 -2
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +0 -33
- package/dist/types/data-structures/binary-tree/splay-tree.d.ts +0 -2
- package/dist/types/data-structures/binary-tree/tree-multiset.d.ts +0 -11
- package/dist/types/data-structures/binary-tree/two-three-tree.d.ts +0 -2
- package/dist/types/data-structures/graph/abstract-graph.d.ts +0 -126
- package/dist/types/data-structures/graph/directed-graph.d.ts +0 -51
- package/dist/types/data-structures/graph/undirected-graph.d.ts +0 -24
- package/dist/types/data-structures/hash/coordinate-map.d.ts +0 -8
- package/dist/types/data-structures/hash/coordinate-set.d.ts +0 -7
- package/dist/types/data-structures/hash/index.d.ts +0 -1
- package/dist/types/data-structures/hash/pair.d.ts +0 -1
- package/dist/types/data-structures/hash/tree-map.d.ts +0 -1
- package/dist/types/data-structures/hash/tree-set.d.ts +0 -1
- package/dist/types/data-structures/heap/heap.d.ts +0 -72
- package/dist/types/data-structures/heap/index.d.ts +0 -3
- package/dist/types/data-structures/heap/max-heap.d.ts +0 -14
- package/dist/types/data-structures/heap/min-heap.d.ts +0 -14
- package/dist/types/data-structures/index.d.ts +0 -9
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +0 -59
- package/dist/types/data-structures/linked-list/index.d.ts +0 -2
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +0 -358
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +0 -1
- package/dist/types/data-structures/matrix/index.d.ts +0 -3
- package/dist/types/data-structures/matrix/matrix.d.ts +0 -9
- package/dist/types/data-structures/matrix/matrix2d.d.ts +0 -25
- package/dist/types/data-structures/matrix/navigator.d.ts +0 -31
- package/dist/types/data-structures/matrix/vector2d.d.ts +0 -74
- package/dist/types/data-structures/priority-queue/index.d.ts +0 -3
- package/dist/types/data-structures/priority-queue/max-priority-queue.d.ts +0 -4
- package/dist/types/data-structures/priority-queue/min-priority-queue.d.ts +0 -4
- package/dist/types/data-structures/priority-queue/priority-queue.d.ts +0 -36
- package/dist/types/data-structures/queue/deque.d.ts +0 -37
- package/dist/types/data-structures/queue/index.d.ts +0 -1
- package/dist/types/data-structures/queue/queue.d.ts +0 -76
- package/dist/types/data-structures/stack/index.d.ts +0 -1
- package/dist/types/data-structures/stack/stack.d.ts +0 -69
- package/dist/types/data-structures/trampoline.d.ts +0 -25
- package/dist/types/data-structures/trie/index.d.ts +0 -1
- package/dist/types/data-structures/trie/trie.d.ts +0 -28
- package/dist/types/utils.d.ts +0 -46
- package/dist/utils.js +0 -569
- package/src/data-structures/trampoline.ts +0 -91
- package/src/types/index.ts +0 -1
- /package/dist/{types/data-structures/hash/hash-table.d.ts → data-structures/types/singly-linked-list.d.ts} +0 -0
- /package/dist/{types → utils}/index.d.ts +0 -0
- /package/dist/{types → utils}/index.js +0 -0
- /package/dist/{types → utils}/types/index.d.ts +0 -0
- /package/{src/types/patches/index.d.ts → tests/unit/data-structures/graph/abstract-graph.ts} +0 -0
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license MIT
|
|
3
|
-
* @copyright 2020 Pablo
|
|
4
|
-
*
|
|
5
|
-
* @class
|
|
6
|
-
*/
|
|
7
|
-
export declare class Queue<T> {
|
|
8
|
-
protected _nodes: T[];
|
|
9
|
-
protected _offset: number;
|
|
10
|
-
/**
|
|
11
|
-
* Creates a queue.
|
|
12
|
-
* @param {array} [elements]
|
|
13
|
-
*/
|
|
14
|
-
constructor(elements?: T[]);
|
|
15
|
-
/**
|
|
16
|
-
* Adds an element at the back of the queue.
|
|
17
|
-
* @public
|
|
18
|
-
* @param {any} element
|
|
19
|
-
*/
|
|
20
|
-
offer(element: T): Queue<T>;
|
|
21
|
-
/**
|
|
22
|
-
* Dequeues the front element in the queue.
|
|
23
|
-
* @public
|
|
24
|
-
* @returns {any}
|
|
25
|
-
*/
|
|
26
|
-
poll(): T | null;
|
|
27
|
-
/**
|
|
28
|
-
* Returns the front element of the queue.
|
|
29
|
-
* @public
|
|
30
|
-
* @returns {any}
|
|
31
|
-
*/
|
|
32
|
-
peek(): T | null;
|
|
33
|
-
/**
|
|
34
|
-
* Returns the back element of the queue.
|
|
35
|
-
* @public
|
|
36
|
-
* @returns {any}
|
|
37
|
-
*/
|
|
38
|
-
peekLast(): T | null;
|
|
39
|
-
/**
|
|
40
|
-
* Returns the number of elements in the queue.
|
|
41
|
-
* @public
|
|
42
|
-
* @returns {number}
|
|
43
|
-
*/
|
|
44
|
-
size(): number;
|
|
45
|
-
/**
|
|
46
|
-
* Checks if the queue is empty.
|
|
47
|
-
* @public
|
|
48
|
-
* @returns {boolean}
|
|
49
|
-
*/
|
|
50
|
-
isEmpty(): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Returns the remaining elements in the queue as an array.
|
|
53
|
-
* @public
|
|
54
|
-
* @returns {array}
|
|
55
|
-
*/
|
|
56
|
-
toArray(): T[];
|
|
57
|
-
/**
|
|
58
|
-
* Clears the queue.
|
|
59
|
-
* @public
|
|
60
|
-
*/
|
|
61
|
-
clear(): void;
|
|
62
|
-
/**
|
|
63
|
-
* Creates a shallow copy of the queue.
|
|
64
|
-
* @public
|
|
65
|
-
* @return {Queue}
|
|
66
|
-
*/
|
|
67
|
-
clone(): Queue<T>;
|
|
68
|
-
/**
|
|
69
|
-
* Creates a queue from an existing array.
|
|
70
|
-
* @public
|
|
71
|
-
* @static
|
|
72
|
-
* @param {array} elements
|
|
73
|
-
* @return {Queue}
|
|
74
|
-
*/
|
|
75
|
-
static fromArray<T>(elements: T[]): Queue<T>;
|
|
76
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './stack';
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license MIT
|
|
3
|
-
* @copyright 2020 Pablo Rios <zrwusa@gmail.com>
|
|
4
|
-
*
|
|
5
|
-
* @class
|
|
6
|
-
*/
|
|
7
|
-
export declare class Stack<T> {
|
|
8
|
-
protected _elements: T[];
|
|
9
|
-
/**
|
|
10
|
-
* Creates a stack.
|
|
11
|
-
* @param {array} [elements]
|
|
12
|
-
*/
|
|
13
|
-
constructor(elements?: T[]);
|
|
14
|
-
/**
|
|
15
|
-
* Checks if the stack is empty.
|
|
16
|
-
* @public
|
|
17
|
-
* @returns {boolean}
|
|
18
|
-
*/
|
|
19
|
-
isEmpty(): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Returns the number of elements in the stack.
|
|
22
|
-
* @public
|
|
23
|
-
* @returns {number}
|
|
24
|
-
*/
|
|
25
|
-
size(): number;
|
|
26
|
-
/**
|
|
27
|
-
* Returns the top element in the stack.
|
|
28
|
-
* @public
|
|
29
|
-
* @returns {object}
|
|
30
|
-
*/
|
|
31
|
-
peek(): T | null;
|
|
32
|
-
/**
|
|
33
|
-
* Adds an element to the top of the stack.
|
|
34
|
-
* @public
|
|
35
|
-
* @param {object} element
|
|
36
|
-
*/
|
|
37
|
-
push(element: T): Stack<T>;
|
|
38
|
-
/**
|
|
39
|
-
* Removes and returns the top element in the stack.
|
|
40
|
-
* @public
|
|
41
|
-
* @returns {object}
|
|
42
|
-
*/
|
|
43
|
-
pop(): T | null;
|
|
44
|
-
/**
|
|
45
|
-
* Returns the remaining elements as an array.
|
|
46
|
-
* @public
|
|
47
|
-
* @returns {array}
|
|
48
|
-
*/
|
|
49
|
-
toArray(): T[];
|
|
50
|
-
/**
|
|
51
|
-
* Clears all elements from the stack.
|
|
52
|
-
* @public
|
|
53
|
-
*/
|
|
54
|
-
clear(): void;
|
|
55
|
-
/**
|
|
56
|
-
* Creates a shallow copy from the stack.
|
|
57
|
-
* @public
|
|
58
|
-
* @return {Stack}
|
|
59
|
-
*/
|
|
60
|
-
clone(): Stack<T>;
|
|
61
|
-
/**
|
|
62
|
-
* Creates a stack from an existing array
|
|
63
|
-
* @public
|
|
64
|
-
* @static
|
|
65
|
-
* @param {array} [elements]
|
|
66
|
-
* @return {Stack}
|
|
67
|
-
*/
|
|
68
|
-
static fromArray<T>(elements: T[]): Stack<T>;
|
|
69
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export type ArgumentTypes<T extends (...args: any[]) => any> = T extends (...args: infer A) => any ? A : never;
|
|
2
|
-
export declare const THUNK_SYMBOL: unique symbol;
|
|
3
|
-
export interface Thunk<T> extends Function {
|
|
4
|
-
__THUNK__: typeof THUNK_SYMBOL;
|
|
5
|
-
(): T;
|
|
6
|
-
}
|
|
7
|
-
export type ThunkOrValue<T> = T | Thunk<T>;
|
|
8
|
-
export type UnwrapThunkDeep<T> = {
|
|
9
|
-
0: T extends Thunk<infer U> ? UnwrapThunkDeep<U> : T;
|
|
10
|
-
}[T extends ThunkOrValue<T> ? 0 : never];
|
|
11
|
-
export declare const isThunk: <T>(value: any) => value is Thunk<T>;
|
|
12
|
-
export declare const toThunk: <R>(fn: () => R) => Thunk<R>;
|
|
13
|
-
export type UnwrapPromise<T> = T extends Promise<infer U> ? Exclude<U, Promise<T>> : T;
|
|
14
|
-
export type Unbox<T> = UnwrapThunkDeep<UnwrapPromise<T>>;
|
|
15
|
-
export type Cont<A extends any[], R> = (...args: A) => Thunk<Unbox<R>>;
|
|
16
|
-
export interface Trampoline<F extends ((...args: any[]) => any)> {
|
|
17
|
-
(...args: ArgumentTypes<F>): Unbox<ReturnType<F>>;
|
|
18
|
-
cont: Cont<ArgumentTypes<F>, ReturnType<F>>;
|
|
19
|
-
}
|
|
20
|
-
export interface TrampolineAsync<F extends ((...args: any[]) => any)> {
|
|
21
|
-
(...args: ArgumentTypes<F>): Promise<Unbox<ReturnType<F>>>;
|
|
22
|
-
cont: Cont<ArgumentTypes<F>, ReturnType<F>>;
|
|
23
|
-
}
|
|
24
|
-
export declare const trampoline: <F extends (...args: any[]) => any>(fn: F) => Trampoline<F>;
|
|
25
|
-
export declare const trampolineAsync: <F extends (...args: any[]) => any>(fn: F) => TrampolineAsync<F>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './trie';
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export declare class TrieNode {
|
|
2
|
-
protected _children: Map<string, TrieNode>;
|
|
3
|
-
get children(): Map<string, TrieNode>;
|
|
4
|
-
set children(v: Map<string, TrieNode>);
|
|
5
|
-
protected _isEnd: boolean;
|
|
6
|
-
get isEnd(): boolean;
|
|
7
|
-
set isEnd(v: boolean);
|
|
8
|
-
}
|
|
9
|
-
export declare class Trie {
|
|
10
|
-
protected _root: TrieNode;
|
|
11
|
-
get root(): TrieNode;
|
|
12
|
-
set root(v: TrieNode);
|
|
13
|
-
constructor();
|
|
14
|
-
put(input: string): boolean;
|
|
15
|
-
has(input: string): boolean;
|
|
16
|
-
remove(word: string): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Only can present as a prefix, not a word
|
|
19
|
-
* @param input
|
|
20
|
-
*/
|
|
21
|
-
isAbsPrefix(input: string): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Can present as a prefix or word
|
|
24
|
-
* @param input
|
|
25
|
-
*/
|
|
26
|
-
isPrefix(input: string): boolean;
|
|
27
|
-
getAll(prefix?: string): string[];
|
|
28
|
-
}
|
package/dist/types/utils.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export type AnyFunction<A extends any[] = any[], R = any> = (...args: A) => R;
|
|
2
|
-
export type Primitive = number | string | boolean | symbol | undefined | null | void | AnyFunction | Date;
|
|
3
|
-
export type Cast<T, TComplex> = {
|
|
4
|
-
[M in keyof TComplex]: T;
|
|
5
|
-
};
|
|
6
|
-
export type DeepLeavesWrap<T, TComplex> = T extends string ? Cast<string, TComplex> : T extends number ? Cast<number, TComplex> : T extends boolean ? Cast<boolean, TComplex> : T extends undefined ? Cast<undefined, TComplex> : T extends null ? Cast<null, TComplex> : T extends void ? Cast<void, TComplex> : T extends symbol ? Cast<symbol, TComplex> : T extends AnyFunction ? Cast<AnyFunction, TComplex> : T extends Date ? Cast<Date, TComplex> : {
|
|
7
|
-
[K in keyof T]: T[K] extends (infer U)[] ? DeepLeavesWrap<U, TComplex>[] : DeepLeavesWrap<T[K], TComplex>;
|
|
8
|
-
};
|
|
9
|
-
export type JSONSerializable = {
|
|
10
|
-
[key: string]: any;
|
|
11
|
-
};
|
|
12
|
-
export type JSONValue = string | number | boolean | undefined | JSONObject;
|
|
13
|
-
export interface JSONObject {
|
|
14
|
-
[key: string]: JSONValue;
|
|
15
|
-
}
|
|
16
|
-
export type TypeName<T> = T extends string ? 'string' : T extends number ? 'number' : T extends boolean ? 'boolean' : T extends undefined ? 'undefined' : T extends AnyFunction ? 'function' : 'object';
|
|
17
|
-
export type JsonKeys<T> = keyof {
|
|
18
|
-
[P in keyof T]: number;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* A function that emits a side effect and does not return anything.
|
|
22
|
-
*/
|
|
23
|
-
export type Procedure = (...args: any[]) => void;
|
|
24
|
-
export type DebounceOptions = {
|
|
25
|
-
isImmediate?: boolean;
|
|
26
|
-
maxWait?: number;
|
|
27
|
-
};
|
|
28
|
-
export interface DebouncedFunction<F extends Procedure> {
|
|
29
|
-
(this: ThisParameterType<F>, ...args: Parameters<F>): void;
|
|
30
|
-
cancel: () => void;
|
|
31
|
-
}
|
|
32
|
-
export type MonthKey = 'January' | 'February' | 'March' | 'April' | 'May' | 'June' | 'July' | 'August' | 'September' | 'October' | 'November' | 'December';
|
|
33
|
-
export type Month = {
|
|
34
|
-
[key in MonthKey]: string;
|
|
35
|
-
};
|
|
36
|
-
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
37
|
-
export declare class TreeNode<T> {
|
|
38
|
-
id: string;
|
|
39
|
-
name?: string | undefined;
|
|
40
|
-
value?: T | undefined;
|
|
41
|
-
children?: TreeNode<T>[] | undefined;
|
|
42
|
-
constructor(id: string, name?: string, value?: T, children?: TreeNode<T>[]);
|
|
43
|
-
addChildren(children: TreeNode<T> | TreeNode<T>[]): void;
|
|
44
|
-
getHeight(): number;
|
|
45
|
-
}
|
|
46
|
-
export type OrderType = 'InOrder' | 'PreOrder' | 'PostOrder';
|