cljs.spec/explain-printer

MOVED, please see cljs.spec.alpha/explain-printer
functionremoved v1.9.542added v1.9.293Edit
(explain-printer ed)

Source docstring:
Default printer for explain-data. nil indicates a successful validation.
Source code @ clojurescript:src/main/cljs/cljs/spec.cljs
(defn explain-printer
  [ed]
  (if ed
    (print
      (with-out-str
        ;;(prn {:ed ed})
        (doseq [{:keys [path pred val reason via in] :as prob} (::problems ed)]
          (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!")))