updates for streamjs 1.5.0

This commit is contained in:
Bence Eros
2015-06-15 12:32:10 +02:00
parent 1a43e96e58
commit b116936ea5
3 changed files with 10 additions and 6 deletions

View File

@@ -1,5 +1,8 @@
# StreamJS Type Definitions
Note: this definition file is not for the StreamJS library available at http://streamjs.org but the one at
http://winterbe.github.io/streamjs/ .
Unsupported StreamJS function / method signatures:
* Stream(collection)
* Stream(string)

View File

@@ -4,7 +4,7 @@ var numStream: Stream<number>;
numStream = Stream.of(1, 2, 3);
numStream = Stream.range(1, 5);
numStream = Stream.rangeClosed(1, 5);
numStream = Stream.from([1, 2, 3]);
Stream.generate(function() {
return 1;
});
@@ -35,7 +35,7 @@ var strStream = numStream
.takeWhile(/^aa.*$/)
.slice(5, 2)
;
strStream = Stream.from("foobar");
var strArray = strStream.toArray();
strArray = strStream.toList();
strStream.each(s => console.log(s));
@@ -77,7 +77,7 @@ class MyList {
var elems: any[];
var myStream = Stream.make([new MyList, new MyList]);
var myStream = Stream.from([new MyList, new MyList]);
elems = myStream
.flatMap(list => list.elems)
.toArray();

View File

@@ -1,11 +1,12 @@
// Type definitions for streamjs 1.4.0
// Project: https://github.com/winterbe/streamjs
// Type definitions for streamjs 1.5.0
// Project: http://winterbe.github.io/streamjs/
// Definitions by: Bence Eros <https://github.com/erosb>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare class Stream<T> {
// static make <T> (...elems: T[]): Stream<T>;
static make <T> (elems: T[]): Stream<T>;
static from <T> (elems: T[]): Stream<T>;
static from(str: string): Stream<string>;
static of<T>(...elems: T[]): Stream<T>;
static range (startInclusive: number, endExclusive: number): Stream<number>;
static rangeClosed (startInclusive: number, endInclusive: number): Stream<number>;