cbor2
    Preparing search index...

    Class Tag

    A CBOR tagged value.

    Implements

    Index

    Constructors

    • A tag wrapped around another value.

      Parameters

      • tag: TagNumber

        The tag number.

      • contents: unknown = undefined

        The value that follows the tag number.

      Returns Tag

    Properties

    contents: unknown

    Accessors

    • get noChildren(): boolean

      When constructing the commented version of this tag, should the contents be written as well? If true, the comment function should output the contents values itself (only used for tag 24 so far).

      Returns boolean

    Methods

    • Register a decoder for a give tag number.

      Parameters

      • tag: TagNumber

        The tag number.

      • decoder: TagDecoder

        Decoder function.

      • Optionaldescription: string

        If provided, use this when commenting to add a type name in parens after the tag number.

      Returns undefined | TagDecoder

      Old decoder for this tag, if there was one.

    • Iterate over just the contents, so that the tag works more like an array. Yields One time, the contained value.

      Returns Generator<unknown, void, undefined>

    • Parameters

      • options: Required
      • depth: number

      Returns undefined | string

    • Convert this tagged value to a useful data type, if possible.

      Parameters

      • options: Required

        Options for decoding.

      Returns unknown

      The converted value.

    • Makes Tag act like an array, so that no special casing is needed when the tag's contents are available.

      Parameters

      • contents: unknown

        The value associated with the tag.

      Returns number

      Always returns 1.

    • If an object implements this interface, this method will be used to serialize the object when encoding. Return undefined if you don't want any further serialization to take place. Return an array of [tag, value] if you would like default serialization, where if tag is not NaN, a CBOR tag will be written before the value.

      Returns [TagNumber, unknown]