macro | since v0.0-2411 | Edit |
(js-in key obj)
Determines if property key
is in JavaScript object obj
.
Equivalent to key in obj
in JavaScript.
(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
(core/defmacro js-in [key obj]
(core/list 'js* "~{} in ~{}" key obj))