Polish code

This commit is contained in:
Tommi Reiman 2018-03-21 08:15:28 +02:00
parent 01730778e5
commit b4835a7860
2 changed files with 5 additions and 6 deletions

View file

@ -64,7 +64,7 @@ With provided path-parameters:
; :path-params {:id "1"}}
```
Path-parameters are automatically coerced into strings, with the help of (currently internal) Protocol `reitit.impl/IntoString`. It supports numbers, booleans, keywords and objects:
Path-parameters are automatically coerced into strings, with the help of (currently internal) Protocol `reitit.impl/IntoString`. It supports strings, numbers, booleans, keywords and objects:
```clj
(r/match-by-name router ::user {:id 1})

View file

@ -169,8 +169,8 @@
(.replace "+" "%20")))
(defn url-decode [s]
#?(:clj (some-> s (URLDecoder/decode "UTF-8"))
:cljs (some-> s (js/decodeURIComponent))))
(some-> s #?(:clj (URLDecoder/decode "UTF-8")
:cljs (js/decodeURIComponent))))
(defprotocol IntoString
(into-string [_]))
@ -183,9 +183,8 @@
#?(:clj clojure.lang.Keyword
:cljs cljs.core.Keyword)
(into-string [this]
(str (namespace this)
(when (namespace this) "/")
(name this)))
(let [ns (namespace this)]
(str ns (if ns "/") (name this))))
#?(:clj Boolean
:cljs boolean)