(start: number, end?: number)
| 630 | } |
| 631 | |
| 632 | export function range(start: number, end?: number): number[] { |
| 633 | /** Identical to basic usage of the Python range() function **/ |
| 634 | if (typeof end === "undefined") { |
| 635 | end = start; |
| 636 | start = 0; |
| 637 | } |
| 638 | |
| 639 | if (start >= end) { |
| 640 | return []; |
| 641 | } |
| 642 | |
| 643 | return Array.from({ length: end - start }, (_, i) => i + start); |
| 644 | } |