Skip to content

Commit

Permalink
Fix issue metosin#775
Browse files Browse the repository at this point in the history
  • Loading branch information
cap10morgan committed Apr 12, 2023
1 parent 3e822b4 commit d43dc71
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/malli/error.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,12 @@
(defn -fill [x i fill] (-concat x (repeat (- i (count x)) fill)))

(defn -push [x k v fill]
(let [x' (cond-> x (and (int? k) (sequential? x) (> k (count x))) (-fill k fill))]
(cond (or (nil? x') (associative? x')) (assoc x' k v)
(set? x') (conj x' v)
(let [i (when (int? k) k)
x' (cond-> x (and i (sequential? x) (> k (count x))) (-fill k fill))]
(cond (nil? x') (assoc x' k v)
(and (associative? x') i) (assoc x' i v)
(or (set? x') (vector? x')) (conj x' v)
(associative? x') (assoc x' k v)
:else (apply list (assoc (vec x') k v)))))

(defn -push-in [a v [p & ps] e]
Expand Down

0 comments on commit d43dc71

Please sign in to comment.