Closed lxsmnsyc closed 1 year ago
Other known issues:
const data = {};
data.self = data;
DX Output:
(function(h){{};h.self=h;return h}())
My serializer:
(h=>(h={},h.self=h,h))()
The second issue definitely looks like a small mistake in building. Like h
just didn't assigned. The first one looks like a miss though. If you managed to find a good solution I'd be interested. I picked up a older version of valav that probably needs some love.
@ryansolid I talked to @DylanPiercey and it seems that he has acknowledged the issues, not sure if he plans on fixing them, which I hope he would because I cannot really figure out the flow of valav.
There's also another issue which is the existence of undefined values in objects. The serializer skips them for some reason, which causes key in object
tests to fail
To be clear the lack of recursive support for custom constructors (Map/Set) isn't there, so good to add. However avoiding serialization of undefined values is intentional to reduce the size of the serialized string (same choice JSON.stringify makes). That one is more of a trade off you have to weigh.
Updated links and outputs for my serializer
Since DX now already uses seroval
which has the parity output with valav
, this issue has been fixed.
I was writing my own serializer when I learned that DX has its own serializer, so I tried it out since I thought it was sophisticatedly written. Turns out, DX's serializer fails at some scenarios. For example:
Case A (using Maps):
My serializer:
DX:
Case B (using Sets):
My serializer:
DX serializer:
Link to my serializer: https://github.com/lxsmnsyc/seroval