diff --git a/common/src/app/common/data.cljc b/common/src/app/common/data.cljc index 9fa9df4f5d..ff7d98f281 100644 --- a/common/src/app/common/data.cljc +++ b/common/src/app/common/data.cljc @@ -461,6 +461,15 @@ (->> (apply c/iteration args) (concat-all))) +(defmacro get-prop + "A macro based, optimized variant of `get` that access the property + directly on CLJS, on CLJ works as get." + [obj prop] + (if (:ns &env) + (list (symbol ".") (with-meta obj {:tag 'js}) (symbol (str "-" (c/name prop)))) + `(c/get ~obj ~prop))) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Data Parsing / Conversion ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;