Skip to content

Instantly share code, notes, and snippets.

@st98
Created January 3, 2014 10:12
Show Gist options
  • Save st98/8235742 to your computer and use it in GitHub Desktop.
Save st98/8235742 to your computer and use it in GitHub Desktop.
(function () {
var count = function (start) {
start = start || 0;
return function () {
return start++;
};
};
var enumerate = function (iter, start) {
var result = [];
var cnt = count(), i;
return function () {
i = cnt();
if (typeof iter[i] !== 'undefined') {
return [i, iter[i]];
}
};
};
this.enumerate = enumerate;
}).call(this)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment