Closed yacinehmito closed 3 years ago
You are perfectly right, I obviously did not consider the undefined
case. I will talk to the person maintaining the NPM version (https://www.npmjs.com/package/canonicalize) and see what he thinks about this. I just got this from another person who also have taken on this stuff:
https://github.com/Arxcis/identity-wallet/blob/master/lib/canonicalize.mjs
When using the JS implementation of json-canonicalize v1.0.3 on the object
{ foo: undefined }
, we get the string{"foo":undefined}
.This is incorrect. Indeed, the result of
JSON.stringify({ foo: undefined })
is{}
, not{"foo":undefined}
.It might be worth adding to the test suite. I am willing to do it myself, but only if I first receive approval.