From 688a172a55cacd02ac6159a2b45e0bbf697c11eb Mon Sep 17 00:00:00 2001 From: Nickwasused Date: Sat, 25 Feb 2023 16:29:27 +0100 Subject: [PATCH] add dev mode --- deno.json | 3 ++- index.ts | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/deno.json b/deno.json index 69db463..10d9658 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,7 @@ { "tasks": { - "run": "deno run --allow-write --allow-net='tankstellenfinder.aral.de' index.ts" + "run": "deno run --allow-write --allow-net='tankstellenfinder.aral.de' index.ts", + "dev": "deno run --allow-write --allow-net='tankstellenfinder.aral.de' index.ts dev" }, "fmt": { "files": { diff --git a/index.ts b/index.ts index 49df888..02cf3ff 100644 --- a/index.ts +++ b/index.ts @@ -10,6 +10,8 @@ async function get_nearest(lat: number, long: number): Promise { } } +const is_dev: boolean = Deno.args[0] == 'dev'; + type stationdata = { id: string; name: string; @@ -30,11 +32,21 @@ type stationdata = { website?: string; }; +let a = 47.2701, + b = 55.0583, + c = 5.8655, + d = 15.0419; + +if (is_dev) { + console.log('using dev mode'); + a = 47.2701, b = 48, c = 5.8655, d = 6.5; +} + async function get_all_stations(): Promise { let station_data: stationdata[] = []; // latitude and longitude are the bounds of germany - for (let i = 47.2701; i < 55.0583; i = i + 0.2) { - for (let x = 5.8655; x < 15.0419; x = x + 0.2) { + for (let i = a; i < b; i = i + 0.2) { + for (let x = c; x < d; x = x + 0.2) { console.log(`${i}:${x}`); let fetching = true; let current_station_data: stationdata[] = [];