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

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

Fix frontend appearance

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