cognitect / transit-cljs

Transit for ClojureScript
http://transit-format.org
Apache License 2.0
324 stars 21 forks source link

Add support for cljs.core/Eduction if it exists #44

Closed mfikes closed 6 years ago

mfikes commented 6 years ago

Repro:

{:deps {org.clojure/clojurescript {:mvn/version "1.9.946"}
        com.cognitect/transit-cljs {:mvn/version "0.8.243"}}}
$ clj -m cljs.repl.node
ClojureScript Node.js REPL server listening on 55348
To quit, type: :cljs/quit
cljs.user=> (exists? cljs.core/Eduction)
true
cljs.user=> (require '[cognitect.transit :as t])
nil
cljs.user=> (t/write (t/writer :json) (seq (eduction (take 3) (range))))
"[\"~#list\",[0,1,2]]"
cljs.user=> (t/write (t/writer :json) (eduction (take 3) (range)))
repl:13
throw e__8152__auto__;
^

Error: Cannot write
    at Object.writer.maybeQuoted (/private/tmp/transit-cljs/.cljs_node_repl/com/cognitect/transit/impl/writer.js:464:23)
    at Object.writer.marshalTop (/private/tmp/transit-cljs/.cljs_node_repl/com/cognitect/transit/impl/writer.js:471:57)
    at Transit$Writer.writer.Writer.write (/private/tmp/transit-cljs/.cljs_node_repl/com/cognitect/transit/impl/writer.js:501:26)
    at cognitect$transit$write (/private/tmp/transit-cljs/.cljs_node_repl/cognitect/transit.js:886:10)
    at repl:1:103
    at repl:9:3
    at repl:14:4
    at Script.runInThisContext (vm.js:65:33)
    at Object.runInThisContext (vm.js:199:38)
    at Domain.<anonymous> ([stdin]:50:34)
swannodette commented 6 years ago

Fixed https://github.com/cognitect/transit-cljs/commit/9269b46484f78862d9c4c076626407cc19f5bb4f