mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
updates for streamjs 1.5.0
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
7
streamjs/streamjs.d.ts
vendored
7
streamjs/streamjs.d.ts
vendored
@@ -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>;
|
||||
|
||||
Reference in New Issue
Block a user