source: frontend/node_modules/underscore/amd/range.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 638 bytes
Line 
1define(function () {
2
3 // Generate an integer Array containing an arithmetic progression. A port of
4 // the native Python `range()` function. See
5 // [the Python documentation](https://docs.python.org/library/functions.html#range).
6 function range(start, stop, step) {
7 if (stop == null) {
8 stop = start || 0;
9 start = 0;
10 }
11 if (!step) {
12 step = stop < start ? -1 : 1;
13 }
14
15 var length = Math.max(Math.ceil((stop - start) / step), 0);
16 var range = Array(length);
17
18 for (var idx = 0; idx < length; idx++, start += step) {
19 range[idx] = start;
20 }
21
22 return range;
23 }
24
25 return range;
26
27});
Note: See TracBrowser for help on using the repository browser.