From b7ede4bce3e273ab85155fdd8463c291a6f81d43 Mon Sep 17 00:00:00 2001 From: David Nolen Date: Thu, 29 Aug 2024 13:32:53 -0400 Subject: [PATCH] CLJS-3419: JS Map & Set should return true for seqable? (#234) --- src/main/cljs/cljs/core.cljs | 9 +++++---- src/test/cljs/cljs/seqs_test.cljs | 8 +++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/cljs/cljs/core.cljs b/src/main/cljs/cljs/core.cljs index 27a2f9e37..73bd921f2 100644 --- a/src/main/cljs/cljs/core.cljs +++ b/src/main/cljs/cljs/core.cljs @@ -2307,10 +2307,11 @@ reduces them without incurring seq initialization" "Return true if the seq function is supported for s" [s] (or - (nil? s) - (satisfies? ISeqable s) - (array? s) - (string? s))) + (nil? s) + (satisfies? ISeqable s) + (js-iterable? s) + (array? s) + (string? s))) (defn boolean "Coerce to boolean" diff --git a/src/test/cljs/cljs/seqs_test.cljs b/src/test/cljs/cljs/seqs_test.cljs index 3d7606da9..9e43a7340 100644 --- a/src/test/cljs/cljs/seqs_test.cljs +++ b/src/test/cljs/cljs/seqs_test.cljs @@ -443,7 +443,7 @@ (partition 5 [1 2 3]) () (partition 4 4 [0 0 0] (range 10)) '((0 1 2 3) (4 5 6 7) (8 9 0 0)) - + (partition -1 [1 2 3]) () (partition -2 [1 2 3]) ()) @@ -523,3 +523,9 @@ :initk initk)))] (= (into [] (src)) (into [] (seq (src))))))) + +(deftest cljs-3419-seq-js-iterable + (let [js-set (js/Set. #js [1 2 3 4]) + js-map (js/Map. #js [#js [1 2] #js [3 4]])] + (is (seqable? js-set)) + (is (seqable? js-map))))