cljs.spec.alpha/explain-printer

functionpreviously cljs.spec/explain-printerEdit
(explain-printer ed)

Source docstring:
Default printer for explain-data. nil indicates a successful validation.
Source code @ clojurescript:src/main/cljs/cljs/spec/alpha.cljs
(defn explain-printer
  [ed]
  (if ed
    (let [problems (sort-by #(- (count (:path %))) (::problems ed))]
      (print
        (with-out-str
          ;;(prn {:ed ed})
          (doseq [{:keys [path pred val reason via in] :as prob} problems]
            (when-not (empty? in)
              (print "In:" (pr-str in) ""))
            (print "val: ")
            (pr val)
            (print " fails")
            (when-not (empty? via)
              (print " spec:" (pr-str (last via))))
            (when-not (empty? path)
              (print " at:" (pr-str path)))
            (print " predicate: ")
            (pr (abbrev pred))
            (when reason (print ", " reason))
            (doseq [[k v] prob]
              (when-not (#{:path :pred :val :reason :via :in} k)
                (print "\n\t" (pr-str k) " ")
                (pr v)))
            (newline))
          (doseq [[k v] ed]
            (when-not (#{::problems} k)
              (print (pr-str k) " ")
              (pr v)
              (newline))))))
    (println "Success!")))