Tagged

Tagged

A CBOR tagged item, where the tag does not have semantics specified at the moment, or those semantics threw an error during parsing. Typically this will be an extension point you're not yet expecting.

Constructor

new Tagged(tag, value, erropt)

Description:
  • Creates an instance of Tagged.
Source:
Parameters:
Name Type Attributes Description
tag number The number of the tag.
value any The value inside the tag.
err Error <optional>
The error that was thrown parsing the tag, or null.

Members

(static) TAGS :TagMap

Description:
  • The current set of supported tags. May be modified by plugins.
Source:
The current set of supported tags. May be modified by plugins.
Type:

Methods

convert(converters) → {any}

Description:
  • If we have a converter for this type, do the conversion. Some converters are built-in. Additional ones can be passed in. If you want to remove a built-in converter, pass a converter in whose value is 'null' instead of a function.
Source:
Parameters:
Name Type Description
converters object Keys in the object are a tag number, the value is a function that takes the decoded CBOR and returns a JavaScript value of the appropriate type. Throw an exception in the function on errors.
Returns:
The converted item.
Type
any

encodeCBOR(gen) → {boolean}

Description:
  • Push the simple value onto the CBOR stream.
Source:
Parameters:
Name Type Description
gen object The generator to push onto.
Returns:
True on success.
Type
boolean

toString() → {string}

Description:
  • Convert to a String.
Source:
Returns:
String of the form '1(2)'.
Type
string

(static) reset()

Description:
  • Reset the supported tags to the original set, before any plugins modified the list.
Source: