array-map has a macro version that works correctly, but the function version will happily create a map with duplicate keys:
array-map
(keys (array-map :foo 1 :foo 2)) ;; => (:foo) (keys (apply array-map [:foo 1 :foo 2])) ;; => (:foo :foo)
fixed https://github.com/clojure/clojurescript/commit/c2d0f0023b419958f35477907510d9a27d8aa451
Attached CLJS-881-p1.patch, which contains a test and switches array-map to use the .fromArray method the same way the macro does.
.fromArray
array-map
has a macro version that works correctly, but the function version will happily create a map with duplicate keys:(keys (array-map :foo 1 :foo 2)) ;; => (:foo) (keys (apply array-map [:foo 1 :foo 2])) ;; => (:foo :foo)