Skip to content

Commit 795f08e

Browse files
brandonbloomdnolen
authored andcommitted
CLJS-1240: Add cljs.core/var?
1 parent 221d966 commit 795f08e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/cljs/cljs/core.cljs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,11 @@
908908
(-invoke [_ a b c d e f g h i j k l m n o p q r s t rest]
909909
(apply (val) a b c d e f g h i j k l m n o p q r s t rest)))
910910

911+
(defn var?
912+
"Returns true if v is of type cljs.core.Var"
913+
[v]
914+
(instance? cljs.core.Var v))
915+
911916
;;;;;;;;;;;;;;;;;;; fundamentals ;;;;;;;;;;;;;;;
912917

913918
(declare array-seq prim-seq IndexedSeq)

test/cljs/cljs/core_test.cljs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2736,6 +2736,10 @@
27362736
:foo #'foo-1187
27372737
:bar #'bar-1187) []))
27382738

2739+
(deftest test-var?
2740+
(is (var? #'inc))
2741+
(is (not (var? 1))))
2742+
27392743
(deftest test-cljs-1187
27402744
(testing "Internal var nodes analyzed in expression context"
27412745
(is (= (with-out-str (print-foo-1187 :foo))

0 commit comments

Comments
 (0)