find-ns-obj

functionsince v1.7.10Edit
(find-ns-obj ns)

Source docstring:
Bootstrap only.
Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(defn find-ns-obj
  [ns]
  (let [munged-ns (munge (str ns))
        segs (.split munged-ns ".")]
    (case *target*
      "nodejs"  (if ^boolean js/COMPILED
                  ; Under simple optimizations on nodejs, namespaces will be in module
                  ; rather than global scope and must be accessed by a direct call to eval.
                  ; The first segment may refer to an undefined variable, so its evaluation
                  ; may throw ReferenceError.
                  (find-ns-obj*
                    (try
                      (let [ctxt (js/eval (first segs))]
                        (when (and ctxt (object? ctxt))
                          ctxt))
                      (catch js/ReferenceError e
                        nil))
                    (next segs))
                  (find-ns-obj* goog/global segs))
      ("default" "webworker") (find-ns-obj* goog/global segs)
      (throw (js/Error. (str "find-ns-obj not supported for target " *target*))))))