Skip to content

Commit 614d180

Browse files
committed
add simple-vec
1 parent d975d25 commit 614d180

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/main/cljs/cljs/core.cljs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12336,6 +12336,21 @@ reduces them without incurring seq initialization"
1233612336
(.fromArray Vector (.-arr args) (not (array? (.-arr args))))
1233712337
(Vector. nil (into-array args) nil)))
1233812338

12339+
(defn simple-vec
12340+
[coll]
12341+
(cond
12342+
(map-entry? coll)
12343+
[(key coll) (val coll)]
12344+
12345+
(vector? coll)
12346+
(with-meta coll nil)
12347+
12348+
(array? coll)
12349+
(.fromArray Vector coll)
12350+
12351+
:else
12352+
(into [] coll)))
12353+
1233912354
; The keys field is an array of all keys of this map, in no particular
1234012355
; order. Any string, keyword, or symbol key is used as a property name
1234112356
; to store the value in strobj. If a key is assoc'ed when that same

0 commit comments

Comments
 (0)