JavaScript implementation of Python xrange() builtin

1
2
3
4
5
6
7
8
9
function xrange(b0, b1, quantum) {
	if (!quantum) { quantum = 1; }
	if (!b1) { b1 = b0; b0 = 0; }
	out = [];
	for (var i = b0, idx = 0; i < b1; i += quantum, idx++) {
		out[idx] = i;
	}
	return out;
}

More like this

  1. Hide Emails by epicserve 5 years, 1 month ago
  2. jsonify template filter by skam 6 years, 11 months ago
  3. timeto template filter by japerk 5 years ago
  4. Django Drag and Drop Using YUI by veeravendhan 4 years, 11 months ago
  5. "for" template tag with support for "else" if array is empty by jezdez 6 years, 3 months ago

Comments

(Forgotten your password?)