mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
adding some missing methods, adding README with unsupported method list
This commit is contained in:
22
streamjs/README.md
Normal file
22
streamjs/README.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# StreamJS Type Definitions
|
||||
|
||||
Unsupported StreamJS function / method signatures:
|
||||
* Stream(collection)
|
||||
* Stream(string)
|
||||
* Stream.empty()
|
||||
* filter(sample)
|
||||
* map(path)
|
||||
* flatMap(path)
|
||||
* sorted(path)
|
||||
* takeWhile(sample)
|
||||
* dropWhile(sample)
|
||||
* min(path)
|
||||
* max(path)
|
||||
* sum(path)
|
||||
* average(path)
|
||||
* allMatch(sample)
|
||||
* anyMatch(sample)
|
||||
* groupingBy(path)
|
||||
* toMap(path, mergeFunction)
|
||||
* partitioningBy(sample);
|
||||
* Optional.empty()
|
||||
@@ -1,11 +1,9 @@
|
||||
// <reference file="streamjs.d.ts" />
|
||||
|
||||
var numStream: Stream<number>;
|
||||
// numStream = Stream.make(10, 20);
|
||||
numStream = Stream.make([10, 20]);
|
||||
numStream = Stream.of(1, 2, 3);
|
||||
numStream = Stream.range(1, 5);
|
||||
numStream = Stream.rangeClosed(1, 5);
|
||||
// numStream = Stream.empty();
|
||||
|
||||
Stream.generate(function() {
|
||||
return 1;
|
||||
@@ -37,7 +35,9 @@ var strStream = numStream
|
||||
;
|
||||
|
||||
var strArray = strStream.toArray();
|
||||
|
||||
strArray = strStream.toList();
|
||||
strStream.each(s => console.log(s));
|
||||
strStream.filter(/^$/);
|
||||
strStream.forEach(s => console.log(s));
|
||||
var opt: Stream.Optional<string> = strStream.findFirst();
|
||||
opt = strStream.findAny();
|
||||
|
||||
4
streamjs/streamjs.d.ts
vendored
4
streamjs/streamjs.d.ts
vendored
@@ -6,6 +6,7 @@
|
||||
declare class Stream<T> {
|
||||
// static make <T> (...elems: T[]): Stream<T>;
|
||||
static make <T> (elems: T[]): Stream<T>;
|
||||
static of<T>(...elems: T[]): Stream<T>;
|
||||
static range (startInclusive: number, endExclusive: number): Stream<number>;
|
||||
static rangeClosed (startInclusive: number, endInclusive: number): Stream<number>;
|
||||
static generate <T> (supplier: Stream.Supplier<T>): Stream<T>;
|
||||
@@ -23,7 +24,9 @@ declare class Stream<T> {
|
||||
distinct(): Stream<T>;
|
||||
dropWhile(predicate: Stream.Predicate<T>): Stream<T>;
|
||||
dropWhile(regexp: RegExp): Stream<string>;
|
||||
each(consumer: Stream.Consumer<T>): void;
|
||||
filter(predicate: Stream.Predicate<T>): Stream<T>;
|
||||
filter(regexp: RegExp): Stream<string>;
|
||||
findAny(): Stream.Optional<T>;
|
||||
findFirst(): Stream.Optional<T>;
|
||||
forEach(consumer: Stream.Consumer<T>): void;
|
||||
@@ -69,6 +72,7 @@ declare class Stream<T> {
|
||||
takeWhile(predicate: Stream.Predicate<T>): Stream<T>;
|
||||
takeWhile(regexp: RegExp): Stream<string>;
|
||||
toArray(): T[];
|
||||
toList(): T[];
|
||||
toMap(keyMapper: Stream.Function<T, string>, mergeFunction?: Stream.Accumulator<T>): T[];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user