Kit
Functions

getBooleanDecoder

Call Signature

getBooleanDecoder(): FixedSizeDecoder<boolean, 1>

Returns a decoder for boolean values.

This decoder reads a number and interprets 1 as true and 0 as false. The size option allows customizing the number codec used for storage.

For more details, see getBooleanCodec.

Returns

FixedSizeDecoder<boolean, 1>

A FixedSizeDecoder<boolean, N> where N is the size of the number codec.

Example

Decoding booleans.

const decoder = getBooleanDecoder();
 
decoder.decode(new Uint8Array([0x00])); // false
decoder.decode(new Uint8Array([0x01])); // true

See

getBooleanCodec

Call Signature

getBooleanDecoder<TSize>(config): FixedSizeDecoder<boolean, TSize>

Returns a decoder for boolean values.

This decoder reads a number and interprets 1 as true and 0 as false. The size option allows customizing the number codec used for storage.

For more details, see getBooleanCodec.

Type Parameters

Type Parameter
TSize extends number

Parameters

ParameterTypeDescription
configBooleanCodecConfig<NumberDecoder> & objectConfiguration options for decoding booleans.

Returns

FixedSizeDecoder<boolean, TSize>

A FixedSizeDecoder<boolean, N> where N is the size of the number codec.

Example

Decoding booleans.

const decoder = getBooleanDecoder();
 
decoder.decode(new Uint8Array([0x00])); // false
decoder.decode(new Uint8Array([0x01])); // true

See

getBooleanCodec

Call Signature

getBooleanDecoder(config): VariableSizeDecoder<boolean>

Returns a decoder for boolean values.

This decoder reads a number and interprets 1 as true and 0 as false. The size option allows customizing the number codec used for storage.

For more details, see getBooleanCodec.

Parameters

ParameterTypeDescription
configBooleanCodecConfig<NumberDecoder>Configuration options for decoding booleans.

Returns

VariableSizeDecoder<boolean>

A FixedSizeDecoder<boolean, N> where N is the size of the number codec.

Example

Decoding booleans.

const decoder = getBooleanDecoder();
 
decoder.decode(new Uint8Array([0x00])); // false
decoder.decode(new Uint8Array([0x01])); // true

See

getBooleanCodec

On this page