mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
adding support for most of the methods receiving sample or path as parameter
This commit is contained in:
Vendored
+23
-2
@@ -1,5 +1,5 @@
|
||||
// Type definitions for streamjs 1.4.0
|
||||
// Project: http://streamjs.org/
|
||||
// Project: https://github.com/winterbe/streamjs
|
||||
// Definitions by: Bence Eros <https://github.com/erosb>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
@@ -15,30 +15,40 @@ declare class Stream<T> {
|
||||
|
||||
anyMatch(predicate: Stream.Predicate<T>): boolean;
|
||||
anyMatch(regexp: RegExp): boolean;
|
||||
anyMatch(sample: Stream.Sample): boolean;
|
||||
allMatch(predicate: Stream.Predicate<T>): boolean;
|
||||
allMatch(regexp: RegExp): boolean;
|
||||
allMatch(sample: Stream.Sample): boolean;
|
||||
average(): number;
|
||||
average(path: string): number;
|
||||
avg(): number;
|
||||
avg(path: string): number;
|
||||
collect(collector: Stream.Collector<T>): T;
|
||||
count(): number;
|
||||
distinct(): Stream<T>;
|
||||
dropWhile(predicate: Stream.Predicate<T>): Stream<T>;
|
||||
dropWhile(regexp: RegExp): Stream<string>;
|
||||
dropWhile(sample: Stream.Sample): Stream<T>;
|
||||
each(consumer: Stream.Consumer<T>): void;
|
||||
filter(predicate: Stream.Predicate<T>): Stream<T>;
|
||||
filter(regexp: RegExp): Stream<string>;
|
||||
filter(sample: Stream.Sample): Stream<T>;
|
||||
findAny(): Stream.Optional<T>;
|
||||
findFirst(): Stream.Optional<T>;
|
||||
forEach(consumer: Stream.Consumer<T>): void;
|
||||
|
||||
groupBy(mapper: Stream.Function<T, string>): Stream.GroupingResult<T>;
|
||||
groupBy(path: string): Stream.GroupingResult<T>;
|
||||
groupingBy(mapper: Stream.Function<T, string>): Stream.GroupingResult<T>;
|
||||
groupingBy(path: string): Stream.GroupingResult<T>;
|
||||
indexBy(keyMapper: Stream.Function<T, string>, mergeFunction?: Stream.Accumulator<T>): T[];
|
||||
map <U> (mapper: Stream.Function<T, U>): Stream<U>;
|
||||
max(): Stream.Optional<T>;
|
||||
max(comparator: Stream.Comparator<T>): Stream.Optional<T>;
|
||||
max(path: string): Stream.Optional<T>;
|
||||
min(): Stream.Optional<T>;
|
||||
min(comparator: Stream.Comparator<T>): Stream.Optional<T>;
|
||||
min(path: string): Stream.Optional<T>;
|
||||
noneMatch(predicate: (elem: T) => boolean): boolean;
|
||||
noneMatch(regexp: RegExp): boolean;
|
||||
flatMap <U> (mapper: Stream.Function<T, U[]>): Stream<U>;
|
||||
@@ -52,10 +62,12 @@ declare class Stream<T> {
|
||||
limit(limit: number): Stream<T>;
|
||||
partitioningBy(predicate: Stream.Predicate<T>): T[][];
|
||||
partitionBy(predicate: Stream.Predicate<T>): T[][];
|
||||
partitionBy(sample: Stream.Sample): T[][];
|
||||
partitioningBy(regexp: RegExp): T[][];
|
||||
partitionBy(regexp: RegExp): T[][];
|
||||
partitioningBy(size: number): T[][];
|
||||
partitionBy(size: number): T[][];
|
||||
partitioningBy(sample: Stream.Sample): T[][];
|
||||
peek(consumer: Stream.Consumer<T>): Stream<T>;
|
||||
reduce(identity: T, accumulator: Stream.Accumulator<T>): T;
|
||||
reduce(accumulator: Stream.Accumulator<T>): Stream.Optional<T>;
|
||||
@@ -63,21 +75,30 @@ declare class Stream<T> {
|
||||
size(): number;
|
||||
sorted(): Stream<T>;
|
||||
sorted(comparator: Stream.Comparator<T>): Stream<T>;
|
||||
sorted(path: string): Stream<T>;
|
||||
sort(): Stream<T>;
|
||||
sort(comparator: Stream.Comparator<T>): Stream<T>;
|
||||
sort(path: string): Stream<T>;
|
||||
shuffle(): Stream<T>;
|
||||
skip(n: number): Stream<T>;
|
||||
slice(begin, end): Stream<T>;
|
||||
sum(): T;
|
||||
sum(): number;
|
||||
sum(path: string): number;
|
||||
takeWhile(predicate: Stream.Predicate<T>): Stream<T>;
|
||||
takeWhile(regexp: RegExp): Stream<string>;
|
||||
takeWhile(sample: Stream.Sample): Stream<T>;
|
||||
toArray(): T[];
|
||||
toList(): T[];
|
||||
toMap(keyMapper: Stream.Function<T, string>, mergeFunction?: Stream.Accumulator<T>): T[];
|
||||
toMap(path: string, mergeFunction?: Stream.Accumulator<T>): T[];
|
||||
}
|
||||
|
||||
declare module Stream {
|
||||
|
||||
export interface Sample {
|
||||
[index: string]: any
|
||||
}
|
||||
|
||||
export interface Accumulator<T> {
|
||||
(e1: T, e2: T): T;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user