Constructor
new Tagged(tag, value, err)
Creates an instance of Tagged.
Parameters:
| Name | Type | Description |
|---|---|---|
tag |
Number | the number of the tag |
value |
any | the value inside the tag |
err |
Error | the error that was thrown parsing the tag, or null |
Methods
convert(converters) → {any}
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.
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)
Push the simple value onto the CBOR stream
Parameters:
| Name | Type | Description |
|---|---|---|
gen |
cbor.Encoder | The generator to push onto |
toString() → {String}
Convert to a String
Returns:
string of the form '1(2)'
- Type
- String