ruby-enumerator

Library can use ruby Enumerator and Enumerable methods in javascript.

ruby-enumerator.js

ruby-enumerator is object that usefull to loop.

if you write array loop in javascript. you write it?

var a = [1,2,3];
for (var i = 0, len = a.length; i < len; i++) {
  console.log(i); //=> 1,2,3 
}

or

[1,2,3].forEach(function(i){
  console.log(i); //=> 1,2,3 
});

ruby-enumerator.js

Enumerator([1,2,3]).each(function(i){
  console.log(i); //=> 1,2,3 
});
Enumerator(function(y){
  var a = 1;
  var b = 1;
  var tmp;
  for (;;) {
    y(a);
    tmp = b;
    b = a + b;
    a = tmp;
  }
}).take(10) //=> [1,1,2,3,5,8,13,21,34,55]