Simple

Simple

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

Constructor

new Simple(value)

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

Methods

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:
  • Debug string for simple value.
Source:
Returns:
Formated string of `simple(value)`.
Type
string

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

Description:
  • 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:
The decoded value.
Type
null | undefined | boolean | symbol | Simple

(static) isSimple(obj) → {boolean}

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