mcollina/msgpack5

BigInt not supported

mzedeler opened this issue · 1 comments

require('msgpack5')().encode({a: 10n})
Uncaught Error: not implemented yet

I am a bit surprised that it isn't possible to write a decoder for this. I tried, but I get the same error, since msgpack5 never seems to try to get the value converted:

const m = require('msgpack5')()
m.registerEncoder((t) => (t instanceof BigInt), t => t.toString(10))
m..encode({a: 10n})
Uncaught Error: not implemented yet

This library was written way before BigInt was a thing. Feel free to send a PR to add support for this.