deconstruct-js

Home > deconstruct-js > Deconstructor

Deconstructor interface

The object or instance returned by your function, with information on the deconstructor and the deconstructor value.

Signature:

interface Deconstructor<T> 

Properties

Property Type Description
bytes number | undefined Bytes to be read by the deconstructor If it’s not known in advance, set it to undefined
minBytes number The minimum number of bytes to be read by the deconstructor It only reflects the bytes that we know in advance are going to be used. It’s not a guarantee of a successful deconstruction.

Methods

Method Description
_fromBuffer(buffer, offset) The function that actually reads the buffer and returns deconstructed valueYou shouldn’t call this function explicitly. However, if you’re _implementing_ a new Deconstructor, this is where you do it.