Skip to content

Commit b7ede4b

Browse files
authored
CLJS-3419: JS Map & Set should return true for seqable? (#234)
1 parent ae6ccbb commit b7ede4b

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/main/cljs/cljs/core.cljs

+5-4
Original file line numberDiff line numberDiff line change
@@ -2307,10 +2307,11 @@ reduces them without incurring seq initialization"
23072307
"Return true if the seq function is supported for s"
23082308
[s]
23092309
(or
2310-
(nil? s)
2311-
(satisfies? ISeqable s)
2312-
(array? s)
2313-
(string? s)))
2310+
(nil? s)
2311+
(satisfies? ISeqable s)
2312+
(js-iterable? s)
2313+
(array? s)
2314+
(string? s)))
23142315

23152316
(defn boolean
23162317
"Coerce to boolean"

src/test/cljs/cljs/seqs_test.cljs

+7-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@
443443
(partition 5 [1 2 3]) ()
444444

445445
(partition 4 4 [0 0 0] (range 10)) '((0 1 2 3) (4 5 6 7) (8 9 0 0))
446-
446+
447447
(partition -1 [1 2 3]) ()
448448
(partition -2 [1 2 3]) ())
449449

@@ -523,3 +523,9 @@
523523
:initk initk)))]
524524
(= (into [] (src))
525525
(into [] (seq (src)))))))
526+
527+
(deftest cljs-3419-seq-js-iterable
528+
(let [js-set (js/Set. #js [1 2 3 4])
529+
js-map (js/Map. #js [#js [1 2] #js [3 4]])]
530+
(is (seqable? js-set))
531+
(is (seqable? js-map))))

0 commit comments

Comments
 (0)