EncoderOptions: {
    intKeys?: boolean;
    taggedEncoders?: TaggedEncoder<any>[];
}

Specifies options for encoder.

Type declaration

  • OptionalintKeys?: boolean

    In JavaScript, object keys are strings, so by default CBOR encoding will produce string keys for maps.

    Setting intKeys to true will make encoder first try to convert each object key to integer and encode it as such if conversion succeeds. Keys that cannot be converted will be encoded as strings. Note that if object contains both integer and string keys, the map will be encoded as such.

    By default, false.

  • OptionaltaggedEncoders?: TaggedEncoder<any>[]

    Tagged object encoders.

    By default, DEFAULT_TAGGED_ENCODERS, which encodes Dates (as a string) and RegExps.

    Pass empty array to disable tagged encoders.