cljs.spec.alpha/explain-printer

functionpreviously cljs.spec/explain-printer clojure.spec.alpha/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 (->> (::problems ed)
                     (sort-by #(- (count (:in %))))
                     (sort-by #(- (count (:path %)))))]
      (print
        (with-out-str
          ;;(prn {:ed ed})
          (doseq [{:keys [path pred val reason via in] :as prob} problems]
            (pr val)
            (print " - failed: ")
            (if reason (print reason) (pr (abbrev pred)))
            (when-not (empty? in)
              (print (str " in: " (pr-str in))))
            (when-not (empty? path)
              (print (str " at: " (pr-str path))))
            (when-not (empty? via)
              (print (str " spec: " (pr-str (last via)))))
            (doseq [[k v] prob]
              (when-not (#{:path :pred :val :reason :via :in} k)
                (print "\n\t" (pr-str k) " ")
                (pr v)))
            (newline)))))
    (println "Success!")))