adding Stream class with static factory methods

This commit is contained in:
Bence Eros
2015-06-12 19:00:56 +02:00
parent 066819c65f
commit 52038eca87
2 changed files with 23 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
// <reference file="streamjs.d.ts" />
var numStream = Stream.make(10, 20);
numStream = Stream.make([10, 20]);
numStream = Stream.range(1, 5);
numStream = Stream.rangeClosed(1, 5);
Stream.generate(function() {
return 1;
});
Stream.generate(() => 1);
+12
View File
@@ -0,0 +1,12 @@
// Type definitions for streamjs 1.4.0
// Project: http://streamjs.org/
// 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 range<T>(startInclusive: number, endExclusive: number): Stream<T>;
static rangeClosed<T>(startInclusive: number, endInclusive: number): Stream<T>;
static generate<T>(supplier: () => T): Stream<T>;
}