data-structure-typed 2.1.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/CONTRIBUTING.md +4 -0
- package/README.md +19 -7
- package/dist/cjs/index.cjs +1175 -585
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/{index.cjs → cjs-legacy/index.cjs} +1145 -613
- package/dist/cjs-legacy/index.cjs.map +1 -0
- package/dist/esm/index.mjs +1175 -585
- package/dist/esm/index.mjs.map +1 -1
- package/dist/{index.js → esm-legacy/index.mjs} +1147 -615
- package/dist/esm-legacy/index.mjs.map +1 -0
- package/dist/types/data-structures/binary-tree/avl-tree-counter.d.ts +58 -4
- package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +66 -4
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +59 -5
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +1 -1
- package/dist/types/data-structures/binary-tree/bst.d.ts +58 -4
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +60 -6
- package/dist/types/data-structures/binary-tree/tree-counter.d.ts +58 -4
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +66 -4
- package/dist/types/data-structures/heap/heap.d.ts +4 -4
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +1 -1
- package/dist/types/interfaces/binary-tree.d.ts +1 -1
- package/dist/umd/data-structure-typed.js +711 -228
- package/dist/umd/data-structure-typed.js.map +1 -1
- package/dist/umd/data-structure-typed.min.js +3 -3
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/jest.integration.config.js +7 -3
- package/package.json +29 -7
- package/src/data-structures/binary-tree/avl-tree-counter.ts +106 -15
- package/src/data-structures/binary-tree/avl-tree-multi-map.ts +116 -12
- package/src/data-structures/binary-tree/avl-tree.ts +107 -16
- package/src/data-structures/binary-tree/binary-tree.ts +4 -4
- package/src/data-structures/binary-tree/bst.ts +103 -12
- package/src/data-structures/binary-tree/red-black-tree.ts +110 -20
- package/src/data-structures/binary-tree/tree-counter.ts +105 -14
- package/src/data-structures/binary-tree/tree-multi-map.ts +123 -12
- package/src/data-structures/graph/abstract-graph.ts +5 -5
- package/src/data-structures/graph/directed-graph.ts +5 -5
- package/src/data-structures/graph/undirected-graph.ts +5 -5
- package/src/data-structures/heap/heap.ts +5 -5
- package/src/data-structures/linked-list/singly-linked-list.ts +2 -2
- package/src/interfaces/binary-tree.ts +1 -1
- package/test/integration/compile.test.mjs +159 -0
- package/test/integration/compile.test.ts +176 -0
- package/test/integration/heap.test.js +1 -1
- package/test/integration/index.html +1 -1
- package/test/unit/data-structures/binary-tree/avl-tree-counter.test.ts +5 -4
- package/test/unit/data-structures/binary-tree/avl-tree.test.ts +3 -3
- package/test/unit/data-structures/binary-tree/binary-tree.test.ts +3 -3
- package/test/unit/data-structures/binary-tree/bst.test.ts +2 -2
- package/test/unit/data-structures/binary-tree/red-black-tree.test.ts +3 -3
- package/test/unit/data-structures/binary-tree/tree-counter.test.ts +5 -4
- package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +4 -4
- package/{tsconfig-base.json → tsconfig.base.json} +0 -1
- package/tsconfig.test.json +1 -0
- package/{tsconfig-types.json → tsconfig.types.json} +1 -3
- package/tsup.config.js +2 -3
- package/tsup.node.config.js +71 -0
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/test/integration/compile.js +0 -144
- package/test/integration/compile.mjs +0 -135
- package/test/integration/compile.ts +0 -171
- package/tsup.node.config.ts +0 -37
|
@@ -188,7 +188,7 @@ import { IterableElementBase } from '../base';
|
|
|
188
188
|
* ]);
|
|
189
189
|
* console.log(scheduleTasks(tasks, 2)); // expectedMap
|
|
190
190
|
*/
|
|
191
|
-
export declare class Heap<E =
|
|
191
|
+
export declare class Heap<E = any, R = any> extends IterableElementBase<E, R> {
|
|
192
192
|
protected _equals: (a: E, b: E) => boolean;
|
|
193
193
|
/**
|
|
194
194
|
* Create a Heap and optionally bulk-insert elements.
|
|
@@ -227,7 +227,7 @@ export declare class Heap<E = unknown, R = never> extends IterableElementBase<E,
|
|
|
227
227
|
* @param [options] - Heap options including comparator.
|
|
228
228
|
* @returns A new heap instance of this class.
|
|
229
229
|
*/
|
|
230
|
-
static from<T, R =
|
|
230
|
+
static from<T, R = any, S extends Heap<T, R> = Heap<T, R>>(this: new (elements?: Iterable<T | R>, options?: HeapOptions<T, R>) => S, elements?: Iterable<T | R>, options?: HeapOptions<T, R>): S;
|
|
231
231
|
/**
|
|
232
232
|
* Build a Heap from an iterable in linear time given a comparator.
|
|
233
233
|
* @remarks Time O(N), Space O(N)
|
|
@@ -237,7 +237,7 @@ export declare class Heap<E = unknown, R = never> extends IterableElementBase<E,
|
|
|
237
237
|
* @param options - Heap options including comparator.
|
|
238
238
|
* @returns A new Heap built from elements.
|
|
239
239
|
*/
|
|
240
|
-
static heapify<EE =
|
|
240
|
+
static heapify<EE = any, RR = any>(elements: Iterable<EE>, options: HeapOptions<EE, RR>): Heap<EE, RR>;
|
|
241
241
|
/**
|
|
242
242
|
* Insert an element.
|
|
243
243
|
* @remarks Time O(1) amortized, Space O(1)
|
|
@@ -493,7 +493,7 @@ export declare class FibonacciHeap<E> {
|
|
|
493
493
|
* @returns void
|
|
494
494
|
*/
|
|
495
495
|
merge(heapToMerge: FibonacciHeap<E>): void;
|
|
496
|
-
|
|
496
|
+
createNode(element: E): FibonacciHeapNode<E>;
|
|
497
497
|
isEmpty(): boolean;
|
|
498
498
|
protected _defaultComparator(a: E, b: E): number;
|
|
499
499
|
protected mergeWithRoot(node: FibonacciHeapNode<E>): void;
|
|
@@ -375,7 +375,7 @@ export declare class SinglyLinkedList<E = any, R = any> extends LinearLinkedBase
|
|
|
375
375
|
* @param value - Value to wrap in a node.
|
|
376
376
|
* @returns A new SinglyLinkedListNode instance.
|
|
377
377
|
*/
|
|
378
|
-
protected
|
|
378
|
+
protected createNode(value: E): SinglyLinkedListNode<E>;
|
|
379
379
|
/**
|
|
380
380
|
* (Protected) Check if input is a node predicate function.
|
|
381
381
|
* @remarks Time O(1), Space O(1)
|
|
@@ -14,7 +14,7 @@ export interface IBinaryTree<K = any, V = any, R = any> {
|
|
|
14
14
|
readonly store: Map<K, V | undefined>;
|
|
15
15
|
readonly toEntryFn?: ToEntryFn<K, V, R>;
|
|
16
16
|
readonly isDuplicate: boolean;
|
|
17
|
-
|
|
17
|
+
createNode(key: K, value?: BinaryTreeNode<K, V>['value']): BinaryTreeNode<K, V>;
|
|
18
18
|
createTree(options?: Partial<BinaryTreeOptions<K, V, R>>): IBinaryTree<K, V, R>;
|
|
19
19
|
add(keyOrNodeOrEntryOrRawElement: BTNRep<K, V, BinaryTreeNode<K, V>>, value?: V, count?: number): boolean;
|
|
20
20
|
addMany(keysNodesEntriesOrRaws: Iterable<K | BinaryTreeNode<K, V> | [K | null | undefined, V | undefined] | null | undefined | R>, values?: Iterable<V | undefined>): boolean[];
|