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-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 ```clj
(r/match-by-name router ::user {:id 1}) (r/match-by-name router ::user {:id 1})

View file

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