        was-visited)
      (let [out (array)]
        (swap! visited assoc obj out)
-       (array-append out (map #(->js % flat visited) obj)))))
+       (doseq [elem obj]
+         (.push out (->js elem flat visited)))
+       out)))
 
   ([obj flat] (seq->js obj flat (atom {})))
   ([obj] (seq->js obj false (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 (js/Object.keys obj)]
         (let [val (->js (aget obj key) flat visited)]
           (aset out key val)))
       out)))

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