mcollina/msgpack5

Error "undefined is not encodable in msgpack"

Closed this issue · 3 comments

Is there a reason why undefined is so, err, disliked in this package?

I don't seem to be able to register an encoder for it, it's just hard coded in the encoder.js file to throw an error.

The msgpack-node implementation just encodes undefined values to null, and that's what I'd like to accomplish.

undefined is not null in JS. If you encode an undefined to a null, then when you decode you will not get an undefined.

In this library we support: deepEqual(decode(encode(data)), data).

Of course, but why not let us register an encoder for undefined?

Would you like to send a pr?