Skip to content

Commit

Permalink
only create one global object, and throw a plain object instead of an…
Browse files Browse the repository at this point in the history
… Error to stop iteration
  • Loading branch information
balpha committed Jun 20, 2011
1 parent bb68675 commit 299f890
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lyfe.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
};
}

var BreakIteration = new Error();
var BreakIteration = {};

var Generator = function (source) {
if (!(this instanceof Generator))
Expand Down Expand Up @@ -236,12 +236,7 @@
}
}

window.Generator = Generator;
window.Lyfe = {
BreakIteration: BreakIteration
};

Lyfe.Count = function (start, step) {
var Count = function (start, step) {
var i = start;
if (typeof step === "undefined")
step = 1;
Expand All @@ -253,9 +248,14 @@
});
}

Lyfe.Range = function (start, len) {
var Range = function (start, len) {
return Count(start, 1).take(len);
}

window.Generator = Generator;
Generator.BreakIteration = BreakIteration;
Generator.Count = Count;
Generator.Range = Range;

})();

0 comments on commit 299f890

Please sign in to comment.