Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/clj/cljs/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@
(defmacro false? [x]
(bool-expr (list 'js* "~{} === false" x)))

(defmacro exists? [x]
(bool-expr (list 'js* "typeof ~{} !== 'undefined'" x)))

(defmacro undefined? [x]
(bool-expr (list 'js* "(void 0 === ~{})" x)))

Expand Down
4 changes: 4 additions & 0 deletions src/cljs/cljs/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,10 @@ reduces them without incurring seq initialization"
"Returns true if x is the value true, false otherwise."
[x] (cljs.core/true? x))

(defn ^boolean exists?
"Return true if object exists, false otherwise."
[x] (not= "undefined" (goog/typeOf x)))

(defn ^boolean undefined? [x]
(cljs.core/undefined? x))

Expand Down
2 changes: 1 addition & 1 deletion web/vendor/jq-console