Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix js-obj fn

  • Loading branch information...
commit f4a3ef43dc70aed4f15045836d709989a95ef6f7 1 parent 455514a
@brandonbloom brandonbloom authored David Nolen committed
Showing with 7 additions and 8 deletions.
  1. +2 −8 src/cljs/cljs/core.cljs
  2. +5 −0 test/cljs/cljs/core_test.cljs
View
10 src/cljs/cljs/core.cljs
@@ -689,14 +689,8 @@ reduces them without incurring seq initialization"
(defn js-obj
([]
(js* "{}"))
- ([k1 v1]
- (js* "{~{}:~{}}" k1 v1))
- ([k1 v1 k2 v2]
- (js* "{~{}:~{},~{}:~{}}" k1 v1 k2 v2))
- ([k1 v1 k2 v2 k3 v3]
- (js* "{~{}:~{},~{}:~{},~{}:~{}}" k1 v1 k2 v2 k3 v3))
- ([k1 v1 k2 v2 k3 v3 & more]
- (apply gobject/create k1 v1 k2 v2 k3 v3 more)))
+ ([& keyvals]
+ (apply gobject/create keyvals)))
(defn js-keys [obj]
(let [keys (array)]
View
5 test/cljs/cljs/core_test.cljs
@@ -1,6 +1,11 @@
(ns cljs.core-test)
(defn test-stuff []
+ ;; js primitives
+ (let [keys #(vec (js-keys %))]
+ (assert (= [] (keys (js-obj)) (keys (apply js-obj []))))
+ (assert (= ["x"] (keys (js-obj "x" "y")) (keys (apply js-obj ["x" "y"])))))
+
;; -equiv
(assert (= 1))
(assert (= 1 1))
Please sign in to comment.
Something went wrong with that request. Please try again.