Skip to content

KeyValue

The KeyValue class provides helpers for reading nested key-value data and converting it to or from binary form.


Properties

keystring

The key.


valueany

The value.


Methods

GetName()string

Retrieves the name of the current key-value node.

Returned:

  • string - The requested name.

Count()number

Retrieves the number of child elements.

Returned:

  • number - The result of the call.

Element(index: number)KeyValue | null

Retrieves the child element at the specified index.

  • indexnumber - The index value.

Returned:

  • KeyValue | null - The matching object, or null if it is not available.

GetRawFloat()number

Retrieves the raw floating-point value.

Returned:

  • number - The requested raw float.

FindKey(key: string)KeyValue | null

Finds a child key-value node by key.

  • keystring - The key value.

Returned:

  • KeyValue | null - The matching object, or null if it is not available.

GetString()string

Retrieves the value as a string.

Returned:

  • string - The requested string.

GetRawNumber()number

Retrieves the raw numeric value.

Returned:

  • number - The requested raw number.

GetNumber()number

Retrieves the numeric value.

Returned:

  • number - The requested number.

GetValue()number | string

Retrieves the value as a number or string.

Returned:

  • number | string - The requested value.

static FromBinary(data: string)KeyValue | null

Creates a key-value node from binary data.

  • datastring - The raw payload data.

Returned:

  • KeyValue | null - The matching object, or null if it is not available.

ToBinary()string

Converts the key-value node to binary data.

Returned:

  • string - The result of the call.