sync
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Converter } from "../types.js";
|
||||
import { SimpleCollector, ToArrayCollector, ToObjectCollector, ToMapCollector, ToSetCollector, JoinCollector, SumCollector, BigIntSumCollector, AverageCollector, BigIntAverageCollector } from "./impl.js";
|
||||
import { SimpleCollector, ToArrayCollector, ToObjectCollector, ToMapCollector, ToSetCollector, JoinCollector, SumCollector, BigIntSumCollector, AverageCollector, BigIntAverageCollector, ToObjectListCollector, ToMapListCollector } from "./impl.js";
|
||||
import { Collector } from "./types.js";
|
||||
|
||||
export function create<TElement, TAccumulator, TResult>(initialize: () => TAccumulator, accumulate: (accumulator: TAccumulator, element: TElement) => void,
|
||||
@@ -17,10 +17,18 @@ export function toObject<TElement, TKey extends PropertyKey, TValue>(keySelector
|
||||
return new ToObjectCollector<TElement, TKey, TValue>(keySelector, valueSelector);
|
||||
}
|
||||
|
||||
export function toObjectList<TElement, TKey extends PropertyKey, TValue>(keySelector: Converter<TElement, TKey>, valueSelector: Converter<TElement, TValue>): Collector<TElement, any, Record<TKey, TValue[]>> {
|
||||
return new ToObjectListCollector<TElement, TKey, TValue>(keySelector, valueSelector);
|
||||
}
|
||||
|
||||
export function toMap<TElement, TKey, TValue>(keySelector: Converter<TElement, TKey>, valueSelector: Converter<TElement, TValue>): Collector<TElement, any, Map<TKey, TValue>> {
|
||||
return new ToMapCollector<TElement, TKey, TValue>(keySelector, valueSelector);
|
||||
}
|
||||
|
||||
export function toMapList<TElement, TKey, TValue>(keySelector: Converter<TElement, TKey>, valueSelector: Converter<TElement, TValue>): Collector<TElement, any, Map<TKey, TValue[]>> {
|
||||
return new ToMapListCollector<TElement, TKey, TValue>(keySelector, valueSelector);
|
||||
}
|
||||
|
||||
const toSetCollector = new ToSetCollector<any>();
|
||||
|
||||
export function toSet<TElement>(): Collector<TElement, any, Set<TElement>> {
|
||||
|
||||
Reference in New Issue
Block a user