kriszyp / cbor-x

Ultra-fast CBOR encoder/decoder with extensions for records and structural cloning
MIT License
276 stars 32 forks source link

Problem when variableMapSize is true and keyMap is used #81

Open victormsc opened 1 year ago

victormsc commented 1 year ago

When variableMapSize is true and keyMap is used, the function writeObject of the Encoder class throws an exception

Uncaught ReferenceError: encodeKey is not defined

I think that the line

https://github.com/kriszyp/cbor-x/blob/d1c5dc857362fb1d5552ce83a2b3aa7af488b8ea/encode.js#L614

should be

encode(encoder.encodeKey(keys[i]))

Is this correct?

Thank you

kriszyp commented 1 year ago

Should be fixed in v1.5.4. Thanks for reporting!