From 41727e52e1ad6a5eccbbd26a929bee62f5643c56 Mon Sep 17 00:00:00 2001 From: Marwin Hochfelsner <50826859+hlfan@users.noreply.github.com> Date: Sun, 19 Jul 2026 15:39:39 +0200 Subject: [PATCH] Flatten route recognition method --- app/assets/javascripts/router.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/assets/javascripts/router.js b/app/assets/javascripts/router.js index 5e579c90c..3f7fe4d9b 100644 --- a/app/assets/javascripts/router.js +++ b/app/assets/javascripts/router.js @@ -89,11 +89,7 @@ OSM.Router = function (map, rts) { const routes = Object.entries(rts) .map(([path, controller]) => new Route(path, controller)); - routes.recognize = function (path) { - for (const route of this) { - if (route.match(path)) return route; - } - }; + routes.recognize = path => routes.find(route => route.match(path)); let currentPath = location.pathname.replace(/(.)\/$/, "$1") + location.search, currentRoute = routes.recognize(currentPath), -- 2.47.3