cognitect / transit-cljs

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

Consider allowing vals for tag-fn, similar to transit-clj #37

Closed dmarjenburgh closed 2 years ago

dmarjenburgh commented 7 years ago

In transit-clj, the write-handler function allows for the tag-fn (and other fns) to be values. From the doc:

If a non-fn is passed as an argument, implemented handler method returns the value unaltered. https://github.com/cognitect/transit-clj/blob/master/src/cognitect/transit.clj#L73-L76

In transit-cljs you must always pass a function. Making write-handler behave the same in clj and cljs makes sharing code for write-handler fns in cljc files a bit easier.

swannodette commented 2 years ago

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