Skip to content

Commit

Permalink
Replace .entryAt with .valAt during validation
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-yakushev committed Jul 25, 2024
1 parent 404b025 commit fc87652
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/malli/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,9 @@
m)) x ts))
:clj (apply -comp (map (fn child-transformer [[k t]]
(fn [^Associative x]
(if-let [e ^MapEntry (.entryAt x k)]
(.assoc x k (t (.val e))) x))) (rseq ts)))
(let [val (.valAt x k ::not-found)]
(if (identical? val ::not-found)
x (.assoc x k (t val)))))) (rseq ts)))
:cljs (fn [x] (reduce (fn child-transformer [m [k t]]
(if-let [entry (find m k)]
(assoc m k (t (val entry)))
Expand Down Expand Up @@ -1037,7 +1038,11 @@
(let [valid? (-validator value)
default (boolean optional)]
#?(:bb (fn [m] (if-let [map-entry (find m key)] (valid? (val map-entry)) default))
:clj (fn [^Associative m] (if-let [map-entry (.entryAt m key)] (valid? (.val map-entry)) default))
:clj (fn [^Associative m]
(let [val (.valAt m key ::not-found)]
(if (identical? val ::not-found)
default
(valid? val))))
:cljs (fn [m] (if-let [map-entry (find m key)] (valid? (val map-entry)) default)))))
@explicit-children)
default-validator
Expand Down

0 comments on commit fc87652

Please sign in to comment.