-
Notifications
You must be signed in to change notification settings - Fork 170
Open
Description
const msgpack = require('@msgpack/msgpack');
let original = {x: undefined};
let serialized = msgpack.encode(original, {extensionCodec});
let deserialized = msgpack.decode(serialized, {extensionCodec});
console.log(original, deserialized, original.x === deserialized.x);
prints "{ x: undefined } { x: null } false". This is a problem because now code checking for strict equality fails.
I was also not able to handle this in an extension codec because that is only called for non-primitive values.
ignoreUndefined: true
doesn't work in all cases:
let original = undefined;
let serialized = msgpack.encode(original, {ignoreUndefined: true});
let deserialized = msgpack.decode(serialized, {ignoreUndefined: true});
console.log(original, deserialized, original === deserialized); // undefined null false
This is stated in the readme, but is there no way to retain this with an extension codec?
buu700, Domiii and nicmue
Metadata
Metadata
Assignees
Labels
No labels