data-structure-typed 2.1.1 → 2.1.2

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 (51) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +19 -7
  3. package/dist/cjs/index.cjs +22 -22
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/esm/index.mjs +22 -22
  6. package/dist/esm/index.mjs.map +1 -1
  7. package/dist/types/data-structures/binary-tree/avl-tree-counter.d.ts +1 -1
  8. package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +1 -1
  9. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +1 -1
  10. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +1 -1
  11. package/dist/types/data-structures/binary-tree/bst.d.ts +1 -1
  12. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +2 -2
  13. package/dist/types/data-structures/binary-tree/tree-counter.d.ts +1 -1
  14. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +1 -1
  15. package/dist/types/data-structures/heap/heap.d.ts +4 -4
  16. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +1 -1
  17. package/dist/types/interfaces/binary-tree.d.ts +1 -1
  18. package/dist/umd/data-structure-typed.js +87 -165
  19. package/dist/umd/data-structure-typed.js.map +1 -1
  20. package/dist/umd/data-structure-typed.min.js +2 -2
  21. package/dist/umd/data-structure-typed.min.js.map +1 -1
  22. package/jest.integration.config.js +7 -3
  23. package/package.json +11 -7
  24. package/src/data-structures/binary-tree/avl-tree-counter.ts +4 -4
  25. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +1 -1
  26. package/src/data-structures/binary-tree/avl-tree.ts +2 -2
  27. package/src/data-structures/binary-tree/binary-tree.ts +4 -4
  28. package/src/data-structures/binary-tree/bst.ts +1 -1
  29. package/src/data-structures/binary-tree/red-black-tree.ts +2 -2
  30. package/src/data-structures/binary-tree/tree-counter.ts +4 -4
  31. package/src/data-structures/binary-tree/tree-multi-map.ts +1 -1
  32. package/src/data-structures/heap/heap.ts +5 -5
  33. package/src/data-structures/linked-list/singly-linked-list.ts +2 -2
  34. package/src/interfaces/binary-tree.ts +1 -1
  35. package/test/integration/compile.test.mjs +159 -0
  36. package/test/integration/compile.test.ts +176 -0
  37. package/test/integration/heap.test.js +1 -1
  38. package/test/integration/index.html +1 -1
  39. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +3 -3
  40. package/{tsconfig-base.json → tsconfig.base.json} +0 -1
  41. package/tsconfig.test.json +1 -0
  42. package/{tsconfig-types.json → tsconfig.types.json} +1 -3
  43. package/tsup.config.js +2 -3
  44. package/dist/index.cjs +0 -13091
  45. package/dist/index.cjs.map +0 -1
  46. package/dist/index.js +0 -13013
  47. package/dist/index.js.map +0 -1
  48. package/test/integration/compile.js +0 -144
  49. package/test/integration/compile.mjs +0 -135
  50. package/test/integration/compile.ts +0 -171
  51. /package/{tsup.node.config.ts → tsup.node.config.js} +0 -0
@@ -78,7 +78,7 @@ export declare class AVLTreeCounter<K = any, V = any, R = any> extends AVLTree<K
78
78
  * @returns Total count recomputed from nodes.
79
79
  */
80
80
  getComputedCount(): number;
81
- _createNode(key: K, value?: V, count?: number): AVLTreeCounterNode<K, V>;
81
+ createNode(key: K, value?: V, count?: number): AVLTreeCounterNode<K, V>;
82
82
  /**
83
83
  * Type guard: check whether the input is an AVLTreeCounterNode.
84
84
  * @remarks Time O(1), Space O(1)
@@ -69,7 +69,7 @@ export declare class AVLTreeMultiMap<K = any, V = any, R = any> extends AVLTree<
69
69
  * @returns New AVLTreeMultiMap instance.
70
70
  */
71
71
  constructor(keysNodesEntriesOrRaws?: Iterable<K | AVLTreeMultiMapNode<K, V> | [K | null | undefined, V[] | undefined] | null | undefined | R>, options?: AVLTreeMultiMapOptions<K, V[], R>);
72
- _createNode(key: K, value?: V[]): AVLTreeMultiMapNode<K, V>;
72
+ createNode(key: K, value?: V[]): AVLTreeMultiMapNode<K, V>;
73
73
  add(keyNodeOrEntry: K | AVLTreeMultiMapNode<K, V> | [K | null | undefined, V[] | undefined] | null | undefined): boolean;
74
74
  add(key: K, value: V): boolean;
75
75
  /**
@@ -153,7 +153,7 @@ export declare class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> imp
153
153
  * @param [value] - The value for the new node.
154
154
  * @returns The newly created AVLTreeNode.
155
155
  */
156
- _createNode(key: K, value?: V): AVLTreeNode<K, V>;
156
+ createNode(key: K, value?: V): AVLTreeNode<K, V>;
157
157
  /**
158
158
  * Checks if the given item is an `AVLTreeNode` instance.
159
159
  * @remarks Time O(1), Space O(1)
@@ -260,7 +260,7 @@ export declare class BinaryTree<K = any, V = any, R = any> extends IterableEntry
260
260
  * @param [value] - The value for the new node (used if not in Map mode).
261
261
  * @returns The newly created node.
262
262
  */
263
- _createNode(key: K, value?: V): BinaryTreeNode<K, V>;
263
+ createNode(key: K, value?: V): BinaryTreeNode<K, V>;
264
264
  /**
265
265
  * Creates a new, empty tree of the same type and configuration.
266
266
  * @remarks Time O(1) (excluding options cloning), Space O(1)
@@ -180,7 +180,7 @@ export declare class BST<K = any, V = any, R = any> extends BinaryTree<K, V, R>
180
180
  * @param [value] - The value for the new node (used if not in Map mode).
181
181
  * @returns The newly created BSTNode.
182
182
  */
183
- _createNode(key: K, value?: V): BSTNode<K, V>;
183
+ createNode(key: K, value?: V): BSTNode<K, V>;
184
184
  /**
185
185
  * Ensures the input is a node. If it's a key or entry, it searches for the node.
186
186
  * @remarks Time O(log N) (height of the tree), O(N) worst-case.
@@ -49,7 +49,7 @@ export declare class RedBlackTreeNode<K = any, V = any> extends BSTNode<K, V> {
49
49
  set right(v: RedBlackTreeNode<K, V> | null | undefined);
50
50
  }
51
51
  /**
52
- * RRRRRRRRRRRRRRRRRRed-Black Tree (self-balancing BST) supporting map-like mode and stable O(log n) updates.
52
+ * Represents a Red-Black Tree (self-balancing BST) supporting map-like mode and stable O(log n) updates.
53
53
  * @remarks Time O(1), Space O(1)
54
54
  * @template K
55
55
  * @template V
@@ -117,7 +117,7 @@ export declare class RedBlackTree<K = any, V = any, R = any> extends BST<K, V, R
117
117
  * @param color - See parameter type for details.
118
118
  * @returns A new RedBlackTreeNode instance.
119
119
  */
120
- _createNode(key: K, value?: V, color?: RBTNColor): RedBlackTreeNode<K, V>;
120
+ createNode(key: K, value?: V, color?: RBTNColor): RedBlackTreeNode<K, V>;
121
121
  /**
122
122
  * Type guard: check whether the input is a RedBlackTreeNode.
123
123
  * @remarks Time O(1), Space O(1)
@@ -86,7 +86,7 @@ export declare class TreeCounter<K = any, V = any, R = any> extends RedBlackTree
86
86
  * @returns Total count recomputed from nodes.
87
87
  */
88
88
  getComputedCount(): number;
89
- _createNode(key: K, value?: V, color?: RBTNColor, count?: number): TreeCounterNode<K, V>;
89
+ createNode(key: K, value?: V, color?: RBTNColor, count?: number): TreeCounterNode<K, V>;
90
90
  /**
91
91
  * Type guard: check whether the input is a TreeCounterNode.
92
92
  * @remarks Time O(1), Space O(1)
@@ -233,7 +233,7 @@ export declare class TreeMultiMap<K = any, V = any, R = any> extends RedBlackTre
233
233
  * @returns New TreeMultiMap instance.
234
234
  */
235
235
  constructor(keysNodesEntriesOrRaws?: Iterable<K | TreeMultiMapNode<K, V> | [K | null | undefined, V[] | undefined] | null | undefined | R>, options?: TreeMultiMapOptions<K, V[], R>);
236
- _createNode(key: K, value?: V[]): TreeMultiMapNode<K, V>;
236
+ createNode(key: K, value?: V[]): TreeMultiMapNode<K, V>;
237
237
  add(keyNodeOrEntry: K | TreeMultiMapNode<K, V> | [K | null | undefined, V[] | undefined] | null | undefined): boolean;
238
238
  add(key: K, value: V): boolean;
239
239
  /**
@@ -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 = unknown, R = never> extends IterableElementBase<E, R> {
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 = never, 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;
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 = unknown, RR = never>(elements: Iterable<EE>, options: HeapOptions<EE, RR>): Heap<EE, RR>;
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
- _createNode(element: E): FibonacciHeapNode<E>;
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 _createNode(value: E): SinglyLinkedListNode<E>;
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
- _createNode(key: K, value?: BinaryTreeNode<K, V>['value']): BinaryTreeNode<K, V>;
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[];