diff --git a/src/integrant/core.cljc b/src/integrant/core.cljc index d45dd3a..928964b 100644 --- a/src/integrant/core.cljc +++ b/src/integrant/core.cljc @@ -115,7 +115,9 @@ (defn reflike? "Return true if its argument is a ref or a refset." [x] - (satisfies? RefLike x)) + ;; satisfies? is slow on the JVM for values that do not implement the protocol + #?(:clj (instance? integrant.core.RefLike x) + :cljs (satisfies? RefLike x))) (defrecord Profile []) diff --git a/test/integrant/core_test.cljc b/test/integrant/core_test.cljc index dfdbe92..8a3be4b 100644 --- a/test/integrant/core_test.cljc +++ b/test/integrant/core_test.cljc @@ -88,6 +88,16 @@ (is (ig/reflike? (ig/refset ::foo))) (is (ig/reflike? (ig/refset [::foo ::bar])))) +(deftest reflike-test + (are [x] (not (ig/reflike? x)) + nil + ::foo + "foo" + {:key ::foo} + [(ig/ref ::foo)] + (ig/profile :dev 1) + (ig/var 'foo))) + (deftest composite-keyword-test (let [k (ig/composite-keyword [::a ::b])] (is (isa? k ::a))