js-in

macrosince v0.0-2411Edit
(js-in key obj)

Details:

Determines if property key is in JavaScript object obj.

Equivalent to key in obj in JavaScript.


Examples:

(def a #js {:foo 1 :bar 2})

(js-in "foo" a)
;;=> true

(js-in "hello" a)
;;=> false

Properties inherited from prototype chain are also detected:

(js-in "toString" a)
;;=> true

See Also:


Source code @ clojurescript:src/main/clojure/cljs/core.cljc
(core/defmacro js-in [key obj]
  (core/list 'js* "~{} in ~{}" key obj))