basic package for manipulating generator-iterators in javascript
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
stream.js
test.js

README.md

This is a package for manipulating generators and iterators in Javascript 1.7+.

A generator is an object returned from a function which contains yield statements.

e.g. in Rhino version(180); load('stream.js');

var readme = (function(reader) {
  for (var line = reader.readLine(); line; line = reader.readLine()) {
    yield line;
  }
  reader.close();
  throw StopIteration;
})(new java.io.BufferedReader(new java.io.FileReader('README.md')));

Stream.count(1).zip(readme).drain().forEach(function(pair) { print(pair); });