semantic-typescript 0.6.0 → 0.7.1
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 +6 -2
- package/dist/asynchronous/semantic.js +19 -6
- package/dist/factory.d.ts +32 -71
- package/dist/factory.js +192 -603
- package/dist/guard.d.ts +0 -3
- package/dist/guard.js +0 -19
- package/dist/hash.js +3 -0
- package/dist/hook.d.ts +6 -1
- package/dist/hook.js +20 -3
- package/dist/synchronous/collector.d.ts +8 -4
- package/dist/synchronous/collector.js +74 -59
- package/dist/synchronous/semantic.d.ts +31 -23
- package/dist/synchronous/semantic.js +218 -286
- package/package.json +3 -2
- package/readme.cn.md +267 -214
- package/readme.de.md +225 -172
- package/readme.es.md +229 -170
- package/readme.fr.md +233 -170
- package/readme.jp.md +232 -169
- package/readme.kr.md +227 -169
- package/readme.md +270 -214
- package/readme.ru.md +231 -169
- package/readme.tw.md +225 -172
|
@@ -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
|
}
|
|
@@ -24,10 +24,14 @@ export declare class AsynchronousSemantic<E> {
|
|
|
24
24
|
flatMap<R>(mapper: BiFunctional<E, bigint, AsynchronousSemantic<R>>): AsynchronousSemantic<R>;
|
|
25
25
|
limit(count: number): AsynchronousSemantic<E>;
|
|
26
26
|
limit(count: bigint): AsynchronousSemantic<E>;
|
|
27
|
+
map(mapper: Functional<E, E>): AsynchronousSemantic<E>;
|
|
28
|
+
map(mapper: BiFunctional<E, bigint, E>): AsynchronousSemantic<E>;
|
|
27
29
|
map<R>(mapper: Functional<E, R>): AsynchronousSemantic<R>;
|
|
28
30
|
map<R>(mapper: BiFunctional<E, bigint, R>): AsynchronousSemantic<R>;
|
|
29
31
|
peek(consumer: Consumer<E>): AsynchronousSemantic<E>;
|
|
30
32
|
peek(consumer: BiConsumer<E, bigint>): AsynchronousSemantic<E>;
|
|
33
|
+
pipe(conversion: Functional<AsynchronousGenerator<E>, AsynchronousSemantic<E>>): AsynchronousSemantic<E>;
|
|
34
|
+
pipe<R>(conversion: Functional<AsynchronousGenerator<E>, AsynchronousSemantic<R>>): AsynchronousSemantic<R>;
|
|
31
35
|
redirect(redirector: BiFunctional<E, bigint, bigint>): AsynchronousSemantic<E>;
|
|
32
36
|
reverse(): AsynchronousSemantic<E>;
|
|
33
37
|
shuffle(): AsynchronousSemantic<E>;
|
|
@@ -39,8 +43,8 @@ export declare class AsynchronousSemantic<E> {
|
|
|
39
43
|
sub(start: bigint, end: bigint): AsynchronousSemantic<E>;
|
|
40
44
|
takeWhile(predicate: Predicate<E>): AsynchronousSemantic<E>;
|
|
41
45
|
takeWhile(predicate: BiPredicate<E, bigint>): AsynchronousSemantic<E>;
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
toCollectable(): AsynchronousCollectable<E>;
|
|
47
|
+
toCollectable<C extends AsynchronousCollectable<E>>(mapper: Functional<AsynchronousGenerator<E>, C>): C;
|
|
44
48
|
toBigintStatistics(): AsynchronousBigIntStatistics<E>;
|
|
45
49
|
toNumericStatistics(): AsynchronousNumericStatistics<E>;
|
|
46
50
|
toOrdered(): AsynchronousOrderedCollectable<E>;
|
|
@@ -285,6 +285,9 @@ export class AsynchronousSemantic {
|
|
|
285
285
|
}
|
|
286
286
|
throw new TypeError("Invalid arguments.");
|
|
287
287
|
}
|
|
288
|
+
pipe(conversion) {
|
|
289
|
+
return conversion(this.source());
|
|
290
|
+
}
|
|
288
291
|
redirect(redirector) {
|
|
289
292
|
if (isFunction(redirector)) {
|
|
290
293
|
return new AsynchronousSemantic(async (accept, interrupt) => {
|
|
@@ -438,7 +441,7 @@ export class AsynchronousSemantic {
|
|
|
438
441
|
});
|
|
439
442
|
});
|
|
440
443
|
}
|
|
441
|
-
|
|
444
|
+
toCollectable(mapper) {
|
|
442
445
|
if (isFunction(mapper)) {
|
|
443
446
|
try {
|
|
444
447
|
let AsynchronousCollectable = mapper(this.generator);
|
|
@@ -483,7 +486,7 @@ export class AsynchronousSemantic {
|
|
|
483
486
|
}
|
|
484
487
|
toUnordered() {
|
|
485
488
|
try {
|
|
486
|
-
return new AsynchronousUnorderedCollectable(this.
|
|
489
|
+
return new AsynchronousUnorderedCollectable(this.source());
|
|
487
490
|
}
|
|
488
491
|
catch (error) {
|
|
489
492
|
throw new Error(String(error));
|
|
@@ -960,10 +963,10 @@ export class AsynchronousOrderedCollectable extends AsynchronousCollectable {
|
|
|
960
963
|
else {
|
|
961
964
|
let collector = useAsynchronousToArray();
|
|
962
965
|
collector.collect(argument1).then((elements) => {
|
|
963
|
-
this.buffer = elements.sort(useCompare).map((element, index) => {
|
|
966
|
+
this.buffer = elements.sort(useCompare).map((element, index, array) => {
|
|
964
967
|
return {
|
|
965
968
|
element: element,
|
|
966
|
-
index: BigInt(index)
|
|
969
|
+
index: BigInt(((index % array.length) + array.length) % array.length)
|
|
967
970
|
};
|
|
968
971
|
});
|
|
969
972
|
for (let listener of this.listeners) {
|
|
@@ -1335,8 +1338,8 @@ export class AsynchronousUnorderedCollectable extends AsynchronousCollectable {
|
|
|
1335
1338
|
}
|
|
1336
1339
|
accept(element, index);
|
|
1337
1340
|
}
|
|
1341
|
+
resolve();
|
|
1338
1342
|
});
|
|
1339
|
-
resolve();
|
|
1340
1343
|
}
|
|
1341
1344
|
}
|
|
1342
1345
|
catch (error) {
|
|
@@ -1346,7 +1349,17 @@ export class AsynchronousUnorderedCollectable extends AsynchronousCollectable {
|
|
|
1346
1349
|
};
|
|
1347
1350
|
}
|
|
1348
1351
|
async *[Symbol.asyncIterator]() {
|
|
1349
|
-
|
|
1352
|
+
let buffer = await new Promise((resolve, reject) => {
|
|
1353
|
+
if (this.complete === true) {
|
|
1354
|
+
resolve(this.buffer);
|
|
1355
|
+
}
|
|
1356
|
+
else {
|
|
1357
|
+
this.listeners.push((buffer) => {
|
|
1358
|
+
resolve(buffer);
|
|
1359
|
+
}, reject);
|
|
1360
|
+
}
|
|
1361
|
+
});
|
|
1362
|
+
for await (let [_index, element] of buffer) {
|
|
1350
1363
|
yield element;
|
|
1351
1364
|
}
|
|
1352
1365
|
}
|
package/dist/factory.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { AsynchronousSemantic } from "./asynchronous/semantic";
|
|
2
|
-
import { Optional } from "./optional";
|
|
3
2
|
import { SynchronousSemantic } from "./synchronous/semantic";
|
|
4
|
-
import type { BiPredicate, Predicate, Supplier,
|
|
5
|
-
interface UseAnimationFrame {
|
|
6
|
-
(period: number): SynchronousSemantic<number>;
|
|
7
|
-
(period: number, delay: number): SynchronousSemantic<number>;
|
|
8
|
-
}
|
|
9
|
-
export declare let useAnimationFrame: UseAnimationFrame;
|
|
3
|
+
import type { BiPredicate, Predicate, Supplier, Consumer } from "./utility";
|
|
10
4
|
interface Attribute<T> {
|
|
11
5
|
key: keyof T;
|
|
12
6
|
value: T[keyof T];
|
|
@@ -17,42 +11,6 @@ interface UseBlob {
|
|
|
17
11
|
(blob: Blob, chunk: bigint): SynchronousSemantic<Uint8Array>;
|
|
18
12
|
}
|
|
19
13
|
export declare let useBlob: UseBlob;
|
|
20
|
-
interface UseDocument {
|
|
21
|
-
<K extends keyof DocumentEventMap, V extends DocumentEventMap[K]>(key: K): AsynchronousSemantic<V>;
|
|
22
|
-
<K extends keyof DocumentEventMap, V extends DocumentEventMap[K]>(key: Iterable<K>): AsynchronousSemantic<V>;
|
|
23
|
-
}
|
|
24
|
-
export declare let useDocument: UseDocument;
|
|
25
|
-
interface UseHTMLElementOptions {
|
|
26
|
-
throttle?: number;
|
|
27
|
-
debounce?: number;
|
|
28
|
-
}
|
|
29
|
-
interface UseHTMLElement {
|
|
30
|
-
<E extends HTMLElement, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(element: E, key: K): AsynchronousSemantic<V>;
|
|
31
|
-
<E extends HTMLElement, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(element: E, key: K, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
32
|
-
<E extends HTMLElement, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(element: E, keys: Iterable<K>): AsynchronousSemantic<V>;
|
|
33
|
-
<E extends HTMLElement, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(element: E, keys: Iterable<K>, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
34
|
-
<E extends HTMLElement, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(elements: Iterable<E>, key: K): AsynchronousSemantic<V>;
|
|
35
|
-
<E extends HTMLElement, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(elements: Iterable<E>, key: K, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
36
|
-
<E extends HTMLElement, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(elements: Iterable<E>, keys: Iterable<K>): AsynchronousSemantic<V>;
|
|
37
|
-
<E extends HTMLElement, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(elements: Iterable<E>, keys: Iterable<K>, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
38
|
-
<K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selector: string, key: K): AsynchronousSemantic<V>;
|
|
39
|
-
<K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selector: string, key: K, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
40
|
-
<S extends keyof HTMLElementTagNameMap, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selector: S, key: K): AsynchronousSemantic<V>;
|
|
41
|
-
<S extends keyof HTMLElementTagNameMap, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selector: S, key: K, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
42
|
-
<K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selector: string, keys: Iterable<K>): AsynchronousSemantic<V>;
|
|
43
|
-
<K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selector: string, keys: Iterable<K>, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
44
|
-
<S extends keyof HTMLElementTagNameMap, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selector: S, keys: Iterable<K>): AsynchronousSemantic<V>;
|
|
45
|
-
<S extends keyof HTMLElementTagNameMap, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selector: S, keys: Iterable<K>, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
46
|
-
<K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selectors: Iterable<string>, key: K): AsynchronousSemantic<V>;
|
|
47
|
-
<K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selectors: Iterable<string>, key: K, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
48
|
-
<S extends keyof HTMLElementTagNameMap, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selectors: Iterable<S>, key: K): AsynchronousSemantic<V>;
|
|
49
|
-
<S extends keyof HTMLElementTagNameMap, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selectors: Iterable<S>, key: K, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
50
|
-
<K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selectors: Iterable<string>, keys: Iterable<K>): AsynchronousSemantic<V>;
|
|
51
|
-
<K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selectors: Iterable<string>, keys: Iterable<K>, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
52
|
-
<S extends keyof HTMLElementTagNameMap, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selectors: Iterable<S>, keys: Iterable<K>): AsynchronousSemantic<V>;
|
|
53
|
-
<S extends keyof HTMLElementTagNameMap, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selectors: Iterable<S>, keys: Iterable<K>, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
54
|
-
}
|
|
55
|
-
export declare let useHTMLElement: UseHTMLElement;
|
|
56
14
|
export declare let useEmpty: <E>() => SynchronousSemantic<E>;
|
|
57
15
|
interface UseFill {
|
|
58
16
|
<E>(element: E, count: bigint): SynchronousSemantic<E>;
|
|
@@ -74,8 +32,28 @@ interface UseInterval {
|
|
|
74
32
|
(period: number, delay: number): SynchronousSemantic<number>;
|
|
75
33
|
}
|
|
76
34
|
export declare let useInterval: UseInterval;
|
|
77
|
-
|
|
78
|
-
|
|
35
|
+
interface UseIterate {
|
|
36
|
+
<E>(iterable: Iterable<E>): SynchronousSemantic<E>;
|
|
37
|
+
<E>(iterable: AsyncIterable<E>): AsynchronousSemantic<E>;
|
|
38
|
+
}
|
|
39
|
+
export declare let useIterate: UseIterate;
|
|
40
|
+
interface UsePromise {
|
|
41
|
+
<T>(promise: Promise<T>): AsynchronousSemantic<T>;
|
|
42
|
+
}
|
|
43
|
+
export declare let usePromise: UsePromise;
|
|
44
|
+
export type KeyOfEventMap<EventMap> = keyof EventMap;
|
|
45
|
+
export type EventOfEventMap<EventMap, K extends KeyOfEventMap<EventMap> = KeyOfEventMap<EventMap>> = EventMap[K];
|
|
46
|
+
export interface Subscriber<T, EventMap> {
|
|
47
|
+
mount(target: T): void;
|
|
48
|
+
subscribe<K extends KeyOfEventMap<EventMap>>(key: K, accept: Consumer<EventOfEventMap<EventMap, K>>): void;
|
|
49
|
+
unsubscribe<K extends KeyOfEventMap<EventMap>>(key: K, accept: Consumer<EventOfEventMap<EventMap, K>>): void;
|
|
50
|
+
unmount(): void;
|
|
51
|
+
}
|
|
52
|
+
interface UseSubscription {
|
|
53
|
+
<T, EventMap, K extends KeyOfEventMap<EventMap> = KeyOfEventMap<EventMap>>(target: T, subscriber: Supplier<Subscriber<T, EventMap>>, subscription: K): AsynchronousSemantic<EventOfEventMap<EventMap, K>>;
|
|
54
|
+
<T, EventMap, K extends KeyOfEventMap<EventMap> = KeyOfEventMap<EventMap>>(target: T, subscriber: Supplier<Subscriber<T, EventMap>>, subscription: Iterable<K>): AsynchronousSemantic<EventOfEventMap<EventMap, K>>;
|
|
55
|
+
}
|
|
56
|
+
export declare let useSubscription: UseSubscription;
|
|
79
57
|
interface UseOf {
|
|
80
58
|
<E>(target: E): SynchronousSemantic<E>;
|
|
81
59
|
<E>(target: Iterable<E>): SynchronousSemantic<E>;
|
|
@@ -86,30 +64,13 @@ interface UseRange {
|
|
|
86
64
|
<N extends number | bigint>(start: N, end: N, step: N): SynchronousSemantic<N extends number ? number : (N extends bigint ? bigint : never)>;
|
|
87
65
|
}
|
|
88
66
|
export declare let useRange: UseRange;
|
|
89
|
-
interface
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
(
|
|
95
|
-
(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
<K extends keyof WebSocketEventMap, V extends WebSocketEventMap[K]>(websocket: WebSocket, keys: Iterable<K>): AsynchronousSemantic<V>;
|
|
99
|
-
<K extends keyof WebSocketEventMap, V extends WebSocketEventMap[K]>(websocket: WebSocket, keys: Iterable<K>, options: UseWebSocketOptions): AsynchronousSemantic<V>;
|
|
100
|
-
}
|
|
101
|
-
export declare let useWebSocket: UseWebSocket;
|
|
102
|
-
interface UseWindowOptions {
|
|
103
|
-
throttle?: number;
|
|
104
|
-
debounce?: number;
|
|
105
|
-
}
|
|
106
|
-
interface UseWindow {
|
|
107
|
-
<K extends keyof WindowEventMap, V extends WindowEventMap[K]>(key: K): AsynchronousSemantic<V>;
|
|
108
|
-
<K extends keyof WindowEventMap, V extends WindowEventMap[K]>(key: K, options: UseWindowOptions): AsynchronousSemantic<V>;
|
|
109
|
-
<K extends keyof WindowEventMap, V extends WindowEventMap[K]>(keys: Iterable<K>): AsynchronousSemantic<V>;
|
|
110
|
-
<K extends keyof WindowEventMap, V extends WindowEventMap[K]>(keys: Iterable<K>, options: UseWindowOptions): AsynchronousSemantic<V>;
|
|
111
|
-
}
|
|
112
|
-
export declare let useWindow: UseWindow;
|
|
113
|
-
export declare let useNullable: <T>(target: MaybeInvalid<T>) => Optional<T>;
|
|
114
|
-
export declare let useNonNull: <T>(target: T) => Optional<T>;
|
|
67
|
+
interface UseText {
|
|
68
|
+
(text: string): SynchronousSemantic<string>;
|
|
69
|
+
(text: string, delimeter: string): SynchronousSemantic<string>;
|
|
70
|
+
(text: string, start: number): SynchronousSemantic<string>;
|
|
71
|
+
(text: string, start: number, end: number): SynchronousSemantic<string>;
|
|
72
|
+
(text: string, start: bigint): SynchronousSemantic<string>;
|
|
73
|
+
(text: string, start: bigint, end: bigint): SynchronousSemantic<string>;
|
|
74
|
+
}
|
|
75
|
+
export declare let useText: UseText;
|
|
115
76
|
export {};
|