aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/utilities/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'FrontEnd/src/utilities/index.ts')
-rw-r--r--FrontEnd/src/utilities/index.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/FrontEnd/src/utilities/index.ts b/FrontEnd/src/utilities/index.ts
index 085f8ae3..7659a8aa 100644
--- a/FrontEnd/src/utilities/index.ts
+++ b/FrontEnd/src/utilities/index.ts
@@ -8,3 +8,20 @@ export function delay(milliseconds: number): Promise<void> {
}, milliseconds);
});
}
+
+export function range(stop: number): number[];
+export function range(start: number, stop: number, step?: number): number[];
+export function range(start: number, stop?: number, step?: number): number[] {
+ if (stop == undefined) {
+ stop = start;
+ start = 0;
+ }
+ if (step == undefined) {
+ step = 1;
+ }
+ const result: number[] = [];
+ for (let i = start; i < stop; i += step) {
+ result.push(i);
+ }
+ return result;
+}