Skip to content

Commit

Permalink
Simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
ikitommi committed Apr 5, 2020
1 parent 74d4d80 commit f0bd074
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/spec_tools/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -274,18 +274,11 @@
(accept spec value (assoc options :skip? true))
value))

(defn- valid-spec [item transformed]
(let [spec (:spec item)]
(cond
(qualified-keyword? spec) (s/valid? (s/get-spec spec) transformed)
(fn? spec) (spec transformed)
:else nil)))

(defmethod walk :or [{:keys [::parse/items]} value accept options]
(reduce
(fn [v item]
(let [transformed (accept item v options)
valid? (valid-spec item transformed)]
valid? (some-> item :spec (s/valid? transformed))]
(if valid?
(reduced transformed)
transformed)))
Expand Down

0 comments on commit f0bd074

Please sign in to comment.