heap-typed 1.38.0 → 1.38.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 (52) hide show
  1. package/dist/data-structures/binary-tree/avl-tree.d.ts +9 -9
  2. package/dist/data-structures/binary-tree/avl-tree.js +22 -22
  3. package/dist/data-structures/binary-tree/binary-tree.d.ts +31 -31
  4. package/dist/data-structures/binary-tree/binary-tree.js +32 -32
  5. package/dist/data-structures/binary-tree/rb-tree.d.ts +1 -1
  6. package/dist/data-structures/binary-tree/tree-multiset.d.ts +9 -9
  7. package/dist/data-structures/binary-tree/tree-multiset.js +23 -23
  8. package/dist/data-structures/hash/hash-map.d.ts +25 -25
  9. package/dist/data-structures/hash/hash-map.js +59 -59
  10. package/dist/data-structures/hash/hash-table.d.ts +34 -34
  11. package/dist/data-structures/hash/hash-table.js +99 -99
  12. package/dist/data-structures/heap/heap.d.ts +66 -66
  13. package/dist/data-structures/heap/heap.js +167 -167
  14. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +1 -1
  15. package/dist/data-structures/linked-list/doubly-linked-list.js +3 -3
  16. package/dist/data-structures/linked-list/skip-linked-list.d.ts +17 -17
  17. package/dist/data-structures/linked-list/skip-linked-list.js +34 -34
  18. package/dist/data-structures/matrix/matrix2d.d.ts +7 -7
  19. package/dist/data-structures/matrix/matrix2d.js +9 -9
  20. package/dist/data-structures/trie/trie.d.ts +2 -2
  21. package/dist/data-structures/trie/trie.js +6 -6
  22. package/dist/index.d.ts +3 -3
  23. package/dist/index.js +3 -3
  24. package/package.json +1 -4
  25. package/src/data-structures/binary-tree/avl-tree.ts +28 -28
  26. package/src/data-structures/binary-tree/binary-indexed-tree.ts +1 -1
  27. package/src/data-structures/binary-tree/binary-tree.ts +57 -57
  28. package/src/data-structures/binary-tree/bst.ts +4 -0
  29. package/src/data-structures/binary-tree/rb-tree.ts +2 -2
  30. package/src/data-structures/binary-tree/tree-multiset.ts +30 -31
  31. package/src/data-structures/graph/abstract-graph.ts +10 -11
  32. package/src/data-structures/graph/directed-graph.ts +1 -2
  33. package/src/data-structures/graph/undirected-graph.ts +4 -5
  34. package/src/data-structures/hash/hash-map.ts +82 -76
  35. package/src/data-structures/hash/hash-table.ts +112 -109
  36. package/src/data-structures/hash/tree-map.ts +2 -1
  37. package/src/data-structures/hash/tree-set.ts +2 -1
  38. package/src/data-structures/heap/heap.ts +182 -181
  39. package/src/data-structures/linked-list/doubly-linked-list.ts +4 -4
  40. package/src/data-structures/linked-list/singly-linked-list.ts +1 -1
  41. package/src/data-structures/linked-list/skip-linked-list.ts +45 -38
  42. package/src/data-structures/matrix/matrix.ts +1 -1
  43. package/src/data-structures/matrix/matrix2d.ts +10 -10
  44. package/src/data-structures/matrix/vector2d.ts +2 -1
  45. package/src/data-structures/queue/deque.ts +5 -4
  46. package/src/data-structures/queue/queue.ts +1 -1
  47. package/src/data-structures/trie/trie.ts +9 -9
  48. package/src/index.ts +3 -3
  49. package/src/types/data-structures/matrix/navigator.ts +1 -1
  50. package/src/types/helpers.ts +5 -1
  51. package/src/types/utils/utils.ts +1 -1
  52. package/src/types/utils/validate-type.ts +2 -2
@@ -52,6 +52,8 @@ export class TrieNode {
52
52
  * Trie represents a Trie data structure. It provides basic Trie operations and additional methods.
53
53
  */
54
54
  export class Trie {
55
+ private readonly _caseSensitive: boolean;
56
+
55
57
  constructor(words?: string[], caseSensitive = true) {
56
58
  this._root = new TrieNode('');
57
59
  this._caseSensitive = caseSensitive;
@@ -72,8 +74,6 @@ export class Trie {
72
74
  this._root = v;
73
75
  }
74
76
 
75
- private readonly _caseSensitive: boolean;
76
-
77
77
  /**
78
78
  * Add a word to the Trie structure.
79
79
  * @param {string} word - The word to add.
@@ -110,13 +110,6 @@ export class Trie {
110
110
  return cur.isEnd;
111
111
  }
112
112
 
113
- private _caseProcess(str: string) {
114
- if (!this._caseSensitive) {
115
- str = str.toLowerCase(); // Convert str to lowercase if case-insensitive
116
- }
117
- return str;
118
- }
119
-
120
113
  /**
121
114
  * Remove a word from the Trie structure.
122
115
  * @param{string} word - The word to delete.
@@ -282,5 +275,12 @@ export class Trie {
282
275
  return words;
283
276
  }
284
277
 
278
+ private _caseProcess(str: string) {
279
+ if (!this._caseSensitive) {
280
+ str = str.toLowerCase(); // Convert str to lowercase if case-insensitive
281
+ }
282
+ return str;
283
+ }
284
+
285
285
  // --- end additional methods ---
286
286
  }
package/src/index.ts CHANGED
@@ -6,6 +6,6 @@
6
6
  * @license MIT License
7
7
  */
8
8
  // export { Heap, MaxHeap, MinHeap } from 'data-structure-typed';
9
- export * from 'data-structure-typed/src/data-structures/heap';
10
- export * from 'data-structure-typed/src/types/data-structures/heap';
11
- export * from 'data-structure-typed/src/types/helpers';
9
+ export * from './data-structures/heap';
10
+ export * from './types/data-structures/heap';
11
+ export * from './types/helpers';
@@ -1,6 +1,6 @@
1
1
  export type Direction = 'up' | 'right' | 'down' | 'left';
2
2
 
3
- export type Turning = {[key in Direction]: Direction};
3
+ export type Turning = { [key in Direction]: Direction };
4
4
 
5
5
  export type NavigatorParams<T = any> = {
6
6
  matrix: T[][];
@@ -6,4 +6,8 @@ export type MapCallback<N> = (node: N) => any;
6
6
 
7
7
  export type MapCallbackReturn<N> = ReturnType<MapCallback<N>>;
8
8
 
9
- export enum CP {lt = 'lt', eq = 'eq', gt = 'gt'}
9
+ export enum CP {
10
+ lt = 'lt',
11
+ eq = 'eq',
12
+ gt = 'gt'
13
+ }
@@ -1,5 +1,5 @@
1
1
  export type ToThunkFn = () => ReturnType<TrlFn>;
2
- export type Thunk = () => ReturnType<ToThunkFn> & {__THUNK__: symbol};
2
+ export type Thunk = () => ReturnType<ToThunkFn> & { __THUNK__: symbol };
3
3
  export type TrlFn = (...args: any[]) => any;
4
4
  export type TrlAsyncFn = (...args: any[]) => any;
5
5
 
@@ -1,6 +1,6 @@
1
- export type KeyValueObject = {[key: string]: any};
1
+ export type KeyValueObject = { [key: string]: any };
2
2
 
3
- export type KeyValueObjectWithKey = {[key: string]: any; key: string | number | symbol};
3
+ export type KeyValueObjectWithKey = { [key: string]: any; key: string | number | symbol };
4
4
 
5
5
  export type NonNumberNonObjectButDefined = string | boolean | symbol | null;
6
6