(start, stop, step)
| 1789 | // the native Python `range()` function. See |
| 1790 | // [the Python documentation](https://docs.python.org/library/functions.html#range). |
| 1791 | function range(start, stop, step) { |
| 1792 | if (stop == null) { |
| 1793 | stop = start || 0; |
| 1794 | start = 0; |
| 1795 | } |
| 1796 | if (!step) { |
| 1797 | step = stop < start ? -1 : 1; |
| 1798 | } |
| 1799 | |
| 1800 | var length = Math.max(Math.ceil((stop - start) / step), 0); |
| 1801 | var range = Array(length); |
| 1802 | |
| 1803 | for (var idx = 0; idx < length; idx++, start += step) { |
| 1804 | range[idx] = start; |
| 1805 | } |
| 1806 | |
| 1807 | return range; |
| 1808 | } |
| 1809 | |
| 1810 | // Chunk a single array into multiple arrays, each containing `count` or fewer |
| 1811 | // items. |
no outgoing calls