transit-js fix for decimals as map keys

26 views
Skip to first unread message

Marco Süß

unread,
Sep 18, 2017, 2:10:33 PM9/18/17
to transit-format
Hey Cognitect Team,

I recently ran into the roundtrip issue with decimals as map keys. For me it surfaced when using transit-cljs, but I tracked it down to transit-js.

I fixed this locally by changing the return value of NumberHandler.prototype.tag to "d" and moving the Infinity and NaN stuff from JSONMarshaller.prototype.emitInteger to JSONMarshaller.prototype.emitDouble.

I have added some tests that expose this edge case.

I know you guys don't accept patches but I attached one for reference anyway, I hope it's useful.

BTW I had to change ModuleLoader$ResolutionMode/LEGACY to ModuleLoader$ResolutionMode/NODE in bin/closure_deps_graph.clj to make the tests run.

Have a nice day!
0001-fix-decimals-as-map-keys.patch

Marco Süß

unread,
Sep 21, 2017, 2:02:39 PM9/21/17
to transit-format
Let me know if you want me create a PR on github for easier viewing.
Reply all
Reply to author
Forward
0 new messages