semantic-typescript 0.3.8 → 0.4.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/collectable.d.ts +12 -0
- package/dist/collectable.js +41 -7
- package/dist/collector.d.ts +91 -50
- package/dist/collector.js +126 -108
- package/dist/factory.d.ts +9 -35
- package/dist/factory.js +4 -68
- package/dist/guard.d.ts +31 -25
- package/dist/guard.js +83 -65
- package/dist/hash.d.ts +14 -0
- package/dist/hash.js +211 -0
- package/dist/hook.d.ts +16 -4
- package/dist/hook.js +19 -15
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/map.d.ts +72 -0
- package/dist/map.js +247 -0
- package/dist/optional.js +8 -23
- package/dist/semantic.js +42 -47
- package/dist/set.d.ts +19 -0
- package/dist/set.js +64 -0
- package/dist/statistics.js +28 -22
- package/dist/symbol.d.ts +8 -0
- package/dist/symbol.js +8 -0
- package/dist/utility.d.ts +8 -1
- package/dist/utility.js +9 -0
- package/dist/window.js +7 -5
- package/package.json +1 -5
- package/readme.cn.md +381 -636
- package/readme.md +3 -1
package/dist/collectable.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Collector } from "./collector";
|
|
2
|
+
import type { HashMap } from "./map";
|
|
2
3
|
import { Optional } from "./optional";
|
|
3
4
|
import { Semantic } from "./semantic";
|
|
5
|
+
import type { HashSet } from "./set";
|
|
4
6
|
import type { BiConsumer, BiFunctional, Comparator, Consumer, Functional, Predicate, Supplier, TriFunctional, Generator, BiPredicate, TriPredicate, Indexed } from "./utility";
|
|
5
7
|
export declare abstract class Collectable<E> implements Iterable<E>, AsyncIterable<E> {
|
|
6
8
|
protected readonly Collectable: symbol;
|
|
@@ -26,6 +28,8 @@ export declare abstract class Collectable<E> implements Iterable<E>, AsyncIterab
|
|
|
26
28
|
error(prefix: string, accumulator: TriFunctional<string, E, bigint, string>, suffix: string): void;
|
|
27
29
|
isEmpty(): boolean;
|
|
28
30
|
findAny(): Optional<E>;
|
|
31
|
+
findAt(index: number): Optional<E>;
|
|
32
|
+
findAt(index: bigint): Optional<E>;
|
|
29
33
|
findFirst(): Optional<E>;
|
|
30
34
|
findLast(): Optional<E>;
|
|
31
35
|
findMaximum(): Optional<E>;
|
|
@@ -35,7 +39,9 @@ export declare abstract class Collectable<E> implements Iterable<E>, AsyncIterab
|
|
|
35
39
|
forEach(action: Consumer<E>): void;
|
|
36
40
|
forEach(action: BiConsumer<E, bigint>): void;
|
|
37
41
|
group<K>(classifier: Functional<E, K>): Map<K, Array<E>>;
|
|
42
|
+
group<K>(classifier: BiFunctional<E, bigint, K>): Map<K, Array<E>>;
|
|
38
43
|
groupBy<K, V>(keyExtractor: Functional<E, K>, valueExtractor: Functional<E, V>): Map<K, Array<V>>;
|
|
44
|
+
groupBy<K, V>(keyExtractor: BiFunctional<E, bigint, K>, valueExtractor: BiFunctional<E, bigint, K>): Map<K, Array<V>>;
|
|
39
45
|
join(): string;
|
|
40
46
|
join(delimiter: string): string;
|
|
41
47
|
join(prefix: string, delimiter: string, suffix: string): string;
|
|
@@ -47,8 +53,10 @@ export declare abstract class Collectable<E> implements Iterable<E>, AsyncIterab
|
|
|
47
53
|
log(prefix: string, accumulator: BiFunctional<string, E, string>, suffix: string): void;
|
|
48
54
|
log(prefix: string, accumulator: TriFunctional<string, E, bigint, string>, suffix: string): void;
|
|
49
55
|
nonMatch(predicate: Predicate<E>): boolean;
|
|
56
|
+
nonMatch(predicate: BiPredicate<E, bigint>): boolean;
|
|
50
57
|
partition(count: bigint): Array<Array<E>>;
|
|
51
58
|
partitionBy(classifier: Functional<E, bigint>): Array<Array<E>>;
|
|
59
|
+
partitionBy(classifier: BiFunctional<E, bigint, bigint>): Array<Array<E>>;
|
|
52
60
|
reduce(accumulator: BiFunctional<E, E, E>): Optional<E>;
|
|
53
61
|
reduce(accumulator: TriFunctional<E, E, bigint, E>): Optional<E>;
|
|
54
62
|
reduce(identity: E, accumulator: BiFunctional<E, E, E>): E;
|
|
@@ -59,7 +67,11 @@ export declare abstract class Collectable<E> implements Iterable<E>, AsyncIterab
|
|
|
59
67
|
abstract source(): Generator<E>;
|
|
60
68
|
toArray(): Array<E>;
|
|
61
69
|
toMap<K, V>(keyExtractor: Functional<E, K>, valueExtractor: Functional<E, V>): Map<K, V>;
|
|
70
|
+
toMap<K, V>(keyExtractor: BiFunctional<E, bigint, K>, valueExtractor: BiFunctional<E, bigint, V>): Map<K, V>;
|
|
71
|
+
toHashMap<K, V>(keyExtractor: Functional<E, K>, valueExtractor: Functional<E, V>): HashMap<K, V>;
|
|
72
|
+
toHashMap<K, V>(keyExtractor: BiFunctional<E, bigint, K>, valueExtractor: BiFunctional<E, bigint, V>): HashMap<K, V>;
|
|
62
73
|
toSet(): Set<E>;
|
|
74
|
+
toHashSet(): HashSet<E>;
|
|
63
75
|
write<S = string>(stream: WritableStream<S>): Promise<WritableStream<S>>;
|
|
64
76
|
write<S = string>(stream: WritableStream<S>, accumulator: BiFunctional<WritableStream<S>, E, WritableStream<S>>): Promise<WritableStream<S>>;
|
|
65
77
|
write<S = string>(stream: WritableStream<S>, accumulator: TriFunctional<WritableStream<S>, E, bigint, WritableStream<S>>): Promise<WritableStream<S>>;
|
package/dist/collectable.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Collector, useAllMatch, useAnyMatch, useCollect, useCount, useError, useFindAny, useFindFirst, useFindLast, useFindMaximum, useFindMinimum, useForEach, useGroup, useGroupBy, useJoin, useLog, useNoneMatch, usePartition, usePartitionBy, useReduce, useToArray, useToAsyncGeneratorFunction, useToGeneratorFunction, useToMap, useToSet, useWrite } from "./collector";
|
|
2
|
-
import { isBigInt, isCollector, isFunction, isObject, isString } from "./guard";
|
|
1
|
+
import { Collector, useAllMatch, useAnyMatch, useCollect, useCount, useError, useFindAny, useFindAt, useFindFirst, useFindLast, useFindMaximum, useFindMinimum, useForEach, useGroup, useGroupBy, useJoin, useLog, useNoneMatch, usePartition, usePartitionBy, useReduce, useToArray, useToAsyncGeneratorFunction, useToGeneratorFunction, useToHashMap, useToHashSet, useToMap, useToSet, useWrite } from "./collector";
|
|
2
|
+
import { isBigInt, isCollector, isFunction, isNumber, isObject, isString } from "./guard";
|
|
3
3
|
import { useCompare } from "./hook";
|
|
4
4
|
import { Optional } from "./optional";
|
|
5
5
|
import { Semantic } from "./semantic";
|
|
@@ -102,6 +102,25 @@ export class Collectable {
|
|
|
102
102
|
throw new Error("Uncaught error on findAny.");
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
+
findAt(index) {
|
|
106
|
+
if (isBigInt(index)) {
|
|
107
|
+
try {
|
|
108
|
+
return useFindAt(index).collect(this.source());
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
throw new Error("Uncaught error on findAt.");
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else if (isNumber(index)) {
|
|
115
|
+
try {
|
|
116
|
+
return useFindAt(index).collect(this.source());
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
throw new Error("Uncaught error on findAt.");
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
throw new TypeError("Index must be a bigint.");
|
|
123
|
+
}
|
|
105
124
|
findFirst() {
|
|
106
125
|
try {
|
|
107
126
|
return useFindFirst().collect(this.source());
|
|
@@ -342,6 +361,14 @@ export class Collectable {
|
|
|
342
361
|
throw new Error("Uncaught error on toMap.");
|
|
343
362
|
}
|
|
344
363
|
}
|
|
364
|
+
toHashMap(keyExtractor, valueExtractor) {
|
|
365
|
+
try {
|
|
366
|
+
return useToHashMap(keyExtractor, valueExtractor).collect(this.source());
|
|
367
|
+
}
|
|
368
|
+
catch (error) {
|
|
369
|
+
throw new Error("Uncaught error on toHashMap.");
|
|
370
|
+
}
|
|
371
|
+
}
|
|
345
372
|
toSet() {
|
|
346
373
|
try {
|
|
347
374
|
return useToSet().collect(this.source());
|
|
@@ -350,6 +377,14 @@ export class Collectable {
|
|
|
350
377
|
throw new Error("Uncaught error on toSet.");
|
|
351
378
|
}
|
|
352
379
|
}
|
|
380
|
+
toHashSet() {
|
|
381
|
+
try {
|
|
382
|
+
return useToHashSet().collect(this.source());
|
|
383
|
+
}
|
|
384
|
+
catch (error) {
|
|
385
|
+
throw new Error("Uncaught error on toHashSet.");
|
|
386
|
+
}
|
|
387
|
+
}
|
|
353
388
|
write(argument1, argument2) {
|
|
354
389
|
if (isObject(argument1)) {
|
|
355
390
|
try {
|
|
@@ -372,7 +407,7 @@ export class Collectable {
|
|
|
372
407
|
;
|
|
373
408
|
Object.freeze(Collectable);
|
|
374
409
|
Object.freeze(Collectable.prototype);
|
|
375
|
-
Object.freeze(Object.getPrototypeOf(Collectable
|
|
410
|
+
Object.freeze(Object.getPrototypeOf(Collectable));
|
|
376
411
|
export class UnorderedCollectable extends Collectable {
|
|
377
412
|
UnorderedCollectable = UnorderedCollectableSymbol;
|
|
378
413
|
generator;
|
|
@@ -388,7 +423,7 @@ export class UnorderedCollectable extends Collectable {
|
|
|
388
423
|
configurable: false
|
|
389
424
|
},
|
|
390
425
|
"generator": {
|
|
391
|
-
value:
|
|
426
|
+
value: argument1,
|
|
392
427
|
writable: false,
|
|
393
428
|
enumerable: false,
|
|
394
429
|
configurable: false
|
|
@@ -425,7 +460,7 @@ export class UnorderedCollectable extends Collectable {
|
|
|
425
460
|
;
|
|
426
461
|
Object.freeze(UnorderedCollectable);
|
|
427
462
|
Object.freeze(UnorderedCollectable.prototype);
|
|
428
|
-
Object.freeze(Object.getPrototypeOf(UnorderedCollectable
|
|
463
|
+
Object.freeze(Object.getPrototypeOf(UnorderedCollectable));
|
|
429
464
|
export class OrderedCollectable extends Collectable {
|
|
430
465
|
OrderedCollectable = OrderedCollectableSymbol;
|
|
431
466
|
buffer;
|
|
@@ -467,7 +502,6 @@ export class OrderedCollectable extends Collectable {
|
|
|
467
502
|
configurable: false
|
|
468
503
|
}
|
|
469
504
|
});
|
|
470
|
-
Object.freeze(this);
|
|
471
505
|
}
|
|
472
506
|
catch (error) {
|
|
473
507
|
throw new Error("Uncaught error on creating buffer.");
|
|
@@ -517,4 +551,4 @@ export class OrderedCollectable extends Collectable {
|
|
|
517
551
|
;
|
|
518
552
|
Object.freeze(OrderedCollectable);
|
|
519
553
|
Object.freeze(OrderedCollectable.prototype);
|
|
520
|
-
Object.freeze(Object.getPrototypeOf(OrderedCollectable
|
|
554
|
+
Object.freeze(Object.getPrototypeOf(OrderedCollectable));
|
package/dist/collector.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { Collectable } from "./collectable";
|
|
2
|
+
import { HashMap } from "./map";
|
|
2
3
|
import { Optional } from "./optional";
|
|
3
4
|
import type { Semantic } from "./semantic";
|
|
5
|
+
import { HashSet } from "./set";
|
|
4
6
|
import { type BiFunctional, type BiPredicate, type Functional, type Predicate, type Supplier, type TriFunctional, type Generator, type TriPredicate, type Consumer, type BiConsumer, type Comparator } from "./utility";
|
|
5
7
|
export declare class Collector<E, A, R> {
|
|
6
|
-
protected
|
|
7
|
-
protected
|
|
8
|
-
protected
|
|
9
|
-
protected
|
|
8
|
+
protected identity: Supplier<A>;
|
|
9
|
+
protected interrupt: Predicate<E> | BiPredicate<E, bigint> | TriPredicate<E, bigint, A>;
|
|
10
|
+
protected accumulator: BiFunctional<A, E, A> | TriFunctional<A, E, bigint, A>;
|
|
11
|
+
protected finisher: Functional<A, R>;
|
|
10
12
|
protected readonly Collector: symbol;
|
|
11
13
|
protected constructor(identity: Supplier<A>, interrupt: Predicate<E>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>);
|
|
12
14
|
protected constructor(identity: Supplier<A>, interrupt: BiPredicate<E, bigint>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>);
|
|
@@ -20,29 +22,37 @@ export declare class Collector<E, A, R> {
|
|
|
20
22
|
collect(start: bigint, end: bigint): R;
|
|
21
23
|
static full<E, A, R>(identity: Supplier<A>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): Collector<E, A, R>;
|
|
22
24
|
static full<E, A, R>(identity: Supplier<A>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): Collector<E, A, R>;
|
|
23
|
-
static shortable<E, A, R>(identity: Supplier<A>,
|
|
24
|
-
static shortable<E, A, R>(identity: Supplier<A>,
|
|
25
|
-
static shortable<E, A, R>(identity: Supplier<A>,
|
|
26
|
-
static shortable<E, A, R>(identity: Supplier<A>,
|
|
27
|
-
static shortable<E, A, R>(identity: Supplier<A>,
|
|
28
|
-
static shortable<E, A, R>(identity: Supplier<A>,
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
static shortable<E, A, R>(identity: Supplier<A>, interrupt: Predicate<E>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): Collector<E, A, R>;
|
|
26
|
+
static shortable<E, A, R>(identity: Supplier<A>, interrupt: Predicate<E>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): Collector<E, A, R>;
|
|
27
|
+
static shortable<E, A, R>(identity: Supplier<A>, interrupt: BiPredicate<E, bigint>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): Collector<E, A, R>;
|
|
28
|
+
static shortable<E, A, R>(identity: Supplier<A>, interrupt: BiPredicate<E, bigint>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): Collector<E, A, R>;
|
|
29
|
+
static shortable<E, A, R>(identity: Supplier<A>, interrupt: TriPredicate<E, bigint, A>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): Collector<E, A, R>;
|
|
30
|
+
static shortable<E, A, R>(identity: Supplier<A>, interrupt: TriPredicate<E, bigint, A>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): Collector<E, A, R>;
|
|
31
|
+
}
|
|
32
|
+
interface UseAnyMatch {
|
|
33
|
+
<E>(predicate: Predicate<E>): Collector<E, boolean, boolean>;
|
|
34
|
+
<E>(predicate: BiPredicate<E, bigint>): Collector<E, boolean, boolean>;
|
|
35
|
+
}
|
|
36
|
+
export declare let useAnyMatch: UseAnyMatch;
|
|
37
|
+
interface UseAllMatch {
|
|
38
|
+
<E>(predicate: Predicate<E>): Collector<E, boolean, boolean>;
|
|
39
|
+
<E>(predicate: BiPredicate<E, bigint>): Collector<E, boolean, boolean>;
|
|
40
|
+
}
|
|
41
|
+
export declare let useAllMatch: UseAllMatch;
|
|
32
42
|
interface UseCollect {
|
|
33
43
|
<E, A, R>(identity: Supplier<A>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): Collector<E, A, R>;
|
|
34
44
|
<E, A, R>(identity: Supplier<A>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): Collector<E, A, R>;
|
|
35
45
|
<E, A, R>(identity: Supplier<A>, accumulator: BiFunctional<A, E, A> | TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): Collector<E, A, R>;
|
|
36
|
-
<E, A, R>(identity: Supplier<A>,
|
|
37
|
-
<E, A, R>(identity: Supplier<A>,
|
|
38
|
-
<E, A, R>(identity: Supplier<A>,
|
|
39
|
-
<E, A, R>(identity: Supplier<A>,
|
|
40
|
-
<E, A, R>(identity: Supplier<A>,
|
|
41
|
-
<E, A, R>(identity: Supplier<A>,
|
|
46
|
+
<E, A, R>(identity: Supplier<A>, interrupt: Predicate<E>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): Collector<E, A, R>;
|
|
47
|
+
<E, A, R>(identity: Supplier<A>, interrupt: Predicate<E>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): Collector<E, A, R>;
|
|
48
|
+
<E, A, R>(identity: Supplier<A>, interrupt: BiPredicate<E, bigint>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): Collector<E, A, R>;
|
|
49
|
+
<E, A, R>(identity: Supplier<A>, interrupt: BiPredicate<E, bigint>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): Collector<E, A, R>;
|
|
50
|
+
<E, A, R>(identity: Supplier<A>, interrupt: TriPredicate<E, bigint, A>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): Collector<E, A, R>;
|
|
51
|
+
<E, A, R>(identity: Supplier<A>, interrupt: TriPredicate<E, bigint, A>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): Collector<E, A, R>;
|
|
42
52
|
}
|
|
43
53
|
export declare let useCollect: UseCollect;
|
|
44
54
|
export declare let useCount: <E = unknown>() => Collector<E, bigint, bigint>;
|
|
45
|
-
|
|
55
|
+
interface UseError {
|
|
46
56
|
<E = unknown>(): Collector<E, string, string>;
|
|
47
57
|
<E = unknown>(accumulator: BiFunctional<string, E, string>): Collector<E, string, string>;
|
|
48
58
|
<E = unknown>(accumulator: TriFunctional<string, E, bigint, string>): Collector<E, string, string>;
|
|
@@ -50,28 +60,45 @@ export interface UseError {
|
|
|
50
60
|
<E = unknown>(prefix: string, accumulator: TriFunctional<string, E, bigint, string>, suffix: string): Collector<E, string, string>;
|
|
51
61
|
}
|
|
52
62
|
export declare let useError: UseError;
|
|
63
|
+
interface UseFindAt {
|
|
64
|
+
<E>(index: number): Collector<E, Array<E>, Optional<E>>;
|
|
65
|
+
<E>(index: bigint): Collector<E, Array<E>, Optional<E>>;
|
|
66
|
+
}
|
|
67
|
+
export declare let useFindAt: UseFindAt;
|
|
53
68
|
export declare let useFindFirst: <E>() => Collector<E, Optional<E>, Optional<E>>;
|
|
54
69
|
export declare let useFindAny: <E>() => Collector<E, Optional<E>, Optional<E>>;
|
|
55
70
|
export declare let useFindLast: <E>() => Collector<E, Optional<E>, Optional<E>>;
|
|
56
|
-
|
|
71
|
+
interface UseFindMaximum {
|
|
57
72
|
<E>(): Collector<E, Optional<E>, Optional<E>>;
|
|
58
73
|
<E>(comparator: Comparator<E>): Collector<E, Optional<E>, Optional<E>>;
|
|
59
74
|
}
|
|
60
75
|
export declare let useFindMaximum: UseFindMaximum;
|
|
61
|
-
|
|
76
|
+
interface UseFindMinimum {
|
|
62
77
|
<E>(): Collector<E, Optional<E>, Optional<E>>;
|
|
63
78
|
<E>(comparator: Comparator<E>): Collector<E, Optional<E>, Optional<E>>;
|
|
64
79
|
}
|
|
65
80
|
export declare let useFindMinimum: UseFindMinimum;
|
|
66
|
-
|
|
81
|
+
interface UseForEach {
|
|
67
82
|
<E>(action: Consumer<E>): Collector<E, bigint, bigint>;
|
|
68
83
|
<E>(action: BiConsumer<E, bigint>): Collector<E, bigint, bigint>;
|
|
69
84
|
}
|
|
70
85
|
export declare let useForEach: UseForEach;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
86
|
+
interface UseNonMatch {
|
|
87
|
+
<E>(predicate: Predicate<E>): Collector<E, boolean, boolean>;
|
|
88
|
+
<E>(predicate: BiPredicate<E, bigint>): Collector<E, boolean, boolean>;
|
|
89
|
+
}
|
|
90
|
+
export declare let useNoneMatch: UseNonMatch;
|
|
91
|
+
interface UseGroup {
|
|
92
|
+
<E, K>(classifier: Functional<E, K>): Collector<E, Map<K, E[]>, Map<K, E[]>>;
|
|
93
|
+
<E, K>(classifier: BiFunctional<E, bigint, K>): Collector<E, Map<K, E[]>, Map<K, E[]>>;
|
|
94
|
+
}
|
|
95
|
+
export declare let useGroup: UseGroup;
|
|
96
|
+
interface UseGroupBy {
|
|
97
|
+
<E, K, V>(keyExtractor: Functional<E, K>, valueExtractor: Functional<E, V>): Collector<E, Map<K, V[]>, Map<K, V[]>>;
|
|
98
|
+
<E, K, V>(keyExtractor: BiFunctional<E, bigint, K>, valueExtractor: BiFunctional<E, bigint, V>): Collector<E, Map<K, V[]>, Map<K, V[]>>;
|
|
99
|
+
}
|
|
100
|
+
export declare let useGroupBy: UseGroupBy;
|
|
101
|
+
interface UseJoin {
|
|
75
102
|
<E = unknown>(): Collector<E, string, string>;
|
|
76
103
|
<E = unknown>(delimiter: string): Collector<E, string, string>;
|
|
77
104
|
<E = unknown>(prefix: string, delimiter: string, suffix: string): Collector<E, string, string>;
|
|
@@ -79,7 +106,7 @@ export interface UseJoin {
|
|
|
79
106
|
<E = unknown>(prefiex: string, accumulator: TriFunctional<string, E, bigint, string>, suffix: string): Collector<E, string, string>;
|
|
80
107
|
}
|
|
81
108
|
export declare let useJoin: UseJoin;
|
|
82
|
-
|
|
109
|
+
interface UseLog {
|
|
83
110
|
<E = unknown>(): Collector<E, string, string>;
|
|
84
111
|
<E = unknown>(accumulator: BiFunctional<string, E, string>): Collector<E, string, string>;
|
|
85
112
|
<E = unknown>(accumulator: TriFunctional<string, E, bigint, string>): Collector<E, string, string>;
|
|
@@ -88,8 +115,12 @@ export interface UseLog {
|
|
|
88
115
|
}
|
|
89
116
|
export declare let useLog: UseLog;
|
|
90
117
|
export declare let usePartition: <E>(count: bigint) => Collector<E, Array<Array<E>>, Array<Array<E>>>;
|
|
91
|
-
|
|
92
|
-
|
|
118
|
+
interface UsePartitionBy {
|
|
119
|
+
<E>(classifier: Functional<E, bigint>): Collector<E, Array<E[]>, Array<E[]>>;
|
|
120
|
+
<E>(classifier: BiFunctional<E, bigint, bigint>): Collector<E, Array<E[]>, Array<E[]>>;
|
|
121
|
+
}
|
|
122
|
+
export declare let usePartitionBy: UsePartitionBy;
|
|
123
|
+
interface UseReduce {
|
|
93
124
|
<E>(accumulator: BiFunctional<E, E, E>): Collector<E, Optional<E>, Optional<E>>;
|
|
94
125
|
<E>(accumulator: TriFunctional<E, E, bigint, E>): Collector<E, Optional<E>, Optional<E>>;
|
|
95
126
|
<E>(identity: E, accumulator: BiFunctional<E, E, E>): Collector<E, E, E>;
|
|
@@ -99,99 +130,109 @@ export interface UseReduce {
|
|
|
99
130
|
}
|
|
100
131
|
export declare let useReduce: UseReduce;
|
|
101
132
|
export declare let useToArray: <E>() => Collector<E, E[], E[]>;
|
|
102
|
-
|
|
133
|
+
interface UseToMap {
|
|
134
|
+
<E, K, V>(keyExtractor: Functional<E, K>, valueExtractor: Functional<E, V>): Collector<E, Map<K, V>, Map<K, V>>;
|
|
135
|
+
<E, K, V>(keyExtractor: BiFunctional<E, bigint, K>, valueExtractor: BiFunctional<E, bigint, V>): Collector<E, Map<K, V>, Map<K, V>>;
|
|
136
|
+
}
|
|
137
|
+
export declare let useToMap: UseToMap;
|
|
138
|
+
interface UseToHashMap {
|
|
139
|
+
<E, K, V>(keyExtractor: Functional<E, K>, valueExtractor: Functional<E, V>): Collector<E, HashMap<K, V>, HashMap<K, V>>;
|
|
140
|
+
<E, K, V>(keyExtractor: BiFunctional<E, bigint, K>, valueExtractor: BiFunctional<E, bigint, V>): Collector<E, HashMap<K, V>, HashMap<K, V>>;
|
|
141
|
+
}
|
|
142
|
+
export declare let useToHashMap: UseToHashMap;
|
|
103
143
|
export declare let useToSet: <E>() => Collector<E, Set<E>, Set<E>>;
|
|
104
|
-
export
|
|
144
|
+
export declare let useToHashSet: <E>() => Collector<E, HashSet<E>, HashSet<E>>;
|
|
145
|
+
interface UseWrite {
|
|
105
146
|
<E, S = string>(stream: WritableStream<S>): Collector<E, Promise<WritableStream<S>>, Promise<WritableStream<S>>>;
|
|
106
147
|
<E, S = string>(stream: WritableStream<S>, accumulator: BiFunctional<WritableStream<S>, E, WritableStream<S>>): Collector<E, Promise<WritableStream<S>>, Promise<WritableStream<S>>>;
|
|
107
148
|
<E, S = string>(stream: WritableStream<S>, accumulator: TriFunctional<WritableStream<S>, E, bigint, WritableStream<S>>): Collector<E, Promise<WritableStream<S>>, Promise<WritableStream<S>>>;
|
|
108
149
|
}
|
|
109
150
|
export declare let useWrite: UseWrite;
|
|
110
|
-
|
|
151
|
+
interface UseNumericSummate {
|
|
111
152
|
<E>(): Collector<E, number, number>;
|
|
112
153
|
<E>(mapper: Functional<E, number>): Collector<E, number, number>;
|
|
113
154
|
}
|
|
114
155
|
export declare let useNumericSummate: UseNumericSummate;
|
|
115
|
-
|
|
156
|
+
interface UseBigIntSummate {
|
|
116
157
|
<E>(): Collector<E, bigint, bigint>;
|
|
117
158
|
<E>(mapper: Functional<E, bigint>): Collector<E, bigint, bigint>;
|
|
118
159
|
}
|
|
119
160
|
export declare let useBigIntSummate: UseBigIntSummate;
|
|
120
|
-
|
|
161
|
+
interface UseNumericAverage {
|
|
121
162
|
<E>(): Collector<E, NumericAverageAccumulator, number>;
|
|
122
163
|
<E>(mapper: Functional<E, number>): Collector<E, NumericAverageAccumulator, number>;
|
|
123
164
|
}
|
|
124
|
-
|
|
165
|
+
interface NumericAverageAccumulator {
|
|
125
166
|
summate: number;
|
|
126
167
|
count: number;
|
|
127
168
|
}
|
|
128
169
|
export declare let useNumericAverage: UseNumericAverage;
|
|
129
|
-
|
|
170
|
+
interface UseBigIntAverage {
|
|
130
171
|
<E>(): Collector<E, BigIntAverageAccumulator, bigint>;
|
|
131
172
|
<E>(mapper: Functional<E, bigint>): Collector<E, BigIntAverageAccumulator, bigint>;
|
|
132
173
|
}
|
|
133
|
-
|
|
174
|
+
interface BigIntAverageAccumulator {
|
|
134
175
|
summate: bigint;
|
|
135
176
|
count: bigint;
|
|
136
177
|
}
|
|
137
178
|
export declare let useBigIntAverage: UseBigIntAverage;
|
|
138
179
|
export declare let useFrequency: <E>() => Collector<E, Map<E, bigint>, Map<E, bigint>>;
|
|
139
|
-
|
|
180
|
+
interface UseNumericMode {
|
|
140
181
|
<E>(): Collector<E, Map<number, bigint>, number>;
|
|
141
182
|
<E>(mapper: Functional<E, number>): Collector<E, Map<number, bigint>, number>;
|
|
142
183
|
}
|
|
143
184
|
export declare let useNumericMode: UseNumericMode;
|
|
144
|
-
|
|
185
|
+
interface UseBigIntMode {
|
|
145
186
|
<E>(): Collector<E, Map<bigint, bigint>, bigint>;
|
|
146
187
|
<E>(mapper: Functional<E, bigint>): Collector<E, Map<bigint, bigint>, bigint>;
|
|
147
188
|
}
|
|
148
189
|
export declare let useBigIntMode: UseBigIntMode;
|
|
149
|
-
|
|
190
|
+
interface UseNumericVariance {
|
|
150
191
|
<E>(): Collector<E, VarianceAccumulator, number>;
|
|
151
192
|
<E>(mapper: Functional<E, number>): Collector<E, VarianceAccumulator, number>;
|
|
152
193
|
}
|
|
153
|
-
|
|
194
|
+
interface VarianceAccumulator {
|
|
154
195
|
summate: number;
|
|
155
196
|
summateOfSquares: number;
|
|
156
197
|
count: number;
|
|
157
198
|
}
|
|
158
199
|
export declare let useNumericVariance: UseNumericVariance;
|
|
159
|
-
|
|
200
|
+
interface UseBigIntVariance {
|
|
160
201
|
<E>(): Collector<E, BigIntVarianceAccumulator, bigint>;
|
|
161
202
|
<E>(mapper: Functional<E, bigint>): Collector<E, BigIntVarianceAccumulator, bigint>;
|
|
162
203
|
}
|
|
163
|
-
|
|
204
|
+
interface BigIntVarianceAccumulator {
|
|
164
205
|
summate: bigint;
|
|
165
206
|
summateOfSquares: bigint;
|
|
166
207
|
count: bigint;
|
|
167
208
|
}
|
|
168
209
|
export declare let useBigIntVariance: UseBigIntVariance;
|
|
169
|
-
|
|
210
|
+
interface UseNumericStandardDeviation {
|
|
170
211
|
<E>(): Collector<E, StandardDeviationAccumulator, number>;
|
|
171
212
|
<E>(mapper: Functional<E, number>): Collector<E, StandardDeviationAccumulator, number>;
|
|
172
213
|
}
|
|
173
|
-
|
|
214
|
+
interface StandardDeviationAccumulator {
|
|
174
215
|
summate: number;
|
|
175
216
|
summateOfSquares: number;
|
|
176
217
|
count: number;
|
|
177
218
|
}
|
|
178
219
|
export declare let useNumericStandardDeviation: UseNumericStandardDeviation;
|
|
179
|
-
|
|
220
|
+
interface UseBigIntStandardDeviation {
|
|
180
221
|
<E>(): Collector<E, BigIntStandardDeviationAccumulator, bigint>;
|
|
181
222
|
<E>(mapper: Functional<E, bigint>): Collector<E, BigIntStandardDeviationAccumulator, bigint>;
|
|
182
223
|
}
|
|
183
|
-
|
|
224
|
+
interface BigIntStandardDeviationAccumulator {
|
|
184
225
|
summate: bigint;
|
|
185
226
|
summateOfSquares: bigint;
|
|
186
227
|
count: bigint;
|
|
187
228
|
}
|
|
188
229
|
export declare let useBigIntStandardDeviation: UseBigIntStandardDeviation;
|
|
189
|
-
|
|
230
|
+
interface UseNumericMedian {
|
|
190
231
|
<E>(): Collector<E, number[], number>;
|
|
191
232
|
<E>(mapper: Functional<E, number>): Collector<E, number[], number>;
|
|
192
233
|
}
|
|
193
234
|
export declare let useNumericMedian: UseNumericMedian;
|
|
194
|
-
|
|
235
|
+
interface UseBigIntMedian {
|
|
195
236
|
<E>(): Collector<E, bigint[], bigint>;
|
|
196
237
|
<E>(mapper: Functional<E, bigint>): Collector<E, bigint[], bigint>;
|
|
197
238
|
}
|