An alternative modelled after `aget` that's simpler + faster:

(defn oget "Like `aget` for JS objects."
  [o k] (when o (gobj/get o k nil))
  [o k1 k2] (when-let [o (oget o k1)] (gobj/get o k2 nil)) ; Optimized common 
case
  [o k1 k2 & ks] (when-let [o (oget o k1 k2)] (apply oget o ks))) ; Can also 
lean on optimized 2-case

May be nice to have something in core to help wean folks off just continuing to 
use`aget`?

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to