Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix range example

  • Loading branch information...
commit 1bff63b77bed297b2e1b81b07efc7127b2b8f103 1 parent 781dd27
@tj tj authored
Showing with 3 additions and 5 deletions.
  1. +3 −5 examples/range.js
View
8 examples/range.js
@@ -6,8 +6,6 @@
var Enumerable = require('..');
function Range(from, to) {
- this.i = 0;
- this.curr = from;
this.from = from;
this.to = to;
}
@@ -16,9 +14,9 @@ Enumerable(Range.prototype);
Range.prototype.__iterate__ = function(){
var self = this;
- return function(){
- if (self.curr > self.to) return;
- return [self.curr++, self.i++];
+ return {
+ length: function(){ return self.to - self.from + 1 },
+ get: function(i){ return self.from + i }
}
};
Please sign in to comment.
Something went wrong with that request. Please try again.