From 5747e9a1082d35a044759296843983d7333663a3 Mon Sep 17 00:00:00 2001 From: Tommi Reiman Date: Wed, 28 Aug 2024 00:26:48 +0300 Subject: [PATCH] . --- src/malli/error.cljc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/malli/error.cljc b/src/malli/error.cljc index fb4e40603..6cc2a4313 100644 --- a/src/malli/error.cljc +++ b/src/malli/error.cljc @@ -193,10 +193,11 @@ (reduce (fn [acc error] (cond-> acc (accept error) (-replace-in value (:in error) (wrap error) mask))) acc errors))) (defn -masked [mask x y] - (cond (and (map? x) (or (nil? y) (map? y))) (reduce-kv (fn [acc k v] (let [e (find y k)] (assoc acc k (if e (-masked mask v (val e)) mask)))) y x) - (set? x) (cond-> y (not= (count x) (count y)) (conj mask)) - (sequential? x) (-fill y (count x) mask) - :else y)) + (let [nested (and (map? x) (or (map? y) (nil? y)))] + (cond nested (reduce-kv (fn [acc k v] (let [e (find y k)] (assoc acc k (if e (-masked mask v (val e)) mask)))) y x) + (set? x) (cond-> y (not= (count x) (count y)) (conj mask)) + (sequential? x) (-fill y (count x) mask) + :else y))) ;; ;; spell checking (kudos to https://github.com/bhauman/spell-spec)