Streamline template.cljs a little

This commit is contained in:
Dan Holmsand 2014-12-19 18:35:49 +01:00
parent 2de7f28eed
commit 69ae860a0e
1 changed files with 6 additions and 7 deletions

View File

@ -21,8 +21,7 @@
(symbol? x))) (symbol? x)))
(defn hiccup-tag? [x] (defn hiccup-tag? [x]
(or (keyword? x) (or (named? x)
(symbol? x)
(string? x))) (string? x)))
(defn valid-tag? [x] (defn valid-tag? [x]
@ -41,12 +40,12 @@
(aget o k))) (aget o k)))
(defn cached-prop-name [k] (defn cached-prop-name [k]
(if-not (named? k) (if (named? k)
k (if-some [k' (obj-get prop-name-cache (name k))]
(if-let [k' (obj-get prop-name-cache (name k))]
k' k'
(aset prop-name-cache (name k) (aset prop-name-cache (name k)
(util/dash-to-camel k))))) (util/dash-to-camel k)))
k))
(defn convert-prop-value [x] (defn convert-prop-value [x]
(cond (or (string? x) (number? x) (fn? x)) x (cond (or (string? x) (number? x) (fn? x)) x
@ -185,7 +184,7 @@
(def tag-name-cache #js{}) (def tag-name-cache #js{})
(defn cached-parse [x] (defn cached-parse [x]
(if-let [s (obj-get tag-name-cache (name x))] (if-some [s (obj-get tag-name-cache (name x))]
s s
(aset tag-name-cache (name x) (parse-tag x)))) (aset tag-name-cache (name x) (parse-tag x))))