Simple

Simple

A CBOR Simple Value that does not map onto a known constant.

Constructor

new Simple(value)

Creates an instance of Simple.
Source:
Parameters:
Name Type Description
value number The simple value's integer value.

Methods

(static) decode(val, has_parentopt, parent_indefiniteopt) → {null|undefined|boolean|symbol|Simple}

Decode from the CBOR additional information into a JavaScript value. If the CBOR item has no parent, return a "safe" symbol instead of `null` or `undefined`, so that the value can be passed through a stream in object mode.
Source:
Parameters:
Name Type Attributes Default Description
val number The CBOR additional info to convert.
has_parent boolean <optional>
true Does the CBOR item have a parent?
parent_indefinite boolean <optional>
false Is the parent element indefinitely encoded?
Throws:
Invalid BREAK.
Type
Error
Returns:
Type:
null | undefined | boolean | symbol | Simple
The decoded value.

(static) isSimple(obj) → {boolean}

Is the given object a Simple?
Source:
Parameters:
Name Type Description
obj any Object to test.
Returns:
Type:
boolean
Is it Simple?

encodeCBOR(gen) → {boolean}

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

toString() → {string}

Debug string for simple value.
Source:
Returns:
Type:
string
Formated string of `simple(value)`.