isVariableSize
Call Signature
isVariableSize<
TFrom
>(encoder
):encoder is VariableSizeEncoder<TFrom>
Determines whether the given codec, encoder, or decoder is variable-size.
A variable-size object is identified by the absence of a fixedSize
property.
If this property is missing, the object is considered a VariableSizeCodec,
VariableSizeEncoder, or VariableSizeDecoder.
Type Parameters
Type Parameter | Description |
---|---|
TFrom | The type of the value to encode. |
Parameters
Parameter | Type |
---|---|
encoder | Encoder <TFrom > |
Returns
encoder is VariableSizeEncoder<TFrom>
true
if the object is variable-size, false
otherwise.
Examples
Checking a variable-size encoder.
Checking a fixed-size encoder.
Remarks
This function is the inverse of isFixedSize.
See
Call Signature
isVariableSize<
TTo
>(decoder
):decoder is VariableSizeDecoder<TTo>
Determines whether the given codec, encoder, or decoder is variable-size.
A variable-size object is identified by the absence of a fixedSize
property.
If this property is missing, the object is considered a VariableSizeCodec,
VariableSizeEncoder, or VariableSizeDecoder.
Type Parameters
Type Parameter | Description |
---|---|
TTo | The type of the decoded value. |
Parameters
Parameter | Type |
---|---|
decoder | Decoder <TTo > |
Returns
decoder is VariableSizeDecoder<TTo>
true
if the object is variable-size, false
otherwise.
Examples
Checking a variable-size encoder.
Checking a fixed-size encoder.
Remarks
This function is the inverse of isFixedSize.
See
Call Signature
isVariableSize<
TFrom
,TTo
>(codec
):codec is VariableSizeCodec<TFrom, TTo>
Determines whether the given codec, encoder, or decoder is variable-size.
A variable-size object is identified by the absence of a fixedSize
property.
If this property is missing, the object is considered a VariableSizeCodec,
VariableSizeEncoder, or VariableSizeDecoder.
Type Parameters
Type Parameter | Description |
---|---|
TFrom | The type of the value to encode. |
TTo | The type of the decoded value. |
Parameters
Parameter | Type |
---|---|
codec | Codec <TFrom , TTo > |
Returns
codec is VariableSizeCodec<TFrom, TTo>
true
if the object is variable-size, false
otherwise.
Examples
Checking a variable-size encoder.
Checking a fixed-size encoder.
Remarks
This function is the inverse of isFixedSize.
See
Call Signature
isVariableSize(
codec
):codec is { maxSize?: number }
Determines whether the given codec, encoder, or decoder is variable-size.
A variable-size object is identified by the absence of a fixedSize
property.
If this property is missing, the object is considered a VariableSizeCodec,
VariableSizeEncoder, or VariableSizeDecoder.
Parameters
Parameter | Type |
---|---|
codec | { fixedSize : number ; } | { maxSize? : number ; } |
Returns
codec is { maxSize?: number }
true
if the object is variable-size, false
otherwise.
Examples
Checking a variable-size encoder.
Checking a fixed-size encoder.
Remarks
This function is the inverse of isFixedSize.