instance?

function/macrosince v0.0-927 clojure.core/instance?Edit
(instance? c x)

Details:

Returns true if x is an instance of type c, false otherwise.


See Also:


Source docstring:
Evaluates x and tests if it is an instance of the type
c. Returns true or false
Function code @ clojurescript:src/main/cljs/cljs/core.cljs
(defn ^boolean instance?
  [c x]
  (cljs.core/instance? c x))

Macro code @ clojurescript:src/main/clojure/cljs/core.cljc
(core/defmacro instance? [c x]
  ;; Google Closure warns about some references to RegExp, so
  ;; (instance? RegExp ...) needs to be inlined, but the expansion
  ;; should preserve the order of argument evaluation.
  (bool-expr (if (clojure.core/symbol? c)
               (core/list 'js* "(~{} instanceof ~{})" x c)
               `(let [c# ~c x# ~x]
                  (~'js* "(~{} instanceof ~{})" x# c#)))))