From 31ff970844e0d8e1011dbb7fcc4206d94b1b9679 Mon Sep 17 00:00:00 2001 From: davidnolen Date: Thu, 29 Aug 2024 12:46:36 -0400 Subject: [PATCH] * JS Map & Set should return true for seqable? --- 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))))