Fix get-content-from-element
This commit is contained in:
parent
966ecf1009
commit
f147947558
1 changed files with 0 additions and 15 deletions
|
@ -22,21 +22,6 @@
|
||||||
(s/def ::optional boolean?)
|
(s/def ::optional boolean?)
|
||||||
(def dom-function-parameter (s/keys :opt-un [::deserializer ::optional]))
|
(def dom-function-parameter (s/keys :opt-un [::deserializer ::optional]))
|
||||||
(defn-spec get-content-from-element js-object?
|
(defn-spec get-content-from-element js-object?
|
||||||
[name string?
|
|
||||||
& {:keys [deserializer optional]
|
|
||||||
:or {deserializer nil optional false}} dom-function-parameter]
|
|
||||||
(let [content (-> (get-element-by-id name)
|
|
||||||
(.-value))]
|
|
||||||
(cond
|
|
||||||
(and optional (some? deserializer))
|
|
||||||
(when-not (st/blank? content)
|
|
||||||
(apply deserializer [content]))
|
|
||||||
(and (false? optional) (some? deserializer))
|
|
||||||
(apply deserializer [content])
|
|
||||||
:else
|
|
||||||
content)))
|
|
||||||
|
|
||||||
(defn-spec get-content-from-element-2 js-object?
|
|
||||||
[name string?
|
[name string?
|
||||||
& {:keys [deserializer optional]
|
& {:keys [deserializer optional]
|
||||||
:or {deserializer nil optional false}} dom-function-parameter]
|
:or {deserializer nil optional false}} dom-function-parameter]
|
||||||
|
|
Loading…
Reference in a new issue