        was-visited)
      (let [out (js-obj)]
        (swap! visited assoc obj out)
-       (dorun
-        (map
-         #(let [key %
-                val (->js (aget obj %) flat visited)]
-            (aset out key val))
-         (.keys js/Object obj)))
+       (doseq [key (js/Object.keys obj)]
+         (let [val (->js (aget obj key) flat visited)]
+           (aset out key val)))
        out)))
 
   ([obj flat] (ns->js obj flat (atom {})))

       was-visited)
     (let [out (js-obj)]
       (swap! visited assoc obj out)
       (dorun
        (map
         #(let [key (->js (first %)  flat visited)
                val (->js (second %) flat visited)]
            (aset out key val))
         obj))
       out)))

  ([obj flat] (map->js obj flat (atom {})))

(defn obj-size [obj]
  (count (filter #(.hasOwnProperty obj %) (.keys js/Object obj))))

;;***************************************************************************
;; ->js
;;***************************************************************************
