Closed markwhiting closed 3 weeks ago
Just trying to jot down some of our discussion today @amirrr — please add anything I missed.
Improved the string comparator to remove the array issue:
function ordered_stringify(object) {
return typeof object == "object"
? Array.isArray(object)
? `[${object.map(ordered_stringify)}]`
: `{${Object.entries(object)
.sort((a, b) => a[0] > b[0])
.map((a) => `${a[0]}:${ordered_stringify(a[1])}`)}}`
: object;
}
Is this done? I think we have kind of settled on an approach, right?
Realized that the treatment protocol can be a bit simplified:
treatments either
The fancy stringify also works now, I think:
(one caveat I noticed: arrays turn into objects with indices, e.g.,
[a,b,c]
turns into{0:a,1:b,2:c}
. Not sure if we care, also not yet sure how to fix that, but haven't looked into it much.)