clojure.datafy/datafy

functionsince v1.10.514Edit
(datafy x)

Source docstring:
Attempts to return x as data.
datafy will return the value of clojure.protocols/datafy. If
the value has been transformed and the result supports
metadata, :clojure.datafy/obj will be set on the metadata to the
original value of x.
Source code @ clojurescript:src/main/cljs/clojure/datafy.cljs
(defn datafy
  [x]
  (let [v (p/datafy x)]
    (if (identical? v x)
      v
      (if (implements? IWithMeta v)
        (vary-meta v assoc ::obj x
                   ;; Circling back to this at a later date per @dnolen
                   ;; ::class (-> x .-constructor .-name symbol)
                   )
        v))))