mirror of
https://github.com/metosin/reitit.git
synced 2025-12-18 08:51:12 +00:00
Replace if-let by when-let since no else branches
for the recursive match by path example.
This commit is contained in:
parent
751ba17b75
commit
6c835e6e09
1 changed files with 2 additions and 2 deletions
|
|
@ -143,10 +143,10 @@ As the `Match` contains all the route data, we can create a new matching functio
|
||||||
(require '[clojure.string :as str])
|
(require '[clojure.string :as str])
|
||||||
|
|
||||||
(defn recursive-match-by-path [router path]
|
(defn recursive-match-by-path [router path]
|
||||||
(if-let [match (r/match-by-path router path)]
|
(when-let [match (r/match-by-path router path)]
|
||||||
(if-let [subrouter (-> match :data :router)]
|
(if-let [subrouter (-> match :data :router)]
|
||||||
(let [subpath (subs path (str/last-index-of (:template match) "/"))]
|
(let [subpath (subs path (str/last-index-of (:template match) "/"))]
|
||||||
(if-let [submatch (recursive-match-by-path subrouter subpath)]
|
(when-let [submatch (recursive-match-by-path subrouter subpath)]
|
||||||
(cons match submatch)))
|
(cons match submatch)))
|
||||||
(list match))))
|
(list match))))
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue