semantic-typescript 0.6.0 → 0.7.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/dist/asynchronous/collector.d.ts +62 -58
- package/dist/asynchronous/collector.js +16 -5
- package/dist/asynchronous/semantic.d.ts +2 -2
- package/dist/asynchronous/semantic.js +16 -6
- package/dist/factory.d.ts +8 -0
- package/dist/factory.js +112 -36
- package/dist/hook.d.ts +6 -1
- package/dist/hook.js +20 -3
- package/dist/main.d.ts +1 -0
- package/dist/main.js +6 -0
- package/dist/synchronous/collector.d.ts +8 -4
- package/dist/synchronous/collector.js +74 -59
- package/dist/synchronous/semantic.d.ts +27 -23
- package/dist/synchronous/semantic.js +215 -286
- package/package.json +3 -2
- package/readme.cn.md +213 -214
- package/readme.de.md +172 -173
- package/readme.es.md +177 -172
- package/readme.fr.md +181 -172
- package/readme.jp.md +187 -169
- package/readme.kr.md +182 -169
- package/readme.md +213 -214
- package/readme.ru.md +188 -169
- package/readme.tw.md +178 -169
|
@@ -13,6 +13,10 @@ export declare class AsynchronousCollector<E, A, R> {
|
|
|
13
13
|
collect(iterable: AsyncIterable<E>): Promise<R>;
|
|
14
14
|
collect(start: number, end: number): Promise<R>;
|
|
15
15
|
collect(start: bigint, end: bigint): Promise<R>;
|
|
16
|
+
getIdentity(): Supplier<A>;
|
|
17
|
+
getInterrupt(): Predicate<E> | BiPredicate<E, bigint> | TriPredicate<E, bigint, A>;
|
|
18
|
+
getAccumulator(): BiFunctional<A, E, A> | TriFunctional<A, E, bigint, A>;
|
|
19
|
+
getFinisher(): Functional<A, R>;
|
|
16
20
|
static full<E, A, R>(identity: Supplier<A>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): AsynchronousCollector<E, A, R>;
|
|
17
21
|
static full<E, A, R>(identity: Supplier<A>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): AsynchronousCollector<E, A, R>;
|
|
18
22
|
static shortable<E, A, R>(identity: Supplier<A>, interrupt: Predicate<E>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): AsynchronousCollector<E, A, R>;
|
|
@@ -22,17 +26,17 @@ export declare class AsynchronousCollector<E, A, R> {
|
|
|
22
26
|
static shortable<E, A, R>(identity: Supplier<A>, interrupt: TriPredicate<E, bigint, A>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): AsynchronousCollector<E, A, R>;
|
|
23
27
|
static shortable<E, A, R>(identity: Supplier<A>, interrupt: TriPredicate<E, bigint, A>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): AsynchronousCollector<E, A, R>;
|
|
24
28
|
}
|
|
25
|
-
interface
|
|
29
|
+
interface UseAsynchronousAnyMatch {
|
|
26
30
|
<E>(predicate: Predicate<E>): AsynchronousCollector<E, boolean, boolean>;
|
|
27
31
|
<E>(predicate: BiPredicate<E, bigint>): AsynchronousCollector<E, boolean, boolean>;
|
|
28
32
|
}
|
|
29
|
-
export declare let useAsynchronousAnyMatch:
|
|
30
|
-
interface
|
|
33
|
+
export declare let useAsynchronousAnyMatch: UseAsynchronousAnyMatch;
|
|
34
|
+
interface UseAsynchronousAllMatch {
|
|
31
35
|
<E>(predicate: Predicate<E>): AsynchronousCollector<E, boolean, boolean>;
|
|
32
36
|
<E>(predicate: BiPredicate<E, bigint>): AsynchronousCollector<E, boolean, boolean>;
|
|
33
37
|
}
|
|
34
|
-
export declare let useAsynchronousAllMatch:
|
|
35
|
-
interface
|
|
38
|
+
export declare let useAsynchronousAllMatch: UseAsynchronousAllMatch;
|
|
39
|
+
interface UseAsynchronousCollect {
|
|
36
40
|
<E, A, R>(identity: Supplier<A>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): AsynchronousCollector<E, A, R>;
|
|
37
41
|
<E, A, R>(identity: Supplier<A>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): AsynchronousCollector<E, A, R>;
|
|
38
42
|
<E, A, R>(identity: Supplier<A>, accumulator: BiFunctional<A, E, A> | TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): AsynchronousCollector<E, A, R>;
|
|
@@ -43,78 +47,78 @@ interface UseSynchronousCollect {
|
|
|
43
47
|
<E, A, R>(identity: Supplier<A>, interrupt: TriPredicate<E, bigint, A>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): AsynchronousCollector<E, A, R>;
|
|
44
48
|
<E, A, R>(identity: Supplier<A>, interrupt: TriPredicate<E, bigint, A>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): AsynchronousCollector<E, A, R>;
|
|
45
49
|
}
|
|
46
|
-
export declare let useAsynchronousCollect:
|
|
50
|
+
export declare let useAsynchronousCollect: UseAsynchronousCollect;
|
|
47
51
|
export declare let useAsynchronousCount: <E = unknown>() => AsynchronousCollector<E, bigint, bigint>;
|
|
48
|
-
interface
|
|
52
|
+
interface UseAsynchronousError {
|
|
49
53
|
<E = unknown>(): AsynchronousCollector<E, string, string>;
|
|
50
54
|
<E = unknown>(accumulator: BiFunctional<string, E, string>): AsynchronousCollector<E, string, string>;
|
|
51
55
|
<E = unknown>(accumulator: TriFunctional<string, E, bigint, string>): AsynchronousCollector<E, string, string>;
|
|
52
56
|
<E = unknown>(prefix: string, accumulator: BiFunctional<string, E, string>, suffix: string): AsynchronousCollector<E, string, string>;
|
|
53
57
|
<E = unknown>(prefix: string, accumulator: TriFunctional<string, E, bigint, string>, suffix: string): AsynchronousCollector<E, string, string>;
|
|
54
58
|
}
|
|
55
|
-
export declare let useAsynchronousError:
|
|
56
|
-
interface
|
|
59
|
+
export declare let useAsynchronousError: UseAsynchronousError;
|
|
60
|
+
interface UseAsynchronousFindAt {
|
|
57
61
|
<E>(index: number): AsynchronousCollector<E, Array<E>, Promise<E>>;
|
|
58
62
|
<E>(index: bigint): AsynchronousCollector<E, Array<E>, Promise<E>>;
|
|
59
63
|
}
|
|
60
|
-
export declare let useAsynchronousFindAt:
|
|
64
|
+
export declare let useAsynchronousFindAt: UseAsynchronousFindAt;
|
|
61
65
|
export declare let useAsynchronousFindFirst: <E>() => AsynchronousCollector<E, Array<E>, Promise<E>>;
|
|
62
66
|
export declare let useAsynchronousFindAny: <E>() => AsynchronousCollector<E, Array<E>, Promise<E>>;
|
|
63
67
|
export declare let useAsynchronousFindLast: <E>() => AsynchronousCollector<E, Array<E>, Promise<E>>;
|
|
64
|
-
interface
|
|
68
|
+
interface UseAsynchronousFindMaximum {
|
|
65
69
|
<E>(): AsynchronousCollector<E, Promise<E>, Promise<E>>;
|
|
66
70
|
<E>(comparator: Comparator<E>): AsynchronousCollector<E, Promise<E>, Promise<E>>;
|
|
67
71
|
}
|
|
68
|
-
export declare let useAsynchronousFindMaximum:
|
|
69
|
-
interface
|
|
72
|
+
export declare let useAsynchronousFindMaximum: UseAsynchronousFindMaximum;
|
|
73
|
+
interface UseAsynchronousFindMinimum {
|
|
70
74
|
<E>(): AsynchronousCollector<E, Promise<E>, Promise<E>>;
|
|
71
75
|
<E>(comparator: Comparator<E>): AsynchronousCollector<E, Promise<E>, Promise<E>>;
|
|
72
76
|
}
|
|
73
|
-
export declare let useAsynchronousFindMinimum:
|
|
74
|
-
interface
|
|
77
|
+
export declare let useAsynchronousFindMinimum: UseAsynchronousFindMinimum;
|
|
78
|
+
interface UseAsynchronousForEach {
|
|
75
79
|
<E>(action: Consumer<E>): AsynchronousCollector<E, bigint, bigint>;
|
|
76
80
|
<E>(action: BiConsumer<E, bigint>): AsynchronousCollector<E, bigint, bigint>;
|
|
77
81
|
}
|
|
78
|
-
export declare let useAsynchronousForEach:
|
|
79
|
-
interface
|
|
82
|
+
export declare let useAsynchronousForEach: UseAsynchronousForEach;
|
|
83
|
+
interface UseAsynchronousNonMatch {
|
|
80
84
|
<E>(predicate: Predicate<E>): AsynchronousCollector<E, boolean, boolean>;
|
|
81
85
|
<E>(predicate: BiPredicate<E, bigint>): AsynchronousCollector<E, boolean, boolean>;
|
|
82
86
|
}
|
|
83
|
-
export declare let useAsynchronousNoneMatch:
|
|
84
|
-
interface
|
|
87
|
+
export declare let useAsynchronousNoneMatch: UseAsynchronousNonMatch;
|
|
88
|
+
interface UseAsynchronousGroup {
|
|
85
89
|
<E, K>(classifier: Functional<E, K>): AsynchronousCollector<E, Map<K, E[]>, Map<K, E[]>>;
|
|
86
90
|
<E, K>(classifier: BiFunctional<E, bigint, K>): AsynchronousCollector<E, Map<K, E[]>, Map<K, E[]>>;
|
|
87
91
|
}
|
|
88
|
-
export declare let useAsynchronousGroup:
|
|
89
|
-
interface
|
|
92
|
+
export declare let useAsynchronousGroup: UseAsynchronousGroup;
|
|
93
|
+
interface UseAsynchronousGroupBy {
|
|
90
94
|
<E, K>(keyExtractor: Functional<E, K>): AsynchronousCollector<E, Map<K, E[]>, Map<K, E[]>>;
|
|
91
95
|
<E, K, V>(keyExtractor: Functional<E, K>, valueExtractor: Functional<E, V>): AsynchronousCollector<E, Map<K, V[]>, Map<K, V[]>>;
|
|
92
96
|
<E, K, V>(keyExtractor: BiFunctional<E, bigint, K>, valueExtractor: BiFunctional<E, bigint, V>): AsynchronousCollector<E, Map<K, V[]>, Map<K, V[]>>;
|
|
93
97
|
}
|
|
94
|
-
export declare let useAsynchronousGroupBy:
|
|
95
|
-
interface
|
|
98
|
+
export declare let useAsynchronousGroupBy: UseAsynchronousGroupBy;
|
|
99
|
+
interface UseAsynchronousJoin {
|
|
96
100
|
<E = unknown>(): AsynchronousCollector<E, string, string>;
|
|
97
101
|
<E = unknown>(delimiter: string): AsynchronousCollector<E, string, string>;
|
|
98
102
|
<E = unknown>(prefix: string, delimiter: string, suffix: string): AsynchronousCollector<E, string, string>;
|
|
99
103
|
<E = unknown>(prefiex: string, accumulator: BiFunctional<string, E, string>, suffix: string): AsynchronousCollector<E, string, string>;
|
|
100
104
|
<E = unknown>(prefiex: string, accumulator: TriFunctional<string, E, bigint, string>, suffix: string): AsynchronousCollector<E, string, string>;
|
|
101
105
|
}
|
|
102
|
-
export declare let useAsynchronousJoin:
|
|
103
|
-
interface
|
|
106
|
+
export declare let useAsynchronousJoin: UseAsynchronousJoin;
|
|
107
|
+
interface UseAsynchronousLog {
|
|
104
108
|
<E = unknown>(): AsynchronousCollector<E, string, string>;
|
|
105
109
|
<E = unknown>(accumulator: BiFunctional<string, E, string>): AsynchronousCollector<E, string, string>;
|
|
106
110
|
<E = unknown>(accumulator: TriFunctional<string, E, bigint, string>): AsynchronousCollector<E, string, string>;
|
|
107
111
|
<E = unknown>(prefix: string, accumulator: BiFunctional<string, E, string>, suffix: string): AsynchronousCollector<E, string, string>;
|
|
108
112
|
<E = unknown>(prefix: string, accumulator: TriFunctional<string, E, bigint, string>, suffix: string): AsynchronousCollector<E, string, string>;
|
|
109
113
|
}
|
|
110
|
-
export declare let useAsynchronousLog:
|
|
114
|
+
export declare let useAsynchronousLog: UseAsynchronousLog;
|
|
111
115
|
export declare let useAsynchronousPartition: <E>(count: bigint) => AsynchronousCollector<E, Array<Array<E>>, Array<Array<E>>>;
|
|
112
|
-
interface
|
|
116
|
+
interface UseAsynchronousPartitionBy {
|
|
113
117
|
<E>(classifier: Functional<E, bigint>): AsynchronousCollector<E, Array<E[]>, Array<E[]>>;
|
|
114
118
|
<E>(classifier: BiFunctional<E, bigint, bigint>): AsynchronousCollector<E, Array<E[]>, Array<E[]>>;
|
|
115
119
|
}
|
|
116
|
-
export declare let useAsynchronousPartitionBy:
|
|
117
|
-
interface
|
|
120
|
+
export declare let useAsynchronousPartitionBy: UseAsynchronousPartitionBy;
|
|
121
|
+
interface UseAsynchronousReduce {
|
|
118
122
|
<E>(accumulator: BiFunctional<E, E, E>): AsynchronousCollector<E, Promise<E>, Promise<E>>;
|
|
119
123
|
<E>(accumulator: TriFunctional<E, E, bigint, E>): AsynchronousCollector<E, Promise<E>, Promise<E>>;
|
|
120
124
|
<E>(identity: E, accumulator: BiFunctional<E, E, E>): AsynchronousCollector<E, E, E>;
|
|
@@ -122,32 +126,32 @@ interface UseSynchronousReduce {
|
|
|
122
126
|
<E, R>(identity: R, accumulator: BiFunctional<R, E, R>, finisher: Functional<R, R>): AsynchronousCollector<E, R, R>;
|
|
123
127
|
<E, R>(identity: R, accumulator: TriFunctional<R, E, bigint, R>, finisher: Functional<R, R>): AsynchronousCollector<E, R, R>;
|
|
124
128
|
}
|
|
125
|
-
export declare let useAsynchronousReduce:
|
|
129
|
+
export declare let useAsynchronousReduce: UseAsynchronousReduce;
|
|
126
130
|
export declare let useAsynchronousToArray: <E>() => AsynchronousCollector<E, E[], E[]>;
|
|
127
|
-
interface
|
|
131
|
+
interface UseAsynchronousToMap {
|
|
128
132
|
<E, K>(keyExtractor: Functional<E, K>): AsynchronousCollector<E, Map<K, E>, Map<K, E>>;
|
|
129
133
|
<E, K, V>(keyExtractor: Functional<E, K>, valueExtractor: Functional<E, V>): AsynchronousCollector<E, Map<K, V>, Map<K, V>>;
|
|
130
134
|
<E, K, V>(keyExtractor: BiFunctional<E, bigint, K>, valueExtractor: BiFunctional<E, bigint, V>): AsynchronousCollector<E, Map<K, V>, Map<K, V>>;
|
|
131
135
|
}
|
|
132
|
-
export declare let useAsynchronousToMap:
|
|
136
|
+
export declare let useAsynchronousToMap: UseAsynchronousToMap;
|
|
133
137
|
export declare let useAsynchronousToSet: <E>() => AsynchronousCollector<E, Set<E>, Set<E>>;
|
|
134
|
-
interface
|
|
138
|
+
interface UseAsynchronousWrite {
|
|
135
139
|
<E, S = string>(stream: WritableStream<S>): AsynchronousCollector<E, Promise<WritableStream<S>>, Promise<WritableStream<S>>>;
|
|
136
140
|
<E, S = string>(stream: WritableStream<S>, accumulator: BiFunctional<WritableStream<S>, E, WritableStream<S>>): AsynchronousCollector<E, Promise<WritableStream<S>>, Promise<WritableStream<S>>>;
|
|
137
141
|
<E, S = string>(stream: WritableStream<S>, accumulator: TriFunctional<WritableStream<S>, E, bigint, WritableStream<S>>): AsynchronousCollector<E, Promise<WritableStream<S>>, Promise<WritableStream<S>>>;
|
|
138
142
|
}
|
|
139
|
-
export declare let useAsynchronousWrite:
|
|
140
|
-
interface
|
|
143
|
+
export declare let useAsynchronousWrite: UseAsynchronousWrite;
|
|
144
|
+
interface UseAsynchronousNumericSummate {
|
|
141
145
|
<E>(): AsynchronousCollector<E, number, number>;
|
|
142
146
|
<E>(mapper: Functional<E, number>): AsynchronousCollector<number, number, number>;
|
|
143
147
|
}
|
|
144
|
-
export declare let useAsynchronousNumericSummate:
|
|
145
|
-
interface
|
|
148
|
+
export declare let useAsynchronousNumericSummate: UseAsynchronousNumericSummate;
|
|
149
|
+
interface UseAsynchronousBigIntSummate {
|
|
146
150
|
<E>(): AsynchronousCollector<E, bigint, bigint>;
|
|
147
151
|
<E>(mapper: Functional<E, bigint>): AsynchronousCollector<bigint, bigint, bigint>;
|
|
148
152
|
}
|
|
149
|
-
export declare let useAsynchronousBigIntSummate:
|
|
150
|
-
interface
|
|
153
|
+
export declare let useAsynchronousBigIntSummate: UseAsynchronousBigIntSummate;
|
|
154
|
+
interface UseAsynchronousNumericAverage {
|
|
151
155
|
<E>(): AsynchronousCollector<E, NumericAverageAccumulator, number>;
|
|
152
156
|
<E>(mapper: Functional<E, number>): AsynchronousCollector<number, NumericAverageAccumulator, number>;
|
|
153
157
|
}
|
|
@@ -155,8 +159,8 @@ interface NumericAverageAccumulator {
|
|
|
155
159
|
summate: number;
|
|
156
160
|
count: number;
|
|
157
161
|
}
|
|
158
|
-
export declare let useAsynchronousNumericAverage:
|
|
159
|
-
interface
|
|
162
|
+
export declare let useAsynchronousNumericAverage: UseAsynchronousNumericAverage;
|
|
163
|
+
interface UseAsynchronousBigIntAverage {
|
|
160
164
|
<E>(): AsynchronousCollector<E, BigIntAverageAccumulator, bigint>;
|
|
161
165
|
<E>(mapper: Functional<E, bigint>): AsynchronousCollector<E, BigIntAverageAccumulator, bigint>;
|
|
162
166
|
}
|
|
@@ -164,19 +168,19 @@ interface BigIntAverageAccumulator {
|
|
|
164
168
|
summate: bigint;
|
|
165
169
|
count: bigint;
|
|
166
170
|
}
|
|
167
|
-
export declare let useAsynchronousBigIntAverage:
|
|
171
|
+
export declare let useAsynchronousBigIntAverage: UseAsynchronousBigIntAverage;
|
|
168
172
|
export declare let useAsynchronousFrequency: <E>() => AsynchronousCollector<E, Map<E, bigint>, Map<E, bigint>>;
|
|
169
|
-
interface
|
|
173
|
+
interface UseAsynchronousNumericMode {
|
|
170
174
|
<E>(): AsynchronousCollector<E, Map<number, bigint>, number>;
|
|
171
175
|
<E>(mapper: Functional<E, number>): AsynchronousCollector<E, Map<number, bigint>, number>;
|
|
172
176
|
}
|
|
173
|
-
export declare let useAsynchronousNumericMode:
|
|
174
|
-
interface
|
|
177
|
+
export declare let useAsynchronousNumericMode: UseAsynchronousNumericMode;
|
|
178
|
+
interface UseAsynchronousBigIntMode {
|
|
175
179
|
<E>(): AsynchronousCollector<E, Map<bigint, bigint>, bigint>;
|
|
176
180
|
<E>(mapper: Functional<E, bigint>): AsynchronousCollector<E, Map<bigint, bigint>, bigint>;
|
|
177
181
|
}
|
|
178
|
-
export declare let useAsynchronousBigIntMode:
|
|
179
|
-
interface
|
|
182
|
+
export declare let useAsynchronousBigIntMode: UseAsynchronousBigIntMode;
|
|
183
|
+
interface UseAsynchronousNumericVariance {
|
|
180
184
|
<E>(): AsynchronousCollector<E, VarianceAccumulator, number>;
|
|
181
185
|
<E>(mapper: Functional<E, number>): AsynchronousCollector<E, VarianceAccumulator, number>;
|
|
182
186
|
}
|
|
@@ -185,8 +189,8 @@ interface VarianceAccumulator {
|
|
|
185
189
|
summateOfSquares: number;
|
|
186
190
|
count: number;
|
|
187
191
|
}
|
|
188
|
-
export declare let useAsynchronousNumericVariance:
|
|
189
|
-
interface
|
|
192
|
+
export declare let useAsynchronousNumericVariance: UseAsynchronousNumericVariance;
|
|
193
|
+
interface UseAsynchronousBigIntVariance {
|
|
190
194
|
<E>(): AsynchronousCollector<E, BigIntVarianceAccumulator, bigint>;
|
|
191
195
|
<E>(mapper: Functional<E, bigint>): AsynchronousCollector<E, BigIntVarianceAccumulator, bigint>;
|
|
192
196
|
}
|
|
@@ -195,8 +199,8 @@ interface BigIntVarianceAccumulator {
|
|
|
195
199
|
summateOfSquares: bigint;
|
|
196
200
|
count: bigint;
|
|
197
201
|
}
|
|
198
|
-
export declare let useAsynchronousBigIntVariance:
|
|
199
|
-
interface
|
|
202
|
+
export declare let useAsynchronousBigIntVariance: UseAsynchronousBigIntVariance;
|
|
203
|
+
interface UseAsynchronousNumericStandardDeviation {
|
|
200
204
|
<E>(): AsynchronousCollector<E, StandardDeviationAccumulator, number>;
|
|
201
205
|
<E>(mapper: Functional<E, number>): AsynchronousCollector<E, StandardDeviationAccumulator, number>;
|
|
202
206
|
}
|
|
@@ -205,8 +209,8 @@ interface StandardDeviationAccumulator {
|
|
|
205
209
|
summateOfSquares: number;
|
|
206
210
|
count: number;
|
|
207
211
|
}
|
|
208
|
-
export declare let useAsynchronousNumericStandardDeviation:
|
|
209
|
-
interface
|
|
212
|
+
export declare let useAsynchronousNumericStandardDeviation: UseAsynchronousNumericStandardDeviation;
|
|
213
|
+
interface UseAsynchronousBigIntStandardDeviation {
|
|
210
214
|
<E>(): AsynchronousCollector<E, BigIntStandardDeviationAccumulator, bigint>;
|
|
211
215
|
<E>(mapper: Functional<E, bigint>): AsynchronousCollector<E, BigIntStandardDeviationAccumulator, bigint>;
|
|
212
216
|
}
|
|
@@ -215,17 +219,17 @@ interface BigIntStandardDeviationAccumulator {
|
|
|
215
219
|
summateOfSquares: bigint;
|
|
216
220
|
count: bigint;
|
|
217
221
|
}
|
|
218
|
-
export declare let useAsynchronousBigIntStandardDeviation:
|
|
219
|
-
interface
|
|
222
|
+
export declare let useAsynchronousBigIntStandardDeviation: UseAsynchronousBigIntStandardDeviation;
|
|
223
|
+
interface UseAsynchronousNumericMedian {
|
|
220
224
|
<E>(): AsynchronousCollector<E, number[], number>;
|
|
221
225
|
<E>(mapper: Functional<E, number>): AsynchronousCollector<E, number[], number>;
|
|
222
226
|
}
|
|
223
|
-
export declare let useAsynchronousNumericMedian:
|
|
224
|
-
interface
|
|
227
|
+
export declare let useAsynchronousNumericMedian: UseAsynchronousNumericMedian;
|
|
228
|
+
interface UseAsynchronousBigIntMedian {
|
|
225
229
|
<E>(): AsynchronousCollector<E, bigint[], bigint>;
|
|
226
230
|
<E>(mapper: Functional<E, bigint>): AsynchronousCollector<E, bigint[], bigint>;
|
|
227
231
|
}
|
|
228
|
-
export declare let useAsynchronousBigIntMedian:
|
|
232
|
+
export declare let useAsynchronousBigIntMedian: UseAsynchronousBigIntMedian;
|
|
229
233
|
export declare let useAsynchronousToGeneratorFunction: <E>() => AsynchronousCollector<E, Array<E>, globalThis.Generator<E, void, undefined>>;
|
|
230
234
|
export declare let useAsynchronousToAsyncGeneratorFunction: <E>() => AsynchronousCollector<E, Array<E>, globalThis.AsyncGenerator<E, void, undefined>>;
|
|
231
235
|
export {};
|
|
@@ -54,7 +54,6 @@ export class AsynchronousCollector {
|
|
|
54
54
|
}
|
|
55
55
|
async collect(argument1, argument2) {
|
|
56
56
|
if (isAsyncFunction(argument1) || isFunction(argument1)) {
|
|
57
|
-
console.log("Function");
|
|
58
57
|
return await new Promise(async (resolve, reject) => {
|
|
59
58
|
try {
|
|
60
59
|
let generator = argument1;
|
|
@@ -62,10 +61,11 @@ export class AsynchronousCollector {
|
|
|
62
61
|
let count = 0n;
|
|
63
62
|
await generator((element, index) => {
|
|
64
63
|
accumulator = this.accumulator(accumulator, element, index);
|
|
65
|
-
console.log(accumulator);
|
|
66
64
|
count++;
|
|
67
|
-
}, (element, index) => this.interrupt(element, index, accumulator))
|
|
68
|
-
|
|
65
|
+
}, (element, index) => this.interrupt(element, index, accumulator))
|
|
66
|
+
.then(() => {
|
|
67
|
+
resolve(this.finisher(accumulator));
|
|
68
|
+
}, reject);
|
|
69
69
|
}
|
|
70
70
|
catch (error) {
|
|
71
71
|
reject(error);
|
|
@@ -136,6 +136,18 @@ export class AsynchronousCollector {
|
|
|
136
136
|
}
|
|
137
137
|
throw new Error("Invalid arguments.");
|
|
138
138
|
}
|
|
139
|
+
getIdentity() {
|
|
140
|
+
return this.identity;
|
|
141
|
+
}
|
|
142
|
+
getInterrupt() {
|
|
143
|
+
return this.interrupt;
|
|
144
|
+
}
|
|
145
|
+
getAccumulator() {
|
|
146
|
+
return this.accumulator;
|
|
147
|
+
}
|
|
148
|
+
getFinisher() {
|
|
149
|
+
return this.finisher;
|
|
150
|
+
}
|
|
139
151
|
static full(identity, accumulator, finisher) {
|
|
140
152
|
return new AsynchronousCollector(identity, () => false, accumulator, finisher);
|
|
141
153
|
}
|
|
@@ -394,7 +406,6 @@ export let useAsynchronousLog = (argument1, argument2, argument3) => {
|
|
|
394
406
|
}
|
|
395
407
|
else {
|
|
396
408
|
return AsynchronousCollector.full(() => "[", (accumulator, element) => {
|
|
397
|
-
console.log(element);
|
|
398
409
|
if (isString(accumulator) && isString(element)) {
|
|
399
410
|
return accumulator + element + ",";
|
|
400
411
|
}
|
|
@@ -39,8 +39,8 @@ export declare class AsynchronousSemantic<E> {
|
|
|
39
39
|
sub(start: bigint, end: bigint): AsynchronousSemantic<E>;
|
|
40
40
|
takeWhile(predicate: Predicate<E>): AsynchronousSemantic<E>;
|
|
41
41
|
takeWhile(predicate: BiPredicate<E, bigint>): AsynchronousSemantic<E>;
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
toCollectable(): AsynchronousCollectable<E>;
|
|
43
|
+
toCollectable<C extends AsynchronousCollectable<E>>(mapper: Functional<AsynchronousGenerator<E>, C>): C;
|
|
44
44
|
toBigintStatistics(): AsynchronousBigIntStatistics<E>;
|
|
45
45
|
toNumericStatistics(): AsynchronousNumericStatistics<E>;
|
|
46
46
|
toOrdered(): AsynchronousOrderedCollectable<E>;
|
|
@@ -438,7 +438,7 @@ export class AsynchronousSemantic {
|
|
|
438
438
|
});
|
|
439
439
|
});
|
|
440
440
|
}
|
|
441
|
-
|
|
441
|
+
toCollectable(mapper) {
|
|
442
442
|
if (isFunction(mapper)) {
|
|
443
443
|
try {
|
|
444
444
|
let AsynchronousCollectable = mapper(this.generator);
|
|
@@ -483,7 +483,7 @@ export class AsynchronousSemantic {
|
|
|
483
483
|
}
|
|
484
484
|
toUnordered() {
|
|
485
485
|
try {
|
|
486
|
-
return new AsynchronousUnorderedCollectable(this.
|
|
486
|
+
return new AsynchronousUnorderedCollectable(this.source());
|
|
487
487
|
}
|
|
488
488
|
catch (error) {
|
|
489
489
|
throw new Error(String(error));
|
|
@@ -960,10 +960,10 @@ export class AsynchronousOrderedCollectable extends AsynchronousCollectable {
|
|
|
960
960
|
else {
|
|
961
961
|
let collector = useAsynchronousToArray();
|
|
962
962
|
collector.collect(argument1).then((elements) => {
|
|
963
|
-
this.buffer = elements.sort(useCompare).map((element, index) => {
|
|
963
|
+
this.buffer = elements.sort(useCompare).map((element, index, array) => {
|
|
964
964
|
return {
|
|
965
965
|
element: element,
|
|
966
|
-
index: BigInt(index)
|
|
966
|
+
index: BigInt(((index % array.length) + array.length) % array.length)
|
|
967
967
|
};
|
|
968
968
|
});
|
|
969
969
|
for (let listener of this.listeners) {
|
|
@@ -1335,8 +1335,8 @@ export class AsynchronousUnorderedCollectable extends AsynchronousCollectable {
|
|
|
1335
1335
|
}
|
|
1336
1336
|
accept(element, index);
|
|
1337
1337
|
}
|
|
1338
|
+
resolve();
|
|
1338
1339
|
});
|
|
1339
|
-
resolve();
|
|
1340
1340
|
}
|
|
1341
1341
|
}
|
|
1342
1342
|
catch (error) {
|
|
@@ -1346,7 +1346,17 @@ export class AsynchronousUnorderedCollectable extends AsynchronousCollectable {
|
|
|
1346
1346
|
};
|
|
1347
1347
|
}
|
|
1348
1348
|
async *[Symbol.asyncIterator]() {
|
|
1349
|
-
|
|
1349
|
+
let buffer = await new Promise((resolve, reject) => {
|
|
1350
|
+
if (this.complete === true) {
|
|
1351
|
+
resolve(this.buffer);
|
|
1352
|
+
}
|
|
1353
|
+
else {
|
|
1354
|
+
this.listeners.push((buffer) => {
|
|
1355
|
+
resolve(buffer);
|
|
1356
|
+
}, reject);
|
|
1357
|
+
}
|
|
1358
|
+
});
|
|
1359
|
+
for await (let [_index, element] of buffer) {
|
|
1350
1360
|
yield element;
|
|
1351
1361
|
}
|
|
1352
1362
|
}
|
package/dist/factory.d.ts
CHANGED
|
@@ -86,6 +86,14 @@ interface UseRange {
|
|
|
86
86
|
<N extends number | bigint>(start: N, end: N, step: N): SynchronousSemantic<N extends number ? number : (N extends bigint ? bigint : never)>;
|
|
87
87
|
}
|
|
88
88
|
export declare let useRange: UseRange;
|
|
89
|
+
interface UseText {
|
|
90
|
+
(text: string): SynchronousSemantic<string>;
|
|
91
|
+
(text: string, start: number): SynchronousSemantic<string>;
|
|
92
|
+
(text: string, start: number, end: number): SynchronousSemantic<string>;
|
|
93
|
+
(text: string, start: bigint): SynchronousSemantic<string>;
|
|
94
|
+
(text: string, start: bigint, end: bigint): SynchronousSemantic<string>;
|
|
95
|
+
}
|
|
96
|
+
export declare let useText: UseText;
|
|
89
97
|
interface UseWebSocketOptions {
|
|
90
98
|
throttle?: number;
|
|
91
99
|
debounce?: number;
|