将Java 8 Streams API移植至JavaScript中:Stream.js

jopen 9年前

一个JavaScript的对象管道流,受Java 8 Streams API启发。

Stream([5, 9, 2, 4, 8, 1])     .filter(function (num) {        return num % 2 === 1;     })     .sorted()     .map(function (num) {        return "odd" + num;     })     .toArray();
Stream([1, 2, 3]);  Stream({a: 1, b: 2, c: 3});  Stream.of(1, 2, 3);  Stream.range(1, 4);

项目主页:http://www.open-open.com/lib/view/home/1421331386062