From 21a47090dace14bb9fe66ad99025ff65e987d9a1 Mon Sep 17 00:00:00 2001 From: Pascal Syma Date: Tue, 19 Mar 2024 22:38:35 +0100 Subject: [PATCH] Regex is hard... --- src/main.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 5e7b2ee..a2a91aa 100644 --- a/src/main.ts +++ b/src/main.ts @@ -48,7 +48,9 @@ const buffers: { [reason in BannedArea]: (FeatureCollection | Feature)[] } = { let center: [number, number] = [53.0711829, 8.8087718]; let zoom = 14; -const urlPosition = /#@(\d+.?\d*),(\d+.?\d*),(\d+)/.exec(window.location.hash); +const urlPosition = /#@(-?\d+\.?\d*),(-?\d+\.?\d*),(\d+)/.exec( + window.location.hash +); if (urlPosition && urlPosition.length === 4) { const lat = parseFloat(urlPosition[1]); const lon = parseFloat(urlPosition[2]);