kriszyp/cbor-x

Provide an option to force encoding numbers as double

Closed this issue · 0 comments

Ecco commented

Currently cbor-x will encode a JS number as either a CBOR integer or a CBOR double, depending on wether the input value is an integer or not.

This probably is a good decision most of the time, but sometimes you may want to be sure to encode CBOR doubles, no matter the input value. For instance, maybe the receiving end will expect doubles, and doesn't dynamically handle CBOR integers.

Would it be possible to provide an option to the encoder to always output doubles for numbers?