/** | |
* Create a range string which can be evaluated to a native array. | |
* | |
* @param {int} start | |
* @param {int} end | |
* @return {string} | |
* @api public | |
*/ | |
function range(start, end) { | |
s = parseInt(start), e = parseInt(end), b = '[' + s | |
if (e > s) while (++s <= e) b += ',' + s | |
else while (--s >= e) b += ',' + s | |
return b + ']' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment