semantic-typescript 0.3.7 → 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 +82 -2
- package/dist/collector.d.ts +91 -50
- package/dist/collector.js +103 -19
- package/dist/factory.d.ts +5 -1
- package/dist/factory.js +19 -1
- package/dist/guard.d.ts +31 -22
- package/dist/guard.js +89 -59
- package/dist/hash.d.ts +14 -0
- package/dist/hash.js +211 -0
- package/dist/hook.d.ts +16 -3
- package/dist/hook.js +59 -12
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/map.d.ts +72 -0
- package/dist/map.js +247 -0
- package/dist/optional.js +18 -0
- package/dist/semantic.d.ts +15 -4
- package/dist/semantic.js +34 -29
- package/dist/set.d.ts +19 -0
- package/dist/set.js +64 -0
- package/dist/statistics.js +43 -7
- 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 +12 -0
- package/package.json +1 -5
- package/readme.cn.md +400 -133
- package/readme.md +342 -241
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";
|
|
@@ -8,6 +8,13 @@ import { invalidate, validate } from "./utility";
|
|
|
8
8
|
export class Collectable {
|
|
9
9
|
Collectable = CollectableSymbol;
|
|
10
10
|
constructor() {
|
|
11
|
+
Object.defineProperty(this, "Collectable", {
|
|
12
|
+
value: CollectableSymbol,
|
|
13
|
+
enumerable: false,
|
|
14
|
+
writable: false,
|
|
15
|
+
configurable: false
|
|
16
|
+
});
|
|
17
|
+
Object.freeze(this);
|
|
11
18
|
}
|
|
12
19
|
anyMatch(predicate) {
|
|
13
20
|
if (isFunction(predicate)) {
|
|
@@ -95,6 +102,25 @@ export class Collectable {
|
|
|
95
102
|
throw new Error("Uncaught error on findAny.");
|
|
96
103
|
}
|
|
97
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
|
+
}
|
|
98
124
|
findFirst() {
|
|
99
125
|
try {
|
|
100
126
|
return useFindFirst().collect(this.source());
|
|
@@ -335,6 +361,14 @@ export class Collectable {
|
|
|
335
361
|
throw new Error("Uncaught error on toMap.");
|
|
336
362
|
}
|
|
337
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
|
+
}
|
|
338
372
|
toSet() {
|
|
339
373
|
try {
|
|
340
374
|
return useToSet().collect(this.source());
|
|
@@ -343,6 +377,14 @@ export class Collectable {
|
|
|
343
377
|
throw new Error("Uncaught error on toSet.");
|
|
344
378
|
}
|
|
345
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
|
+
}
|
|
346
388
|
write(argument1, argument2) {
|
|
347
389
|
if (isObject(argument1)) {
|
|
348
390
|
try {
|
|
@@ -363,6 +405,9 @@ export class Collectable {
|
|
|
363
405
|
}
|
|
364
406
|
}
|
|
365
407
|
;
|
|
408
|
+
Object.freeze(Collectable);
|
|
409
|
+
Object.freeze(Collectable.prototype);
|
|
410
|
+
Object.freeze(Object.getPrototypeOf(Collectable));
|
|
366
411
|
export class UnorderedCollectable extends Collectable {
|
|
367
412
|
UnorderedCollectable = UnorderedCollectableSymbol;
|
|
368
413
|
generator;
|
|
@@ -370,6 +415,21 @@ export class UnorderedCollectable extends Collectable {
|
|
|
370
415
|
super();
|
|
371
416
|
if (isFunction(argument1)) {
|
|
372
417
|
this.generator = argument1;
|
|
418
|
+
Object.defineProperties(this, {
|
|
419
|
+
"UnorderedCollectable": {
|
|
420
|
+
value: UnorderedCollectableSymbol,
|
|
421
|
+
writable: false,
|
|
422
|
+
enumerable: false,
|
|
423
|
+
configurable: false
|
|
424
|
+
},
|
|
425
|
+
"generator": {
|
|
426
|
+
value: argument1,
|
|
427
|
+
writable: false,
|
|
428
|
+
enumerable: false,
|
|
429
|
+
configurable: false
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
Object.freeze(this);
|
|
373
433
|
}
|
|
374
434
|
else {
|
|
375
435
|
throw new TypeError("Source must be an iterable or a generator function.");
|
|
@@ -398,6 +458,9 @@ export class UnorderedCollectable extends Collectable {
|
|
|
398
458
|
}
|
|
399
459
|
}
|
|
400
460
|
;
|
|
461
|
+
Object.freeze(UnorderedCollectable);
|
|
462
|
+
Object.freeze(UnorderedCollectable.prototype);
|
|
463
|
+
Object.freeze(Object.getPrototypeOf(UnorderedCollectable));
|
|
401
464
|
export class OrderedCollectable extends Collectable {
|
|
402
465
|
OrderedCollectable = OrderedCollectableSymbol;
|
|
403
466
|
buffer;
|
|
@@ -425,6 +488,20 @@ export class OrderedCollectable extends Collectable {
|
|
|
425
488
|
return Number(a.index - b.index);
|
|
426
489
|
});
|
|
427
490
|
}
|
|
491
|
+
Object.defineProperties(this, {
|
|
492
|
+
"OrderedCollectable": {
|
|
493
|
+
value: OrderedCollectableSymbol,
|
|
494
|
+
writable: false,
|
|
495
|
+
enumerable: false,
|
|
496
|
+
configurable: false
|
|
497
|
+
},
|
|
498
|
+
"buffer": {
|
|
499
|
+
value: this.buffer,
|
|
500
|
+
writable: false,
|
|
501
|
+
enumerable: false,
|
|
502
|
+
configurable: false
|
|
503
|
+
}
|
|
504
|
+
});
|
|
428
505
|
}
|
|
429
506
|
catch (error) {
|
|
430
507
|
throw new Error("Uncaught error on creating buffer.");
|
|
@@ -472,3 +549,6 @@ export class OrderedCollectable extends Collectable {
|
|
|
472
549
|
}
|
|
473
550
|
}
|
|
474
551
|
;
|
|
552
|
+
Object.freeze(OrderedCollectable);
|
|
553
|
+
Object.freeze(OrderedCollectable.prototype);
|
|
554
|
+
Object.freeze(Object.getPrototypeOf(OrderedCollectable));
|
package/dist/collector.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
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
8
|
protected identity: Supplier<A>;
|
|
@@ -8,10 +10,10 @@ export declare class Collector<E, A, R> {
|
|
|
8
10
|
protected accumulator: BiFunctional<A, E, A> | TriFunctional<A, E, bigint, A>;
|
|
9
11
|
protected finisher: Functional<A, R>;
|
|
10
12
|
protected readonly Collector: symbol;
|
|
11
|
-
protected constructor(identity: Supplier<A>,
|
|
12
|
-
protected constructor(identity: Supplier<A>,
|
|
13
|
-
protected constructor(identity: Supplier<A>,
|
|
14
|
-
protected constructor(identity: Supplier<A>,
|
|
13
|
+
protected constructor(identity: Supplier<A>, interrupt: Predicate<E>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>);
|
|
14
|
+
protected constructor(identity: Supplier<A>, interrupt: BiPredicate<E, bigint>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>);
|
|
15
|
+
protected constructor(identity: Supplier<A>, interrupt: Predicate<E>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>);
|
|
16
|
+
protected constructor(identity: Supplier<A>, interrupt: BiPredicate<E, bigint>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>);
|
|
15
17
|
collect(generator: Generator<E>): R;
|
|
16
18
|
collect(iterable: Iterable<E>): R;
|
|
17
19
|
collect(semantic: Semantic<E>): 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
|
}
|