Skip to content

1.6.0

Compare
Choose a tag to compare
@winterbe winterbe released this 26 Jun 07:04
· 27 commits to master since this release

This new version 1.6.0 adds additional support for ES6 features like Sets, Maps, Generators and Iterators. The unified Stream constructor function now additionally accepts ES6 sets, maps and iterators as input. See APIDOC for further explanations.

Please keep in mind that ES6 support is optional, so Stream.js is still compatible with ES5.

Example
function* fibonacci() {
    let [prev, cur] = [0, 1];
    while (true) {
        [prev, cur] = [cur, prev + cur];
        yield cur;
    }
}

Stream(fibonacci())
    .filter(n => n % 2)
    .takeWhile(n => n < 50)
    .toArray();      // 1, 3, 5, 13, 21