From e2e96e8f1ec19b87a377f6f94a850776543e0e97 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 28 Oct 2018 16:20:45 +0900 Subject: [PATCH] Add ensure-slash function --- modules/reitit-core/src/reitit/core.cljc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/reitit-core/src/reitit/core.cljc b/modules/reitit-core/src/reitit/core.cljc index 9f88600a..0bdeb7ab 100644 --- a/modules/reitit-core/src/reitit/core.cljc +++ b/modules/reitit-core/src/reitit/core.cljc @@ -30,6 +30,12 @@ nil (expand [_ _])) +(defn ensure-slash + [^String string] + (if (.endsWith string "/") + string + (str string "/"))) + (defn walk [raw-routes {:keys [path data routes expand] :or {data [], routes [], expand expand} :as opts}]