cljs.repl/mapped-line-and-column

functionremoved v0.0-3148added v0.0-2814Edit
(mapped-line-and-column source-map line column)

Source docstring:
Given a cljs.source-map source map data structure map a generated line
and column back to the original line and column.
Source code @ clojurescript:src/clj/cljs/repl.clj
(defn mapped-line-and-column
  [source-map line column]
  (let [default [line column]]
    ;; source maps are 0 indexed for lines
    (if-let [columns (get source-map (dec line))]
      (vec
        (map inc
          (map
            ;; source maps are 0 indexed for columns
            ;; multiple segments may exist at column
            ;; the last segment seems most accurate
            (last
              (if-let [mapping (get columns (dec column))]
                mapping
                (second (first columns))))
            [:line :col])))
      default)))