Returns true when the variant holds no value (Void).
Returns the stored value as a boolean.
Returns false if the type is not VariantType.Bool.
Returns a copy of the stored ByteVector.
Returns an empty ByteVector for all other types.
Returns copies of the stored ByteVector list.
A single ByteVector value is wrapped in a one-element array.
All other types return [].
Returns the stored value as a double-precision float.
Numeric types are coerced; all other types return 0.
Returns the stored value as a JavaScript number.
Numeric types are coerced; all other types return 0.
Returns a shallow copy of the stored VariantList.
Returns [] for all other types.
Returns the stored value as a bigint.
Integer bigint types are returned directly; JS number types are
promoted via BigInt(); all other types return 0n.
Returns a shallow copy of the stored VariantMap.
Returns an empty Map for all other types.
Returns the stored value as a string.
Scalar types are stringified; non-scalar types return "".
Returns the stored value as a string array.
A single String value is wrapped in a one-element array.
All other types return [].
Returns the active VariantType discriminant.
StaticfromBoolean value to store.
StaticfromStores a copy of the provided ByteVector.
Binary data to store.
StaticfromStores copies of each ByteVector in the list.
List of binary buffers to store.
StaticfromNumber to store as a double-precision float.
StaticfromStores v truncated to a 32-bit signed integer.
Number to store as a signed 32-bit integer.
StaticfromStores a shallow copy of the provided VariantList.
List of Variant values to store.
Staticfrombigint to store as a signed 64-bit integer.
StaticfromStores a shallow copy of the provided VariantMap.
Map of Variant values to store.
StaticfromString to store.
StaticfromStores a copy of the provided string array.
String list to store.
StaticfromNumber to store as an unsigned 32-bit integer.
Staticfrombigint to store as an unsigned 64-bit integer.
StaticfromCreates a void (empty) Variant.
A discriminated-union value that can hold any of the types enumerated by VariantType. Used for complex metadata properties.