You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Serializable {
serialize () {
const encoder = new cbor.Encoder()
this.encodeCBOR(encoder)
return encoder.finalize()
}
static deserialize (serialized) {
return cbor.decodeAll(serialized)
}
}
class TestA extends Serializable {
encodeCBOR (gen) {
return gen.write(44)
}
}
class TestB extends Serializable {
encodeCBOR (gen) {
return gen.write([
new TestA()
])
}
}
This works fine and TestB serializes to <Buffer 81 18 2c>. If I update TestB to this:
class TestB extends Serializable {
encodeCBOR (gen) {
return gen.write([
new TestA(),
true,
])
}
}
Then it serializes to <Buffer 82 18 2c>, which has the correct length but not the new element. Attempting to decode that throws a Error: Undeterminated nesting.
The text was updated successfully, but these errors were encountered:
I have 2 classes with custom encoding:
This works fine and
TestB
serializes to<Buffer 81 18 2c>
. If I updateTestB
to this:Then it serializes to
<Buffer 82 18 2c>
, which has the correct length but not the new element. Attempting to decode that throws aError: Undeterminated nesting
.The text was updated successfully, but these errors were encountered: