        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 {})))

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

(defn array-append [arr seq]
  "Inserts all elements from a Seq into an existing JS array."
  (doseq [v seq]
    (.push arr v))
  arr)

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

       was-visited)
     (let [out (js-obj)]
       (swap! visited assoc obj out)
       (doseq [[key val] obj]
         (aset out (->js key flat visited) (->js val flat visited)))
       out)))

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