data-structure-typed 1.15.1 → 1.15.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 (41) hide show
  1. package/README.md +378 -7
  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 +14 -14
  14. package/dist/data-structures/heap/heap.js +12 -12
  15. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +9 -9
  16. package/dist/data-structures/linked-list/doubly-linked-list.js +12 -12
  17. package/dist/data-structures/linked-list/singly-linked-list.d.ts +7 -7
  18. package/dist/data-structures/priority-queue/priority-queue.d.ts +7 -7
  19. package/dist/data-structures/priority-queue/priority-queue.js +6 -6
  20. package/dist/data-structures/queue/deque.d.ts +1 -1
  21. package/dist/utils/types/utils.d.ts +0 -3
  22. package/dist/utils/types/utils.js +0 -14
  23. package/dist/utils/utils.js +0 -197
  24. package/package.json +2 -4
  25. package/src/assets/overview-diagram-of-data-structures.png +0 -0
  26. package/src/data-structures/binary-tree/binary-tree.ts +83 -76
  27. package/src/data-structures/binary-tree/segment-tree.ts +55 -36
  28. package/src/data-structures/graph/abstract-graph.ts +21 -19
  29. package/src/data-structures/graph/directed-graph.ts +23 -18
  30. package/src/data-structures/graph/undirected-graph.ts +16 -11
  31. package/src/data-structures/hash/coordinate-map.ts +11 -8
  32. package/src/data-structures/hash/coordinate-set.ts +11 -8
  33. package/src/data-structures/heap/heap.ts +34 -28
  34. package/src/data-structures/linked-list/doubly-linked-list.ts +40 -26
  35. package/src/data-structures/linked-list/singly-linked-list.ts +32 -23
  36. package/src/data-structures/priority-queue/priority-queue.ts +17 -14
  37. package/src/data-structures/queue/deque.ts +14 -4
  38. package/src/utils/types/utils.ts +1 -173
  39. package/src/utils/utils.ts +0 -212
  40. package/tests/unit/data-structures/binary-tree/bst.test.ts +40 -31
  41. package/tests/unit/data-structures/graph/directed-graph.test.ts +31 -34
@@ -6,24 +6,27 @@
6
6
  * @license MIT License
7
7
  */
8
8
  export class CoordinateSet extends Set {
9
+ constructor(joint?: string) {
10
+ super();
11
+ if (joint !== undefined) this._joint = joint;
12
+ }
13
+
9
14
  protected _joint: string = '_';
15
+
10
16
  get joint(): string {
11
17
  return this._joint;
12
18
  }
19
+
20
+ protected set joint(v: string) {
21
+ this._joint = v;
22
+ }
23
+
13
24
  /**
14
25
  * 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.
15
26
  */
16
27
  getJoint(): string {
17
28
  return this._joint;
18
29
  }
19
- protected set joint(v: string) {
20
- this._joint = v;
21
- }
22
-
23
- constructor(joint?: string) {
24
- super();
25
- if (joint !== undefined) this._joint = joint;
26
- }
27
30
 
28
31
  /**
29
32
  * The "has" function overrides the "has" method of the superclass and checks if a value exists in an array after
@@ -9,34 +9,6 @@ import {PriorityQueue} from '../priority-queue';
9
9
  import type {HeapItem, HeapOptions} from '../types';
10
10
 
11
11
  export abstract class Heap<T> {
12
- protected abstract _pq: PriorityQueue<HeapItem<T>>;
13
- get pq() {
14
- return this._pq;
15
- }
16
- /**
17
- * 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.
18
- */
19
- getPq() {
20
- return this._pq;
21
- }
22
- protected set pq(v: PriorityQueue<HeapItem<T>>) {
23
- this._pq = v;
24
- }
25
-
26
- protected _priorityCb: (element: T) => number;
27
- get priorityCb() {
28
- return this._priorityCb;
29
- }
30
- /**
31
- * 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.
32
- */
33
- getPriorityCb() {
34
- return this._priorityCb;
35
- }
36
- protected set priorityCb(v: (element: T) => number) {
37
- this._priorityCb = v;
38
- }
39
-
40
12
  /**
41
13
  * The function is a constructor for a class that initializes a priority callback function based on the
42
14
  * options provided.
@@ -54,6 +26,25 @@ export abstract class Heap<T> {
54
26
  }
55
27
  }
56
28
 
29
+ protected abstract _pq: PriorityQueue<HeapItem<T>>;
30
+
31
+ get pq() {
32
+ return this._pq;
33
+ }
34
+
35
+ protected set pq(v: PriorityQueue<HeapItem<T>>) {
36
+ this._pq = v;
37
+ }
38
+
39
+ protected _priorityCb: (element: T) => number;
40
+ get priorityCb() {
41
+ return this._priorityCb;
42
+ }
43
+
44
+ protected set priorityCb(v: (element: T) => number) {
45
+ this._priorityCb = v;
46
+ }
47
+
57
48
  /**
58
49
  * The function returns the size of a priority queue.
59
50
  * @returns The size of the priority queue.
@@ -61,6 +52,21 @@ export abstract class Heap<T> {
61
52
  get size(): number {
62
53
  return this._pq.size;
63
54
  }
55
+
56
+ /**
57
+ * 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.
58
+ */
59
+ getPq() {
60
+ return this._pq;
61
+ }
62
+
63
+ /**
64
+ * 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.
65
+ */
66
+ getPriorityCb() {
67
+ return this._priorityCb;
68
+ }
69
+
64
70
  /**
65
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.
66
72
  */
@@ -8,48 +8,56 @@
8
8
  import type {DoublyLinkedListGetBy} from '../types';
9
9
 
10
10
  export class DoublyLinkedListNode<T> {
11
+ constructor(nodeValue: T) {
12
+ this._val = nodeValue;
13
+ this._next = null;
14
+ this._prev = null;
15
+ }
16
+
11
17
  protected _val: T;
18
+
12
19
  get val(): T {
13
20
  return this._val;
14
21
  }
22
+
15
23
  set val(v: T) {
16
24
  this._val = v;
17
25
  }
18
26
 
19
27
  protected _next: DoublyLinkedListNode<T> | null;
28
+
20
29
  get next(): DoublyLinkedListNode<T> | null {
21
30
  return this._next;
22
31
  }
32
+
23
33
  set next(v: DoublyLinkedListNode<T> | null) {
24
34
  this._next = v;
25
35
  }
26
36
 
27
37
  protected _prev: DoublyLinkedListNode<T> | null;
38
+
28
39
  get prev(): DoublyLinkedListNode<T> | null {
29
40
  return this._prev;
30
41
  }
42
+
31
43
  set prev(v: DoublyLinkedListNode<T> | null) {
32
44
  this._prev = v;
33
45
  }
34
-
35
- constructor(nodeValue: T) {
36
- this._val = nodeValue;
37
- this._next = null;
38
- this._prev = null;
39
- }
40
46
  }
41
47
 
42
48
  export class DoublyLinkedList<T> {
49
+ constructor() {
50
+ this._first = null;
51
+ this._last = null;
52
+ this._size = 0;
53
+ }
54
+
43
55
  protected _first: DoublyLinkedListNode<T> | null;
56
+
44
57
  get first(): DoublyLinkedListNode<T> | null {
45
58
  return this._first;
46
59
  }
47
- /**
48
- * 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.
49
- */
50
- getFirst(): DoublyLinkedListNode<T> | null {
51
- return this._first;
52
- }
60
+
53
61
  protected set first(v: DoublyLinkedListNode<T> | null) {
54
62
  this._first = v;
55
63
  }
@@ -58,34 +66,40 @@ export class DoublyLinkedList<T> {
58
66
  get last(): DoublyLinkedListNode<T> | null {
59
67
  return this._last;
60
68
  }
61
- /**
62
- * 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.
63
- */
64
- getLast(): DoublyLinkedListNode<T> | null {
65
- return this._last;
66
- }
69
+
67
70
  protected set last(v: DoublyLinkedListNode<T> | null) {
68
71
  this._last = v;
69
72
  }
70
73
 
71
74
  protected _size: number;
75
+
72
76
  get size(): number {
73
77
  return this._size;
74
78
  }
79
+
80
+ protected set size(v: number) {
81
+ this._size = v;
82
+ }
83
+
75
84
  /**
76
85
  * 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.
77
86
  */
78
- getSize(): number {
79
- return this._size;
87
+ getFirst(): DoublyLinkedListNode<T> | null {
88
+ return this._first;
80
89
  }
81
- protected set size(v: number) {
82
- this._size = v;
90
+
91
+ /**
92
+ * 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.
93
+ */
94
+ getLast(): DoublyLinkedListNode<T> | null {
95
+ return this._last;
83
96
  }
84
97
 
85
- constructor() {
86
- this._first = null;
87
- this._last = null;
88
- this._size = 0;
98
+ /**
99
+ * 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.
100
+ */
101
+ getSize(): number {
102
+ return this._size;
89
103
  }
90
104
 
91
105
  /**
@@ -10,7 +10,15 @@
10
10
  /* The SinglyLinkedListNode class represents a node in a singly linked list and provides methods for inserting, removing,
11
11
  and accessing nodes. */
12
12
  export class SinglyLinkedListNode<NodeVal = any> {
13
+ constructor(val: NodeVal, prev?: SinglyLinkedListNode<NodeVal> | null, next?: SinglyLinkedListNode<NodeVal> | null, list?: SinglyLinkedList<NodeVal> | null) {
14
+ this._val = val;
15
+ this._prev = prev || null;
16
+ this._next = next || null;
17
+ this._list = list || null;
18
+ }
19
+
13
20
  protected _val: NodeVal;
21
+
14
22
  get val(): NodeVal {
15
23
  return this._val;
16
24
  }
@@ -20,6 +28,7 @@ export class SinglyLinkedListNode<NodeVal = any> {
20
28
  }
21
29
 
22
30
  protected _prev: SinglyLinkedListNode<NodeVal> | null;
31
+
23
32
  get prev(): SinglyLinkedListNode<NodeVal> | null {
24
33
  return this._prev;
25
34
  }
@@ -29,6 +38,7 @@ export class SinglyLinkedListNode<NodeVal = any> {
29
38
  }
30
39
 
31
40
  protected _next: SinglyLinkedListNode<NodeVal> | null
41
+
32
42
  get next(): SinglyLinkedListNode<NodeVal> | null {
33
43
  return this._next;
34
44
  }
@@ -38,6 +48,7 @@ export class SinglyLinkedListNode<NodeVal = any> {
38
48
  }
39
49
 
40
50
  protected _list: SinglyLinkedList<NodeVal> | null
51
+
41
52
  get list(): SinglyLinkedList<NodeVal> | null {
42
53
  return this._list;
43
54
  }
@@ -46,13 +57,6 @@ export class SinglyLinkedListNode<NodeVal = any> {
46
57
  this._list = value;
47
58
  }
48
59
 
49
- constructor(val: NodeVal, prev?: SinglyLinkedListNode<NodeVal> | null, next?: SinglyLinkedListNode<NodeVal> | null, list?: SinglyLinkedList<NodeVal> | null) {
50
- this._val = val;
51
- this._prev = prev || null;
52
- this._next = next || null;
53
- this._list = list || null;
54
- }
55
-
56
60
  get index() {
57
61
  if (!this.list) {
58
62
  return undefined;
@@ -97,46 +101,51 @@ export class SinglyLinkedListNode<NodeVal = any> {
97
101
 
98
102
  export class SinglyLinkedList<NodeVal = any> {
99
103
 
104
+ /**
105
+ * The constructor initializes a linked list with the given arguments as nodes.
106
+ * @param {NodeVal[]} args - args is a rest parameter that allows the constructor to accept an arbitrary number of
107
+ * arguments of type NodeVal.
108
+ */
109
+ constructor(...args: NodeVal[]) {
110
+ this._head = null;
111
+ this._tail = null;
112
+ this._size = 0;
113
+
114
+ for (let i = 0; i < arguments.length; i++) {
115
+ this.append(args[i]);
116
+ }
117
+ }
118
+
100
119
  protected _head: SinglyLinkedListNode<NodeVal> | null;
120
+
101
121
  get head(): SinglyLinkedListNode<NodeVal> | null {
102
122
  return this._head;
103
123
  }
124
+
104
125
  set head(value: SinglyLinkedListNode<NodeVal> | null) {
105
126
  this._head = value;
106
127
  }
107
128
 
108
-
109
129
  protected _tail: SinglyLinkedListNode<NodeVal> | null;
130
+
110
131
  get tail(): SinglyLinkedListNode<NodeVal> | null {
111
132
  return this._tail;
112
133
  }
134
+
113
135
  set tail(value: SinglyLinkedListNode<NodeVal> | null) {
114
136
  this._tail = value;
115
137
  }
116
138
 
117
139
  protected _size: number;
140
+
118
141
  get size(): number {
119
142
  return this._size;
120
143
  }
144
+
121
145
  set size(value: number) {
122
146
  this._size = value;
123
147
  }
124
148
 
125
- /**
126
- * The constructor initializes a linked list with the given arguments as nodes.
127
- * @param {NodeVal[]} args - args is a rest parameter that allows the constructor to accept an arbitrary number of
128
- * arguments of type NodeVal.
129
- */
130
- constructor(...args: NodeVal[]) {
131
- this._head = null;
132
- this._tail = null;
133
- this._size = 0;
134
-
135
- for (let i = 0; i < arguments.length; i++) {
136
- this.append(args[i]);
137
- }
138
- }
139
-
140
149
  /**
141
150
  * The `from` function in TypeScript creates a new SinglyLinkedList instance from an iterable object.
142
151
  * @param iterable - The `iterable` parameter is an object that can be iterated over, such as an array or a string. It
@@ -9,20 +9,6 @@ import type {PriorityQueueComparator, PriorityQueueDFSOrderPattern, PriorityQueu
9
9
 
10
10
  export class PriorityQueue<T = number> {
11
11
 
12
- protected _nodes: T[] = [];
13
- get nodes(): T[] {
14
- return this._nodes;
15
- }
16
- /**
17
- * 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.
18
- */
19
- getNodes(): T[] {
20
- return this._nodes;
21
- }
22
- protected set nodes(value: T[]) {
23
- this._nodes = value;
24
- }
25
-
26
12
  /**
27
13
  * The constructor initializes a priority queue with the given options, including an array of nodes and a comparator
28
14
  * function.
@@ -39,6 +25,16 @@ export class PriorityQueue<T = number> {
39
25
  }
40
26
  }
41
27
 
28
+ protected _nodes: T[] = [];
29
+
30
+ get nodes(): T[] {
31
+ return this._nodes;
32
+ }
33
+
34
+ protected set nodes(value: T[]) {
35
+ this._nodes = value;
36
+ }
37
+
42
38
  get size(): number {
43
39
  return this.nodes.length;
44
40
  }
@@ -67,6 +63,13 @@ export class PriorityQueue<T = number> {
67
63
  return new PriorityQueue({...options, isFix: true}).isValid();
68
64
  }
69
65
 
66
+ /**
67
+ * 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.
68
+ */
69
+ getNodes(): T[] {
70
+ return this._nodes;
71
+ }
72
+
70
73
  /**
71
74
  * The "add" function adds a node to the heap and ensures that the heap property is maintained.
72
75
  * @param {T} node - The parameter "node" is of type T, which means it can be any data type. It represents the node
@@ -17,50 +17,60 @@ export class Deque<T> extends DoublyLinkedList<T> {
17
17
  // O(n) time complexity of adding at the beginning and the end
18
18
  // todo tested slowest one
19
19
  export class ObjectDeque<T> {
20
+ constructor(capacity?: number) {
21
+ if (capacity !== undefined) this._capacity = capacity;
22
+ }
23
+
20
24
  private _nodes: { [key: number]: T } = {};
25
+
21
26
  get nodes(): { [p: number]: T } {
22
27
  return this._nodes;
23
28
  }
29
+
24
30
  protected set nodes(value: { [p: number]: T }) {
25
31
  this._nodes = value;
26
32
  }
27
33
 
28
34
  private _capacity = Number.MAX_SAFE_INTEGER;
35
+
29
36
  get capacity(): number {
30
37
  return this._capacity;
31
38
  }
39
+
32
40
  set capacity(value: number) {
33
41
  this._capacity = value;
34
42
  }
35
43
 
36
44
  private _first: number = -1;
45
+
37
46
  get first(): number {
38
47
  return this._first;
39
48
  }
49
+
40
50
  set first(value: number) {
41
51
  this._first = value;
42
52
  }
43
53
 
44
54
  private _last: number = -1;
55
+
45
56
  get last(): number {
46
57
  return this._last;
47
58
  }
59
+
48
60
  set last(value: number) {
49
61
  this._last = value;
50
62
  }
51
63
 
52
64
  private _size: number = 0;
65
+
53
66
  get size(): number {
54
67
  return this._size;
55
68
  }
69
+
56
70
  protected set size(value: number) {
57
71
  this._size = value;
58
72
  }
59
73
 
60
- constructor(capacity?: number) {
61
- if (capacity !== undefined) this._capacity = capacity;
62
- }
63
-
64
74
  addFirst(value: T) {
65
75
  if (this._size === 0) {
66
76
  const mid = Math.floor(this._capacity / 2);
@@ -1,176 +1,4 @@
1
- // export type JSONSerializable = {
2
- // [key: string]: any
3
- // }
4
-
5
- // export type JSONValue = string | number | boolean | undefined | JSONObject;
6
- //
7
- // export interface JSONObject {
8
- // [key: string]: JSONValue;
9
- // }
10
- //
11
- // export type AnyFunction<A extends any[] = any[], R = any> = (...args: A) => R;
12
-
13
- // export type Primitive =
14
- // | number
15
- // | string
16
- // | boolean
17
- // | symbol
18
- // | undefined
19
- // | null
20
- // | void
21
- // | AnyFunction
22
- // | Date;
23
-
24
- // export type Cast<T, TComplex> = { [M in keyof TComplex]: T };
25
-
26
- // export type DeepLeavesWrap<T, TComplex> =
27
- // T extends string ? Cast<string, TComplex>
28
- // : T extends number ? Cast<number, TComplex>
29
- // : T extends boolean ? Cast<boolean, TComplex>
30
- // : T extends undefined ? Cast<undefined, TComplex>
31
- // : T extends null ? Cast<null, TComplex>
32
- // : T extends void ? Cast<void, TComplex>
33
- // : T extends symbol ? Cast<symbol, TComplex>
34
- // : T extends AnyFunction ? Cast<AnyFunction, TComplex>
35
- // : T extends Date ? Cast<Date, TComplex>
36
- // : {
37
- // [K in keyof T]:
38
- // T[K] extends (infer U)[] ? DeepLeavesWrap<U, TComplex>[]
39
- // : DeepLeavesWrap<T[K], TComplex>;
40
- // }
41
-
42
-
43
- // type Json = null | string | number | boolean | Json [] | { [name: string]: Json }
44
-
45
- // export type TypeName<T> = T extends string
46
- // ? 'string'
47
- // : T extends number
48
- // ? 'number'
49
- // : T extends boolean
50
- // ? 'boolean'
51
- // : T extends undefined
52
- // ? 'undefined'
53
- // : T extends AnyFunction
54
- // ? 'function'
55
- // : 'object';
56
-
57
- // export type JsonKeys<T> = keyof {
58
- // [P in keyof T]: number
59
- // }
60
-
61
- /**
62
- * A function that emits a side effect and does not return anything.
63
- */
64
- // export type Procedure = (...args: any[]) => void;
65
-
66
- // export type DebounceOptions = {
67
- // isImmediate?: boolean;
68
- // maxWait?: number;
69
- // };
70
-
71
- // export interface DebouncedFunction<F extends Procedure> {
72
- // cancel: () => void;
73
- //
74
- // (this: ThisParameterType<F>, ...args: [...Parameters<F>]): void;
75
- // }
76
-
77
- // export type MonthKey =
78
- // 'January' |
79
- // 'February' |
80
- // 'March' |
81
- // 'April' |
82
- // 'May' |
83
- // 'June' |
84
- // 'July' |
85
- // 'August' |
86
- // 'September' |
87
- // 'October' |
88
- // 'November' |
89
- // 'December';
90
-
91
- // export type Month = { [key in MonthKey]: string }
92
-
93
- // export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
94
-
95
- // export class TreeNode<T> {
96
- // id: string;
97
- // name?: string | undefined;
98
- // value?: T | undefined;
99
- // children?: TreeNode<T>[] | undefined;
100
- //
101
- // constructor(id: string, name?: string, value?: T, children?: TreeNode<T>[]) {
102
- // this.id = id;
103
- // this.name = name || '';
104
- // this.value = value || undefined;
105
- // this.children = children || [];
106
- // }
107
- //
108
- // addChildren(children: TreeNode<T> | TreeNode<T> []) {
109
- // if (!this.children) {
110
- // this.children = [];
111
- // }
112
- // if (children instanceof TreeNode) {
113
- // this.children.push(children);
114
- // } else {
115
- // this.children = this.children.concat(children);
116
- // }
117
- // }
118
- //
119
- // getHeight() {
120
- // // eslint-disable-next-line @typescript-eslint/no-this-alias
121
- // const beginRoot = this;
122
- // let maxDepth = 1;
123
- // if (beginRoot) {
124
- // const bfs = (node: TreeNode<T>, level: number) => {
125
- // if (level > maxDepth) {
126
- // maxDepth = level;
127
- // }
128
- // const {children} = node;
129
- // if (children) {
130
- // for (let i = 0, len = children.length; i < len; i++) {
131
- // bfs(children[i], level + 1);
132
- // }
133
- // }
134
- // };
135
- // bfs(beginRoot, 1);
136
- // }
137
- // return maxDepth;
138
- // }
139
- //
140
- // }
141
-
142
- // export type OrderType = 'InOrder' | 'PreOrder' | 'PostOrder'
143
-
144
- // export type DeepProxy<T> = T extends (...args: any[]) => infer R
145
- // ? (...args: [...Parameters<T>]) => DeepProxy<R>
146
- // : T extends object
147
- // ? { [K in keyof T]: DeepProxy<T[K]> }
148
- // : T;
149
-
150
- // export type DeepProxyOnChange = (target: any, property: string | symbol, value: any, receiver: any, descriptor: any, result: any) => void;
151
-
152
- // export type DeepProxyOnGet = (target: any, property: string | symbol, value: any, receiver: any, descriptor: any, result: any) => void;
153
-
154
- // export type CurryFunc<T> = T extends (...args: infer Args) => infer R
155
- // ? Args extends [infer Arg, ...infer RestArgs]
156
- // ? (arg: Arg) => CurryFunc<(...args: RestArgs) => R>
157
- // : R
158
- // : T;
159
-
160
-
161
1
  export type ToThunkFn = () => ReturnType<TrlFn>;
162
2
  export type Thunk = () => ReturnType<ToThunkFn> & { __THUNK__: Symbol };
163
3
  export type TrlFn = (...args: any[]) => any;
164
- export type TrlAsyncFn = (...args: any[]) => any;
165
-
166
- // export type CaseType =
167
- // 'camel'
168
- // | 'snake'
169
- // | 'pascal'
170
- // | 'constant'
171
- // | 'kebab'
172
- // | 'lower'
173
- // | 'title'
174
- // | 'sentence'
175
- // | 'path'
176
- // | 'dot';
4
+ export type TrlAsyncFn = (...args: any[]) => any;