Created
January 3, 2014 10:12
-
-
Save st98/8235742 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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