OptionalboxedShould numbers and strings be created as boxed instances, which retain their original encoding for round-tripping?
If this is true, saveOriginal is also set to true. Think of this as "saveOriginal + extras". The thought is that most use cases for saveOriginal will want the original encoding of an object or array, and won't care about the original encoding of strings and numbers. Turning this on also has the side-effect of making all CBOR maps decode as JS Map objects, rather than plain Objects, since the string keys will need to be instances of String.
OptionalcdeTurn on all options for draft-ietf-cbor-cde-05.
OptionalcollapseShould bigints that can fit into normal integers be collapsed into normal integers?
OptionalconvertIn dCBOR, JS numbers between 2^53 and 2^64 get encoded as CBOR integers. When decoding, present them as JS numbers instead of BigInt, losing accuracy.
OptionalcreateCreate an object from an array of key-value pairs. The default implementation creates a plain JS object if all of the keys are strings, otherwise creates a Map (unless preferMap or boxed is set, in which case a Map is always created).
OptionaldcborTurn on all options for draft-mcnally-deterministic-cbor-11.
OptionaldiagnosticWhen producing diagnostic output, should the size of an element always be appended to that element using an underscore when calling diagnose?
OptionalencodingIf the input is a string, how should it be decoded into a byte stream? Ignored if the input is a Uint8Array.
OptionalignoreDo not consider the global tag registry when decoding tags.
OptionalinitialFor the root object, how many levels of nesting is it already? Happens with tag 24.
OptionalkeepKeep NaN payloads by creating an instance of NAN when needed. Ignored if rejectLongLoundNaN is true.
OptionalmaxMaximum allowed depth to parse into CBOR structures. This limit is security-relevant for untrusted inputs. May be set to Infinity for trusted inputs, but be careful!
The '--' separating bytes from description must be in at least this column.
OptionalnoDon't add the initial 0xHEX line to comment output.
OptionalpreferAlways generate bigint numbers from CBOR integers (major type 0 or 1).
This would be used in profiles that want to crisply distinguish between float and int types. On the encode side, you might want avoidInts=true and collapseBigInts=true to pair with this. If true, convertUnsafeIntsToFloat is ignored.
OptionalpreferAlways generate Map instances when decoding, instead of trying to generate object instances when all of the keys are strings.
A slight performance improvement if you don't need plain objects. If you have the boxed option on, this option has no effect, and Maps are always produced.
OptionalprettyPretty-print diagnostic format.
OptionalrejectIf there are bigint (tag 2/3) in the incoming data, throw an exception.
OptionalrejectIf there are duplicate keys in a map, should we throw an exception?
Note: this is more compute-intensive than expected at the moment, but that will be fixed eventually.
OptionalrejectReject any floating point numbers.
This might be used in profiles that are not expecting floats to prevent one from being coerced to an integer-looking number without the receiver knowing.
OptionalrejectReject any mt 0/1 numbers.
This might be used in profiles that expect all numbers to be encoded as floating point.
OptionalrejectReject negative integers in the range [CBOR_NEGATIVE_INT_MAX ... STANDARD_NEGATIVE_INT_MAX - 1].
OptionalrejectReject floating point numbers that should have been encoded in shorter form, including having been encoded as an integer.
OptionalrejectReject NaNs that are not encoded as 0x7e00.
This includes non-trivial NaNs without a quiet bit, with a sign bit, or with a payload. It also includes NaNs that are encoded with a float larger than f16.
OptionalrejectIf negative zero (-0.0) is received, throw an error.
OptionalrejectReject simple values other than true, false, undefined, and null.
OptionalrejectReject any attempt to decode streaming CBOR.
Enforces the Definite-Length-Only (DLO) constraint.
OptionalrejectReject strings that are not normalized with the given normalization form. Don't use this without Unicode expertise.
OptionalrejectReject subnormal floating point numbers.
OptionalrejectReject the undefined simple value.
Usually used with rejectSimple.
OptionalrejectFor dCBOR, reject "integers" between 2^53 and 2^64 that were encoded as floats.
OptionalrequireReject integers and additional-information lengths that could have been encoded in a smaller encoding.
Usually rejectLongFloats is also desired.
OptionalsaveSave the original bytes associated with every object as a property of
that object for exact round-tripping. Use getEncoded(obj) to retrieve
the associated bytes. If you need the original encoded form of primitive
items such as numbers and strings, set boxed: true as well.
OptionalsortIf non-null, keys being decoded MUST be in this order. Note that this is a superset of rejectDuplicateKeys, and is slightly more efficient.
OptionaltagsIf non-null, prefer any tags in the map to ones have have been registered with Tag.registerDecoder.
Comment options on top of the decode options.