cljs.repl/mapped-stacktrace
function | since v0.0-2843 | Edit |
(mapped-stacktrace stacktrace)
(mapped-stacktrace stacktrace opts)
Source docstring:
Given a vector representing the canonicalized JavaScript stacktrace
return the ClojureScript stacktrace. The canonical stacktrace must be
in the form:
[{:file
:function
:line
:column }*]
:file must be a URL path (without protocol) relative to :output-dir or a
identifier delimited by angle brackets. The returned mapped stacktrace will
also contain :url entries to the original sources if it can be determined
from the classpath.
(defn mapped-stacktrace
([stacktrace] (mapped-stacktrace stacktrace nil))
([stacktrace opts]
(vec
(let [mapped-frames (map (memoize #(mapped-frame % opts)) stacktrace)]
(map #(merge-with (fn [munged-fn-name unmunged-call-name]
(if (= munged-fn-name (string/replace (cljs.compiler/munge unmunged-call-name) "." "$"))
unmunged-call-name
munged-fn-name)) %1 %2)
(map #(dissoc % :call) mapped-frames)
(concat (rest (map #(if (:call %)
(hash-map :function (:call %))
{})
mapped-frames)) [{}]))))))