Values¶
Values are instances of types. Every value carries its Type and obeys
the Java-like equals / hash / compare contract. Value is the base
class, exposing factory methods for creating and converting values; each concrete
class (ValueString, ValueInt64, …) is constructible directly.
When to use: use values to hold typed data. Primitives are immutable; containers
(ValueVector, ValueMap, ValueSet, ValueXArray) are mutable. INT64/UINT64
values encode to native bigint; every other integer and float encodes to number.
For the conceptual guide see Types and Values; for the type system see Types. The Python equivalent is Values.
Quick Start¶
const { Value, Type, ValueString, ValueInt64, ValueDouble } = require('@digitalsubstrate/dsviper');
// Direct construction for primitives
const name = new ValueString('Alice');
const count = new ValueInt64(42n); // INT64 ↔ bigint
// Factory with an explicit type (no native arg defaults the value)
const score = Value.create(Type.DOUBLE, 3.14);
const zero = Value.create(Type.INT64); // 0n
// Infer the value class from a JS scalar
const flag = Value.deduce(true); // ValueDouble / ValueString / ValueBool ...
// Access the underlying JS value, its text form, and its type
name.encoded(); // 'Alice'
score.representation(); // '3.14'
name.type().equals(Type.STRING); // true
// equals/compare accept native arguments (never use == between values)
count.equals(42n); // true
new ValueDouble(1).compare(2) < 0; // true
// Parse from text — returns undefined on failure (not a throw)
ValueInt64.tryParse('42').encoded(); // 42n
ValueInt64.tryParse('not a number'); // undefined
// cast re-types a Value, throwing a ViperError on mismatch
ValueDouble.cast(score).encoded(); // 3.14
// Per-type singletons
ValueInt64.ZERO.encoded(); // 0n
ValueDouble.ONE.encoded(); // 1.0
Choosing the Right Pattern¶
Pattern |
When to use |
Example |
|---|---|---|
|
Direct primitive construction |
|
|
Generic factory with an explicit type |
|
|
Infer the value class from a JS scalar |
|
|
Deserialize from the binary stream codec |
|
|
Parse from text, |
|
|
Re-type a value, |
|
Generated from the @digitalsubstrate/dsviper TypeScript declarations (index.d.ts) by TypeDoc.
Summary¶
Class |
Description |
|---|---|
A utility class to handle value instantiation and representation |
|
A class used to represent a value of any type |
|
A class used to represent a value of type blob |
|
A class used to represent a value of type blob_id |
|
A class used to represent a value of type bool |
|
A class used to represent a value of type commit_id |
|
A class used to represent a value of type double |
|
A class used to represent a value of type struct |
|
A class used to represent a value of type float |
|
A class used to represent a value of type int16 |
|
A class used to represent a value of type int32 |
|
A class used to represent a value of type int64 |
|
A class used to represent a value of type int8 |
|
A class used to represent a value of type key<element_type> |
|
A class used to represent a value of type map<key_type, element_type> |
|
A class used to represent a value of type mat<element_type, columns, rows> |
|
A utility class to handle opcodes encoder and streamer |
|
A class used to represent the type and the arguments of an opcode |
|
A class used to represent the type and the arguments of an opcode |
|
A class used to retrieve the mutation opcodes for an instance of a concept for an attachment |
|
A class used to represent the type and the arguments of an opcode |
|
A class used to represent the type and the arguments of an opcode |
|
A class used to represent the type and the arguments of an opcode |
|
A class used to represent the type and the arguments of an opcode |
|
A class used to represent the type and the arguments of an opcode |
|
A class used to represent the type and the arguments of an opcode |
|
A class used to represent the type and the arguments of an opcode |
|
A class used to represent the type and the arguments of an opcode |
|
A class used to represent a value of type optional<element_type> |
|
A class used to represent traced opcode |
|
A class used to represent a traced opcode |
|
A class used to retrieve opcodes |
|
A class used to represent a value of type set<element_type> |
|
Iterator for ValueSet elements |
|
A class used to represent a value of type string |
|
A class used to represent a value of type struct |
|
A class used to represent a value of type tuple<T0, …> |
|
Iterator for ValueTuple elements |
|
A class used to represent a value of type uint16 |
|
A class used to represent a value of type uint32 |
|
A class used to represent a value of type uint64 |
|
A class used to represent a value of type uint8 |
|
A class used to represent a value of type uuid |
|
ValueVariant(type_variant, initial_value) |
|
ValueVec(type_vec [, initial_value]) |
|
A class used to represent a value of type vector<element_type> |
|
Iterator for ValueVector elements |
|
A class used to represent a value of type void |
|
A class used to represent a value of type xarray<element_type> |
Reference¶
- class Value()¶
A utility class to handle value instantiation and representation.
Note: Not directly instantiable.
exported from
index.d- Value.compare(other)¶
- Arguments:
other (Value)
- Returns:
number
- Value.description(namespace)¶
- Arguments:
namespace (NameSpace)
- Returns:
string
- Value.equals(other)¶
- Arguments:
other (unknown)
- Returns:
boolean
- Value.hash()¶
- Returns:
bigint
- Value.representation()¶
- Returns:
string
- Value.toString()¶
- Returns:
string
- Value.type()¶
- Returns:
Type
- Value.typeCode()¶
- Returns:
string
- static Value.bsonDecode(blob, typeStructure, definitions)¶
Return a value by decoding the bson encoded blob of a structure.
- Arguments:
blob (ValueBlob)
typeStructure (TypeStructure)
definitions (DefinitionsConst)
- Returns:
ValueStructure
- static Value.bsonEncode(value)¶
Return the bson encoded blob of the value.
- Arguments:
value (ValueStructure)
- Returns:
ValueBlob
- static Value.collectBlobIds(object)¶
- Return the set of blob_id of all referenced blob_id by the object,
where object must be a Value, a Path, a CommitState, a CommitMutableState or a ValueProgram.
- Arguments:
object (Value)
- Returns:
ValueBlobId[]
- static Value.copy(value)¶
Return a copy of a value (deepcopy).
- Arguments:
value (Value)
- Returns:
Value
- static Value.create(...args)¶
Return an initialized value from the type.
- Arguments:
args (any[])
- Returns:
Value
- static Value.decode(blob, type, definitions, streamCodecInstancing, packSized)¶
- Return a Value by decoding the blob with a StreamBinaryCodec if not
specified.
If pack_sized is true, then the vector<T> where T is a Sized type keeps an element in the binary encoded representation. This feature is only used for decoding huge immutable resource by deferred the decoding cost to the method ValueVector.at(index).
- Arguments:
blob (ValueBlob)
type (Type)
definitions (DefinitionsConst)
streamCodecInstancing (StreamCodecInstancing)
packSized (boolean)
- Returns:
Value
- static Value.deduce(value)¶
Return a strong typed conversion of an object.
- Arguments:
value (NativeValue)
- Returns:
Value
- static Value.dumps(value, json)¶
- Return a projection to Python objects of the strong typed value.
If json is true then: - a set is converted to a list. - a map is converted to a list of (key, value).
- Arguments:
value (Value)
json (boolean)
- Returns:
NativeValue
- static Value.encode(value, streamCodecInstancing)¶
- Return a blob that encodes the value with a StreamBinaryCodec if not
specified.
- Arguments:
value (Value)
streamCodecInstancing (StreamCodecInstancing)
- Returns:
ValueBlob
- static Value.hexdigest(value, hashing)¶
Hash the value with the hashing interface if specified else use SHA1.
- Arguments:
value (Value)
hashing (Hashing)
- Returns:
string
- static Value.jsonDecode(string, type, definitions)¶
Return a value by decoding the json encoded string.
- Arguments:
string (string)
type (Type)
definitions (DefinitionsConst)
- Returns:
Value
- static Value.jsonEncode(value, indent)¶
Return the JSON encoded string for the value.
- Arguments:
value (Value)
indent (number)
- Returns:
string
- static Value.loads(object, type, definitions)¶
Return a value by decoding the Python object.
- Arguments:
object (NativeValue)
type (Type)
definitions (DefinitionsConst)
- Returns:
Value
- static Value.read(type, streamReading, definitions, packSized)¶
Read the value from the stream.
- Arguments:
type (Type)
streamReading (StreamReading)
definitions (DefinitionsConst)
packSized (boolean)
- Returns:
Value
- static Value.succ(value)¶
Return the successor of a value.
- Arguments:
value (Value)
- Returns:
Value
- static Value.write(value, streamWriting)¶
Write the value to the stream.
- Arguments:
value (Value)
streamWriting (StreamWriting)
- class ValueAny(initialValue)¶
- A class used to represent a value of any type.
Seamless with many Python objects.
Or use Value.create(Type.ANY [, initial_value]).
exported from
index.d- Extends:
Value
- Arguments:
initialValue (InputValue | ValueAny)
- ValueAny.clear()¶
Clear the container.
- ValueAny.copy()¶
Return a deep copy.
- Returns:
ValueAny
- ValueAny.hash()¶
Return the hash value.
- Returns:
bigint
- ValueAny.isNil()¶
Return true if there is no value to unwrap.
- Returns:
boolean
- ValueAny.unwrap(encoded)¶
Return the wrapped value or throw.
- Arguments:
encoded (boolean)
- Returns:
OutputValue
- ValueAny.wrap(value)¶
Wrap a value.
- Arguments:
value (InputValue)
- static ValueAny.cast(value)¶
Return an any or throw.
- Arguments:
value (Value)
- Returns:
ValueAny
- class ValueBlob(value)¶
- A class used to represent a value of type blob.
Seamless with bytes, bytearray and base64_string.
Or use Value.create(Type.BLOB [, initial_value]).
exported from
index.d- Extends:
Value
- Arguments:
value (string | ValueBlob)
- ValueBlob.at(index)¶
Return the byte at the given index (out of range throws).
- Arguments:
index (number)
- Returns:
number
- ValueBlob.base64Encode()¶
Return the base64 encoded string representation of this blob.
- Returns:
string
- ValueBlob.copy()¶
Return a deep copy.
- Returns:
ValueBlob
- ValueBlob.embed(name)¶
Return the c++ representation of a blob.
- Arguments:
name (string)
- Returns:
string
- ValueBlob.encoded()¶
Return a bytes.
- Returns:
Buffer
- ValueBlob.hash()¶
Return the hash value.
- Returns:
bigint
- ValueBlob.sha1()¶
Return the hexdigest (SHA1).
- Returns:
string
- ValueBlob.size()¶
Return the size.
- Returns:
number
- static ValueBlob.base64Decode(base64String)¶
Return a blob from a base64 encoded string.
- Arguments:
base64String (string)
- Returns:
ValueBlob
- static ValueBlob.cast(value)¶
Return a blob or throw.
- Arguments:
value (Value)
- Returns:
ValueBlob
- class ValueBlobId(blobLayout, blob)¶
- A class used to represent a value of type blob_id.
The uniq identifier is computed from the immutable content of the blob and the layout.
exported from
index.d- Extends:
Value
- Arguments:
blobLayout (BlobLayout)
blob (ValueBlob)
- ValueBlobId.INVALID¶
type: readonly ValueBlobId
- ValueBlobId.copy()¶
Return a deep copy.
- Returns:
ValueBlobId
- ValueBlobId.encoded()¶
Return a string.
- Returns:
string
- ValueBlobId.hash()¶
Return the hash value.
- Returns:
bigint
- ValueBlobId.isValid()¶
Return true if the value is not INVALID.
- Returns:
boolean
- static ValueBlobId.cast(value)¶
Return a blob_id or throw.
- Arguments:
value (Value)
- Returns:
ValueBlobId
- static ValueBlobId.tryParse(string)¶
Return a blob_id or null.
- Arguments:
string (string)
- Returns:
ValueBlobId | undefined
- class ValueBool(value)¶
- A class used to represent a value of type bool.
Seamless with a bool.
Or use Value.create(Type.BOOL [, true|false]).
exported from
index.d- Extends:
Value
- Arguments:
value (boolean | ValueBool)
- ValueBool.FALSE¶
type: readonly ValueBool
- ValueBool.TRUE¶
type: readonly ValueBool
- ValueBool.copy()¶
Return a deep copy.
- Returns:
ValueBool
- ValueBool.encoded()¶
Return a bool.
- Returns:
boolean
- ValueBool.hash()¶
Return the hash value.
- Returns:
bigint
- static ValueBool.cast(value)¶
Return a bool or throw.
- Arguments:
value (Value)
- Returns:
ValueBool
- static ValueBool.tryParse(string)¶
Return a bool or null.
- Arguments:
string (string)
- Returns:
ValueBool | undefined
- class ValueCommitId(value)¶
A class used to represent a value of type commit_id.
Use the static factory method tryParse(…).
Or use Value.create(Type.COMMIT_ID [, initial_value]).
exported from
index.d- Extends:
Value
- Arguments:
value (string | ValueCommitId)
- ValueCommitId.INVALID¶
type: readonly ValueCommitId
- ValueCommitId.copy()¶
Return a deep copy.
- Returns:
ValueCommitId
- ValueCommitId.encoded()¶
Return a string.
- Returns:
string
- ValueCommitId.hash()¶
Return the hash value.
- Returns:
bigint
- ValueCommitId.isValid()¶
Return true if the CommitId is not INVALID.
- Returns:
boolean
- static ValueCommitId.cast(value)¶
Return a commit_id or throw.
- Arguments:
value (Value)
- Returns:
ValueCommitId
- static ValueCommitId.tryParse(string)¶
Return a commit_id or null.
- Arguments:
string (string)
- Returns:
ValueCommitId | undefined
- class ValueDouble(value)¶
- A class used to represent a value of type double.
Seamless with a float.
Or use Value.create(Type.DOUBLE [, initial_value])
exported from
index.d- Extends:
Value
- Arguments:
value (number | ValueDouble)
- ValueDouble.INF¶
type: readonly ValueDouble
- ValueDouble.NAN¶
type: readonly ValueDouble
- ValueDouble.NEG_INF¶
type: readonly ValueDouble
- ValueDouble.ONE¶
type: readonly ValueDouble
- ValueDouble.ZERO¶
type: readonly ValueDouble
- ValueDouble.copy()¶
Return a deep copy.
- Returns:
ValueDouble
- ValueDouble.encoded()¶
Return a float.
- Returns:
number
- ValueDouble.hash()¶
Return the hash value.
- Returns:
bigint
- static ValueDouble.cast(value)¶
Return a double or throw.
- Arguments:
value (Value)
- Returns:
ValueDouble
- static ValueDouble.tryParse(string)¶
Return a double or null.
- Arguments:
string (string)
- Returns:
ValueDouble | undefined
- class ValueEnumeration(type, value)¶
- A class used to represent a value of type struct.
Seamless with a string.
Or use Value.create(type_enumeration [, initial_value]). If the initial_value is not specified, the first enum case is used.
The string representation of an enum case start with a ‘.’. ex: Value.create(type_enum_E, ‘.a’) or Value.create(type_enum_E, ‘E.a’).
exported from
index.d- Extends:
Value
- Arguments:
type (TypeEnumeration)
value (string | number | ValueEnumeration)
- ValueEnumeration.copy()¶
Return a deep copy.
- Returns:
ValueEnumeration
- ValueEnumeration.hash()¶
- Returns:
bigint
- ValueEnumeration.index()¶
Return the index.
- Returns:
number
- ValueEnumeration.name()¶
Return the name of the enumeration case.
- Returns:
string
- ValueEnumeration.typeEnumeration()¶
Return the type enum.
- Returns:
TypeEnumeration
- static ValueEnumeration.cast(value)¶
Return an enum or throw.
- Arguments:
value (Value)
- Returns:
ValueEnumeration
- static ValueEnumeration.tryParse(string, typeEnumeration)¶
Return an enum or null.
- Arguments:
string (string)
typeEnumeration (TypeEnumeration)
- Returns:
ValueEnumeration | undefined
- class ValueFloat(value)¶
- A class used to represent a value of type float.
Seamless with a float.
Or use Value.create(Type.FLOAT [, initial_value]).
exported from
index.d- Extends:
Value
- Arguments:
value (number | ValueFloat)
- ValueFloat.INF¶
type: readonly ValueFloat
- ValueFloat.NAN¶
type: readonly ValueFloat
- ValueFloat.NEG_INF¶
type: readonly ValueFloat
- ValueFloat.ONE¶
type: readonly ValueFloat
- ValueFloat.ZERO¶
type: readonly ValueFloat
- ValueFloat.copy()¶
Return a deep copy.
- Returns:
ValueFloat
- ValueFloat.encoded()¶
Return a float.
- Returns:
number
- ValueFloat.hash()¶
Return the hash value.
- Returns:
bigint
- static ValueFloat.cast(value)¶
Return a float or throw.
- Arguments:
value (Value)
- Returns:
ValueFloat
- static ValueFloat.tryParse(string)¶
Return a float or null.
- Arguments:
string (string)
- Returns:
ValueFloat | undefined
- class ValueInt16(value)¶
- A class used to represent a value of type int16.
Seamless with a int.
Or use Value.create(Type.INT16 [, initial_value]).
exported from
index.d- Extends:
Value
- Arguments:
value (number | ValueInt16)
- ValueInt16.ONE¶
type: readonly ValueInt16
- ValueInt16.ZERO¶
type: readonly ValueInt16
- ValueInt16.copy()¶
Return a deep copy.
- Returns:
ValueInt16
- ValueInt16.encoded()¶
Return a int.
- Returns:
number
- ValueInt16.hash()¶
Return the hash value.
- Returns:
bigint
- static ValueInt16.cast(value)¶
Return an int16 or throw.
- Arguments:
value (Value)
- Returns:
ValueInt16
- static ValueInt16.tryParse(string)¶
Return an int16 or null.
- Arguments:
string (string)
- Returns:
ValueInt16 | undefined
- class ValueInt32(value)¶
- A class used to represent a value of type int32.
Seamless with a int.
Or use Value.create(Type.INT32 [, initial_value]).
exported from
index.d- Extends:
Value
- Arguments:
value (number | ValueInt32)
- ValueInt32.ONE¶
type: readonly ValueInt32
- ValueInt32.ZERO¶
type: readonly ValueInt32
- ValueInt32.copy()¶
Return a deep copy.
- Returns:
ValueInt32
- ValueInt32.encoded()¶
Return a int.
- Returns:
number
- ValueInt32.hash()¶
Return the hash value.
- Returns:
bigint
- static ValueInt32.cast(value)¶
Return an int32 or throw.
- Arguments:
value (Value)
- Returns:
ValueInt32
- static ValueInt32.tryParse(string)¶
Return an int32 or null.
- Arguments:
string (string)
- Returns:
ValueInt32 | undefined
- class ValueInt64(value)¶
- A class used to represent a value of type int64.
Seamless with a int.
Or use Value.create(Type.INT64 [, initial_value]).
exported from
index.d- Extends:
Value
- Arguments:
value (bigint | ValueInt64)
- ValueInt64.ONE¶
type: readonly ValueInt64
- ValueInt64.ZERO¶
type: readonly ValueInt64
- ValueInt64.copy()¶
Return a deep copy.
- Returns:
ValueInt64
- ValueInt64.encoded()¶
Return a int.
- Returns:
bigint
- ValueInt64.hash()¶
Return the hash value.
- Returns:
bigint
- static ValueInt64.cast(value)¶
Return an int64 or throw.
- Arguments:
value (Value)
- Returns:
ValueInt64
- static ValueInt64.tryParse(string)¶
Return an int64 or null.
- Arguments:
string (string)
- Returns:
ValueInt64 | undefined
- class ValueInt8(value)¶
- A class used to represent a value of type int8.
Seamless with a int.
Or use Value.create(Type.INT8 [, initial_value]).
exported from
index.d- Extends:
Value
- Arguments:
value (number | ValueInt8)
- ValueInt8.ONE¶
type: readonly ValueInt8
- ValueInt8.ZERO¶
type: readonly ValueInt8
- ValueInt8.copy()¶
Return a deep copy.
- Returns:
ValueInt8
- ValueInt8.encoded()¶
Return a int.
- Returns:
number
- ValueInt8.hash()¶
Return the hash value.
- Returns:
bigint
- static ValueInt8.cast(value)¶
Return an int8 or throw.
- Arguments:
value (Value)
- Returns:
ValueInt8
- static ValueInt8.tryParse(string)¶
Return an int8 or null.
- Arguments:
string (string)
- Returns:
ValueInt8 | undefined
- class ValueKey()¶
- A class used to represent a value of type key<element_type>. Use the static
factory method create(…).
Note: Not directly instantiable.
exported from
index.d- Extends:
Value
- ValueKey.copy()¶
Return a deep copy.
- Returns:
ValueKey
- ValueKey.detailRepresentation()¶
Return a detailed representation.
- Returns:
string
- ValueKey.detailTypeRepresentation()¶
Return the detail type representation.
- Returns:
string
- ValueKey.hasParentKey()¶
Return true if a parent key is available.
- Returns:
boolean
- ValueKey.hash()¶
Return the hash value.
- Returns:
bigint
- ValueKey.instanceId()¶
Return the uuid of the instance.
- Returns:
ValueUUId
- ValueKey.isMember(targetConcept)¶
Return true if target_concept is a member.
- Arguments:
targetConcept (TypeConcept)
- Returns:
boolean
- ValueKey.toAnyConceptKey()¶
Return an key<any_concept>.
- Returns:
ValueKey
- ValueKey.toClubKey(typeClub)¶
Return a key<type_club> or throw.
- Arguments:
typeClub (TypeClub)
- Returns:
ValueKey
- ValueKey.toConceptKey()¶
Return a key<type_concept>.
- Returns:
ValueKey
- ValueKey.toKey(typeKey)¶
Return a key<type_key> or throw.
- Arguments:
typeKey (TypeKey)
- Returns:
ValueKey
- ValueKey.toMemberKey(targetConcept)¶
Return a key<target_concept> or throw.
- Arguments:
targetConcept (TypeConcept)
- Returns:
ValueKey
- ValueKey.toParentKey()¶
Return a key<parent_concept> or throw.
- Returns:
ValueKey
- ValueKey.typeConcept()¶
Return the type of the concept.
- Returns:
TypeConcept
- ValueKey.typeKey()¶
Return the TypeKey.
- Returns:
TypeKey
- static ValueKey.cast(value)¶
Return a key or throw.
- Arguments:
value (Value)
- Returns:
ValueKey
- static ValueKey.create(typeConcept, instanceId)¶
Return a new key with the instance_id or a generated one if not specified.
- Arguments:
typeConcept (TypeConcept)
instanceId (string | ValueUUId)
- Returns:
ValueKey
- static ValueKey.keys(key)¶
Return the list of hierarchical keys.
- Arguments:
key (ValueKey)
- Returns:
ValueKey[]
- class ValueMap()¶
- A class used to represent a value of type map<key_type, element_type>.
Seamless with a dict[object, object].
Or use Value.create(type_map [, initial_value]).
exported from
index.d- Extends:
DeepKeyPath
Value
- ValueMap.[Symbol․iterator]()¶
- Returns:
Iterator<OutputValue>
- ValueMap.at(key, encoded)¶
Return the value for a key.
- Arguments:
key (InputValue)
encoded (boolean)
- Returns:
OutputValue
- ValueMap.clear()¶
Remove all items.
- ValueMap.contains(key)¶
Return true if the value is present.
- Arguments:
key (InputValue)
- Returns:
boolean
- ValueMap.copy()¶
Return a deep copy.
- Returns:
ValueMap
- ValueMap.discard(key)¶
Remove the key if present.
- Arguments:
key (InputValue)
- ValueMap.empty()¶
Return true if the container is empty.
- Returns:
boolean
- ValueMap.get(key, default_)¶
Return the value associated with the key or default.
- Arguments:
key (InputValue)
default_ (InputValue)
- Returns:
OutputValue | undefined
- ValueMap.items(encoded)¶
Return a MapItemsIter.
- Arguments:
encoded (boolean)
- Returns:
OutputValue
- ValueMap.keys(encoded)¶
Return a MapKeysIter.
- Arguments:
encoded (boolean)
- Returns:
OutputValue
- ValueMap.max(encoded)¶
Return the max key.
- Arguments:
encoded (boolean)
- Returns:
OutputValue
- ValueMap.min(encoded)¶
Return the min key.
- Arguments:
encoded (boolean)
- Returns:
OutputValue
- ValueMap.pop(key, default_, encoded)¶
- Remove the key and return the corresponding value.
If the key is not found, return the default if given; otherwise throw.
- Arguments:
key (InputValue)
default_ (InputValue)
encoded (boolean)
- Returns:
OutputValue
- ValueMap.popitem()¶
- Remove and return a (key, value) pair as a 2-tuple.
Throws error if the map is empty.
- Returns:
ValueTuple
- ValueMap.remove(key)¶
Remove the key or raises.
- Arguments:
key (InputValue)
- ValueMap.set(key, value)¶
Set the value for a key.
- Arguments:
key (InputValue)
value (InputValue)
- ValueMap.setdefault(key, value)¶
- Insert the value for the key if the key is not in the map.
Return the value for the key if the key is in the map, else default.
- Arguments:
key (InputValue)
value (InputValue)
- ValueMap.size()¶
Return the number of elements.
- Returns:
number
- ValueMap.typeMap()¶
Return the type map<key_type, element_type>.
- Returns:
TypeMap
- ValueMap.update(value)¶
for k, v in other: self[key] = v.
- Arguments:
value (InputValue)
- ValueMap.values(encoded)¶
Return a MapValuesIter.
- Arguments:
encoded (boolean)
- Returns:
OutputValue
- static ValueMap.cast(value)¶
Return a map or throw.
- Arguments:
value (Value)
- Returns:
ValueMap
- class ValueMat(type, value)¶
- A class used to represent a value of type mat<element_type, columns, rows>.
Seamless with a seq[seq[int|float]].
Or use Value.create(type_mat [, initial_value]).
exported from
index.d- Extends:
Value
- Arguments:
type (TypeMat)
value (InputValue[] | ValueMat)
- ValueMat.at(column, row, encoded)¶
Return the value at column and row.
- Arguments:
column (number)
row (number)
encoded (boolean)
- Returns:
OutputValue
- ValueMat.columns()¶
Return the number of columns.
- Returns:
number
- ValueMat.copy()¶
Return a deep copy.
- Returns:
ValueMat
- ValueMat.hash()¶
Return the hash value.
- Returns:
bigint
- ValueMat.rows()¶
Return the number of rows.
- Returns:
number
- ValueMat.set(column, row, value)¶
Set the value at column, row.
- Arguments:
column (number)
row (number)
value (InputValue)
- ValueMat.size()¶
Return the number of elements.
- Returns:
number
- ValueMat.toTuple()¶
Return a tuple.
- Returns:
number[][]
- ValueMat.typeMat()¶
Return the type mat<element_type, size>.
- Returns:
TypeMat
- static ValueMat.cast(value)¶
Return a mat or throw.
- Arguments:
value (Value)
- Returns:
ValueMat
- class ValueOpcode()¶
A utility class to handle opcodes encoder and streamer.
Note: Not directly instantiable.
exported from
index.d- ValueOpcode.key()¶
- Returns:
ValueOpcodeKey
- ValueOpcode.type()¶
- Returns:
string
- static ValueOpcode.decode(blob, definitions, streamCodecInstancing)¶
- Return a list of opcodes by decoding the blob with a StreamBinaryCodec if not
specified. .
- Arguments:
blob (ValueBlob)
definitions (DefinitionsConst)
streamCodecInstancing (StreamCodecInstancing)
- Returns:
ValueOpcode[]
- static ValueOpcode.encode(opcodes, streamCodecInstancing)¶
- Return a blob that encodes the list of opcodes with a StreamBinaryCodec if not
specified.
- Arguments:
opcodes (ValueOpcode[])
streamCodecInstancing (StreamCodecInstancing)
- Returns:
ValueBlob
- static ValueOpcode.read(streamReading, definitions)¶
Read and return the list of opcodes from the stream.
- Arguments:
streamReading (StreamReading)
definitions (DefinitionsConst)
- Returns:
ValueOpcode[]
- static ValueOpcode.write(opcodes, streamWriting)¶
Write the list of opcodes to the stream.
- Arguments:
opcodes (ValueOpcode[])
streamWriting (StreamWriting)
- class ValueOpcodeDocumentSet()¶
A class used to represent the type and the arguments of an opcode.
Note: Not directly instantiable.
exported from
index.d- Extends:
ValueOpcode
- ValueOpcodeDocumentSet.arguments(definitions)¶
Return the tuple(attachment, key, value).
- Arguments:
definitions (DefinitionsConst)
- Returns:
[Attachment, ValueKey, Value]
- ValueOpcodeDocumentSet.value()¶
Return the value.
- Returns:
Value
- class ValueOpcodeDocumentUpdate()¶
A class used to represent the type and the arguments of an opcode.
Note: Not directly instantiable.
exported from
index.d- Extends:
ValueOpcode
- ValueOpcodeDocumentUpdate.arguments(definitions)¶
Return the tuple(attachment, key, path, value).
- Arguments:
definitions (DefinitionsConst)
- Returns:
[Attachment, ValueKey, PathConst, Value]
- ValueOpcodeDocumentUpdate.path()¶
Return the path.
- Returns:
PathConst
- ValueOpcodeDocumentUpdate.value()¶
Return the value.
- Returns:
Value
- class ValueOpcodeKey()¶
- A class used to retrieve the mutation opcodes for an instance of a concept for
an attachment. Only used by the evaluator.
Note: Not directly instantiable.
exported from
index.d- ValueOpcodeKey.attachmentRuntimeId()¶
Return the uuid assigned by the runtime.
- Returns:
ValueUUId
- ValueOpcodeKey.conceptRuntimeId()¶
Return the uuid assigned by the runtime for the concept’s type.
- Returns:
ValueUUId
- ValueOpcodeKey.instanceId()¶
Return the uuid of the instance of the concept.
- Returns:
ValueUUId
- class ValueOpcodeMapSubtract()¶
A class used to represent the type and the arguments of an opcode.
Note: Not directly instantiable.
exported from
index.d- Extends:
ValueOpcode
- ValueOpcodeMapSubtract.arguments(definitions)¶
Return the tuple(attachment, key, path, value).
- Arguments:
definitions (DefinitionsConst)
- Returns:
[Attachment, ValueKey, PathConst, ValueSet]
- ValueOpcodeMapSubtract.path()¶
Return the path.
- Returns:
PathConst
- ValueOpcodeMapSubtract.value()¶
Return the value.
- Returns:
ValueSet
- class ValueOpcodeMapUnion()¶
A class used to represent the type and the arguments of an opcode.
Note: Not directly instantiable.
exported from
index.d- Extends:
ValueOpcode
- ValueOpcodeMapUnion.arguments(definitions)¶
Return the tuple(attachment, key, path, value).
- Arguments:
definitions (DefinitionsConst)
- Returns:
[Attachment, ValueKey, PathConst, ValueMap]
- ValueOpcodeMapUnion.path()¶
Return the path.
- Returns:
PathConst
- ValueOpcodeMapUnion.value()¶
Return the value.
- Returns:
ValueMap
- class ValueOpcodeMapUpdate()¶
A class used to represent the type and the arguments of an opcode.
Note: Not directly instantiable.
exported from
index.d- Extends:
ValueOpcode
- ValueOpcodeMapUpdate.arguments(definitions)¶
Return the tuple(attachment, key, path, value).
- Arguments:
definitions (DefinitionsConst)
- Returns:
[Attachment, ValueKey, PathConst, ValueMap]
- ValueOpcodeMapUpdate.path()¶
Return the path.
- Returns:
PathConst
- ValueOpcodeMapUpdate.value()¶
Return the value.
- Returns:
ValueMap
- class ValueOpcodeSetSubtract()¶
A class used to represent the type and the arguments of an opcode.
Note: Not directly instantiable.
exported from
index.d- Extends:
ValueOpcode
- ValueOpcodeSetSubtract.arguments(definitions)¶
Return the tuple(attachment, key, path, value).
- Arguments:
definitions (DefinitionsConst)
- Returns:
[Attachment, ValueKey, PathConst, ValueSet]
- ValueOpcodeSetSubtract.path()¶
Return the path.
- Returns:
PathConst
- ValueOpcodeSetSubtract.value()¶
Return the value.
- Returns:
ValueSet
- class ValueOpcodeSetUnion()¶
A class used to represent the type and the arguments of an opcode.
Note: Not directly instantiable.
exported from
index.d- Extends:
ValueOpcode
- ValueOpcodeSetUnion.arguments(definitions)¶
Return the tuple(attachment, key, path, value).
- Arguments:
definitions (DefinitionsConst)
- Returns:
[Attachment, ValueKey, PathConst, ValueSet]
- ValueOpcodeSetUnion.path()¶
Return the path.
- Returns:
PathConst
- ValueOpcodeSetUnion.value()¶
Return the value.
- Returns:
ValueSet
- class ValueOpcodeXArrayInsert()¶
A class used to represent the type and the arguments of an opcode.
Note: Not directly instantiable.
exported from
index.d- Extends:
ValueOpcode
- ValueOpcodeXArrayInsert.arguments(definitions)¶
Return the tuple(attachment, key, value, before_position, new_position).
- Arguments:
definitions (DefinitionsConst)
- Returns:
[Attachment, ValueKey, PathConst, ValueUUId, ValueUUId]
- ValueOpcodeXArrayInsert.beforePosition()¶
Return the before position.
- Returns:
ValueUUId
- ValueOpcodeXArrayInsert.path()¶
Return the path.
- Returns:
PathConst
- ValueOpcodeXArrayInsert.position()¶
Return the position.
- Returns:
ValueUUId
- class ValueOpcodeXArrayRemove()¶
A class used to represent the type and the arguments of an opcode.
Note: Not directly instantiable.
exported from
index.d- Extends:
ValueOpcode
- ValueOpcodeXArrayRemove.arguments(definitions)¶
Return the tuple(attachment, key, value, position).
- Arguments:
definitions (DefinitionsConst)
- Returns:
[Attachment, ValueKey, PathConst, ValueUUId]
- ValueOpcodeXArrayRemove.path()¶
Return the path.
- Returns:
PathConst
- ValueOpcodeXArrayRemove.position()¶
Return the position.
- Returns:
ValueUUId
- class ValueOpcodeXArrayUpdate()¶
A class used to represent the type and the arguments of an opcode.
Note: Not directly instantiable.
exported from
index.d- Extends:
ValueOpcode
- ValueOpcodeXArrayUpdate.arguments(definitions)¶
Return the tuple(attachment, key, path, position, value).
- Arguments:
definitions (DefinitionsConst)
- Returns:
[Attachment, ValueKey, PathConst, ValueUUId, Value]
- ValueOpcodeXArrayUpdate.path()¶
Return the path.
- Returns:
PathConst
- ValueOpcodeXArrayUpdate.position()¶
Return the position.
- Returns:
ValueUUId
- ValueOpcodeXArrayUpdate.value()¶
Return the value.
- Returns:
Value
- class ValueOptional(type, value)¶
A class used to represent a value of type optional<element_type>.
Or use Value.create(type_optional [, initial_value]).
exported from
index.d- Extends:
Value
- Arguments:
type (TypeOptional)
value (InputValue | ValueOptional)
- ValueOptional.clear()¶
Clear the container.
- ValueOptional.copy()¶
Return a deep copy.
- Returns:
ValueOptional
- ValueOptional.get(default_, encoded)¶
Return the wrapped value or return default if given; otherwise throw.
- Arguments:
default_ (InputValue)
encoded (boolean)
- Returns:
OutputValue
- ValueOptional.hash()¶
- Returns:
bigint
- ValueOptional.isNil()¶
Return true if there is no value to unwrap.
- Returns:
boolean
- ValueOptional.typeOptional()¶
Return the type optional<element_type>.
- Returns:
TypeOptional
- ValueOptional.unwrap(encoded)¶
Return the wrapped value or throw.
- Arguments:
encoded (boolean)
- Returns:
OutputValue
- ValueOptional.wrap(value)¶
Wrap the value.
- Arguments:
value (InputValue)
- static ValueOptional.cast(value)¶
Return an optional or throw.
- Arguments:
value (Value)
- Returns:
ValueOptional
- class ValueProcessorTrace()¶
A class used to represent traced opcode.
Note: Not directly instantiable.
exported from
index.d- ValueProcessorTrace.enabled()¶
Return the enabled.
- Returns:
boolean
- ValueProcessorTrace.opcodes()¶
Return the list of traces opcodes.
- Returns:
ValueProcessorTraceOpcode[]
- class ValueProcessorTraceOpcode()¶
A class used to represent a traced opcode.
Note: Not directly instantiable.
exported from
index.d- ValueProcessorTraceOpcode.exception()¶
Return the exception or null.
- Returns:
string | undefined
- ValueProcessorTraceOpcode.opcode()¶
Return the opcode.
- Returns:
ValueOpcode
- class ValueProgram()¶
A class used to retrieve opcodes.
Note: Not directly instantiable.
exported from
index.d- ValueProgram.allOpcodes()¶
Return the list of all opcodes.
- Returns:
ValueOpcode[]
- ValueProgram.documentSetKeys(attachmentRuntimeId)¶
- Return the set of ValueOpcodeKey of type ‘Document_Set’ associated
with the attachment_runtime_id.
- Arguments:
attachmentRuntimeId (ValueUUId)
- Returns:
ValueOpcodeKey[]
- ValueProgram.hasDocumentSet(opcodeKey)¶
- Return true if an opcode ‘Document_Set’ is associated with the
opcode_key.
- Arguments:
opcodeKey (ValueOpcodeKey)
- Returns:
boolean
- ValueProgram.opcodes(attachmentRuntimeId, key)¶
- Return the list of opcodes associated with attachment_runtime_id
and the key.
- Arguments:
attachmentRuntimeId (ValueUUId)
key (ValueKey)
- Returns:
ValueOpcode[]
- class ValueSet(type, value)¶
- A class used to represent a value of type set<element_type>.
Seamless with a seq[object].
Or use Value.create(type_set [, initial_value]).
exported from
index.d- Extends:
Value
- Arguments:
type (TypeSet)
value (InputValue)
- ValueSet.[Symbol․iterator]()¶
- Returns:
Iterator<OutputValue>
- ValueSet.add(value)¶
- Add an element to a set.
This has no effect if the element is already present.
- Arguments:
value (InputValue)
- ValueSet.at(index, encoded)¶
Return the element at index.
- Arguments:
index (number)
encoded (boolean)
- Returns:
OutputValue
- ValueSet.clear()¶
Remove all elements from this set.
- ValueSet.copy()¶
Return a deep copy.
- Returns:
ValueSet
- ValueSet.difference(value)¶
- Return the difference of two or more sets as a new set.
(i.e., all elements that are in this set but not the others.)
- Arguments:
value (InputValue[] | ValueSet)
- Returns:
ValueSet
- ValueSet.differenceUpdate(value)¶
Remove all elements of another set from this set.
- Arguments:
value (InputValue[] | ValueSet)
- ValueSet.discard(value)¶
- Remove an element from a set; it must be a member.
If the element is not a member, do nothing.
- Arguments:
value (InputValue)
- ValueSet.empty()¶
Remove true if the container is empty.
- Returns:
boolean
- ValueSet.extend(elements)¶
Add the elements of value.
- Arguments:
elements (InputValue[] | ValueSet)
- ValueSet.hash()¶
Return the hash value.
- Returns:
bigint
- ValueSet.index(value)¶
Return the index or null.
- Arguments:
value (InputValue)
- Returns:
number | undefined
- ValueSet.intersection(value)¶
- Return the intersection of two sets as a new set.
(i.e., all elements that are in both sets.)
- Arguments:
value (InputValue[] | ValueSet)
- Returns:
ValueSet
- ValueSet.intersectionUpdate(value)¶
Update a set with the intersection of itself and another.
- Arguments:
value (InputValue[] | ValueSet)
- ValueSet.isdisjoint(value)¶
Return true if two sets have a null intersection.
- Arguments:
value (InputValue[] | ValueSet)
- Returns:
boolean
- ValueSet.issubset(value)¶
Report whether another set contains this set.
- Arguments:
value (InputValue[] | ValueSet)
- Returns:
boolean
- ValueSet.issuperset(value)¶
Report whether this set contains another set.
- Arguments:
value (InputValue[] | ValueSet)
- Returns:
boolean
- ValueSet.max(encoded)¶
Return the maximum element or throw.
- Arguments:
encoded (boolean)
- Returns:
OutputValue
- ValueSet.min(encoded)¶
Return the minimum element or throw.
- Arguments:
encoded (boolean)
- Returns:
OutputValue
- ValueSet.pop(encoded)¶
- Remove and return the min element.
Throws error if the set is empty.
- Arguments:
encoded (boolean)
- Returns:
OutputValue
- ValueSet.popMax(encoded)¶
- Remove and return the max element.
Throws error if the set is empty.
- Arguments:
encoded (boolean)
- Returns:
OutputValue
- ValueSet.remove(value)¶
- Remove an element from a set; it must be a member.
If the element is not a member, throw a KeyError.
- Arguments:
value (InputValue)
- ValueSet.size()¶
Return the number of elements.
- Returns:
number
- ValueSet.symmetricDifference(value)¶
- Return the symmetric difference of two sets as a new set.
(i.e., all elements that are in exactly one of the sets.)
- Arguments:
value (InputValue[] | ValueSet)
- Returns:
ValueSet
- ValueSet.symmetricDifferenceUpdate(value)¶
Update a set with the symmetric difference of itself and another.
- Arguments:
value (InputValue[] | ValueSet)
- ValueSet.typeSet()¶
Return the type set<element_type>.
- Returns:
TypeSet
- ValueSet.union(value)¶
- Return the union of sets as a new set.
(i.e., all elements that are in either set).
- Arguments:
value (InputValue[] | ValueSet)
- Returns:
ValueSet
- ValueSet.update(value)¶
Update a set with the union of itself and other.
- Arguments:
value (InputValue[] | ValueSet)
- static ValueSet.cast(value)¶
Return a set or throw.
- Arguments:
value (Value)
- Returns:
ValueSet
- class ValueSetIter()¶
Iterator for ValueSet elements.
Note: Not directly instantiable.
exported from
index.d- ValueSetIter.[Symbol․iterator]()¶
- Returns:
Iterator<OutputValue>
- ValueSetIter.next()¶
- Returns:
{ done: boolean; value: OutputValue; }
- class ValueString(value)¶
- A class used to represent a value of type string.
Seamless with a string.
Or use Value.create(Type.STRING [, initial_value]).
exported from
index.d- Extends:
Value
- Arguments:
value (string | ValueString)
- ValueString.EMPTY¶
type: readonly ValueString
- ValueString.copy()¶
Return a deep copy.
- Returns:
ValueString
- ValueString.encoded()¶
Return a string.
- Returns:
string
- ValueString.hash()¶
Return the hash value.
- Returns:
bigint
- static ValueString.cast(value)¶
Return a string or throw.
- Arguments:
value (Value)
- Returns:
ValueString
- class ValueStructure()¶
- A class used to represent a value of type struct.
Seamless with a dict[str, object].
Or use Value.create(type_structure [, initial_value]).
exported from
index.d- Extends:
DeepKeyPath
Value
- ValueStructure.assign(fields)¶
Set several fields at once from a plain object (type-checked per field; returns this).
- Arguments:
fields ({ [fieldName: string]: InputValue; })
- Returns:
ValueStructure
- ValueStructure.at(fieldName, encoded)¶
Return the value of the field.
- Arguments:
fieldName (string)
encoded (boolean)
- Returns:
OutputValue
- ValueStructure.copy()¶
Return a deep copy.
- Returns:
ValueStructure
- ValueStructure.set(fieldName, value)¶
Set the value of the field.
- Arguments:
fieldName (string)
value (InputValue)
- ValueStructure.toObject(encoded)¶
Return the fields as a plain object.
- Arguments:
encoded (boolean)
- Returns:
{ [fieldName: string]: OutputValue; }
- ValueStructure.typeStructure()¶
Return the type struct.
- Returns:
TypeStructure
- static ValueStructure.cast(value)¶
Return a struct or throw.
- Arguments:
value (Value)
- Returns:
ValueStructure
- class ValueTuple()¶
- A class used to represent a value of type tuple<T0, …>.
Seamless with a seq[object].
Or use Value.create(type_tuple [, initial_value]).
exported from
index.d- Extends:
DeepKeyPath
Value
- ValueTuple.[Symbol․iterator]()¶
- Returns:
Iterator<OutputValue>
- ValueTuple.at(index, encoded)¶
Return the value at index.
- Arguments:
index (number)
encoded (boolean)
- Returns:
OutputValue
- ValueTuple.copy()¶
Return a deep copy.
- Returns:
ValueTuple
- ValueTuple.empty()¶
Remove true if the container is empty.
- Returns:
boolean
- ValueTuple.replace(index, value)¶
Return a copy of the tuple where the value was replaced.
- Arguments:
index (number)
value (InputValue)
- Returns:
ValueTuple
- ValueTuple.set(index, value)¶
Set the value at index.
- Arguments:
index (number)
value (InputValue)
- ValueTuple.size()¶
Return the number of elements.
- Returns:
number
- ValueTuple.typeTuple()¶
Return the type tuple<T0,…>.
- Returns:
TypeTuple
- static ValueTuple.cast(value)¶
Return a tuple or throw.
- Arguments:
value (Value)
- Returns:
ValueTuple
- class ValueTupleIter()¶
Iterator for ValueTuple elements.
Note: Not directly instantiable.
exported from
index.d- ValueTupleIter.[Symbol․iterator]()¶
- Returns:
Iterator<OutputValue>
- ValueTupleIter.next()¶
- Returns:
{ done: boolean; value: OutputValue; }
- class ValueUInt16(value)¶
- A class used to represent a value of type uint16.
Seamless with a int.
Or use Value.create(Type.UINT16 [, initial_value]).
exported from
index.d- Extends:
Value
- Arguments:
value (number | ValueUInt16)
- ValueUInt16.ONE¶
type: readonly ValueUInt16
- ValueUInt16.ZERO¶
type: readonly ValueUInt16
- ValueUInt16.copy()¶
Return a deep copy.
- Returns:
ValueUInt16
- ValueUInt16.encoded()¶
Return a int.
- Returns:
number
- ValueUInt16.hash()¶
Return the hash value.
- Returns:
bigint
- static ValueUInt16.cast(value)¶
Return an uint16 or throw.
- Arguments:
value (Value)
- Returns:
ValueUInt16
- static ValueUInt16.tryParse(string)¶
Return an uint16 or null.
- Arguments:
string (string)
- Returns:
ValueUInt16 | undefined
- class ValueUInt32(value)¶
- A class used to represent a value of type uint32.
Seamless with a int.
Or use Value.create(Type.UINT32 [, initial_value]).
exported from
index.d- Extends:
Value
- Arguments:
value (number | ValueUInt32)
- ValueUInt32.ONE¶
type: readonly ValueUInt32
- ValueUInt32.ZERO¶
type: readonly ValueUInt32
- ValueUInt32.copy()¶
Return a deep copy.
- Returns:
ValueUInt32
- ValueUInt32.encoded()¶
Return a int.
- Returns:
number
- ValueUInt32.hash()¶
Return the hash value.
- Returns:
bigint
- static ValueUInt32.cast(value)¶
Return an uint32 or throw.
- Arguments:
value (Value)
- Returns:
ValueUInt32
- static ValueUInt32.tryParse(string)¶
Return an uint32 or null.
- Arguments:
string (string)
- Returns:
ValueUInt32 | undefined
- class ValueUInt64(value)¶
- A class used to represent a value of type uint64.
Seamless with a int.
Or use Value.create(Type.UINT64 [, initial_value]).
exported from
index.d- Extends:
Value
- Arguments:
value (bigint | ValueUInt64)
- ValueUInt64.ONE¶
type: readonly ValueUInt64
- ValueUInt64.ZERO¶
type: readonly ValueUInt64
- ValueUInt64.copy()¶
Return a deep copy.
- Returns:
ValueUInt64
- ValueUInt64.encoded()¶
Return a int.
- Returns:
bigint
- ValueUInt64.hash()¶
Return the hash value.
- Returns:
bigint
- static ValueUInt64.cast(value)¶
Return an uint64 or throw.
- Arguments:
value (Value)
- Returns:
ValueUInt64
- static ValueUInt64.tryParse(string)¶
Return an uint64 or null.
- Arguments:
string (string)
- Returns:
ValueUInt64 | undefined
- class ValueUInt8(value)¶
- A class used to represent a value of type uint8.
Seamless with a int.
Or use Value.create(Type.UINT8 [, initial_value]).
exported from
index.d- Extends:
Value
- Arguments:
value (number | ValueUInt8)
- ValueUInt8.ONE¶
type: readonly ValueUInt8
- ValueUInt8.ZERO¶
type: readonly ValueUInt8
- ValueUInt8.copy()¶
Return a deep copy.
- Returns:
ValueUInt8
- ValueUInt8.encoded()¶
Return a int.
- Returns:
number
- ValueUInt8.hash()¶
Return the hash value.
- Returns:
bigint
- static ValueUInt8.cast(value)¶
Return an uint8 or throw.
- Arguments:
value (Value)
- Returns:
ValueUInt8
- static ValueUInt8.tryParse(string)¶
Return an uint8 or null.
- Arguments:
string (string)
- Returns:
ValueUInt8 | undefined
- class ValueUUId(value)¶
A class used to represent a value of type uuid.
Use the static factory method create(…) or tryParse(…).
Or use Value.create(Type.UUID [, initial_value]).
exported from
index.d- Extends:
Value
- Arguments:
value (string | ValueUUId)
- ValueUUId.INVALID¶
type: readonly ValueUUId
- ValueUUId.copy()¶
Return a deep copy.
- Returns:
ValueUUId
- ValueUUId.encoded()¶
Return a string.
- Returns:
string
- ValueUUId.hash()¶
Return the hash value.
- Returns:
bigint
- ValueUUId.isValid()¶
Return true if the value is not INVALID.
- Returns:
boolean
- static ValueUUId.cast(value)¶
Return an uuid or throw.
- Arguments:
value (Value)
- Returns:
ValueUUId
- static ValueUUId.create(uuidString)¶
Return an uuid from uuid_string if specified otherwise a generated one.
- Arguments:
uuidString (string | ValueUUId)
- Returns:
ValueUUId
- static ValueUUId.tryParse(string)¶
Return an uuid or null.
- Arguments:
string (string)
- Returns:
ValueUUId | undefined
- class ValueVariant(type, value)¶
- ValueVariant(type_variant, initial_value).
A class used to represent a value of type variant<T0, …>. Seamless with an object compatible with the variant’s types.
Or use Value.create(type_variant [, initial_value]).
exported from
index.d- Extends:
Value
- Arguments:
type (TypeVariant)
value (InputValue | ValueVariant)
- ValueVariant.copy()¶
Return a deep copy.
- Returns:
ValueVariant
- ValueVariant.hash()¶
Return the hash value.
- Returns:
bigint
- ValueVariant.typeVariant()¶
Return the type variant<T0, …>.
- Returns:
TypeVariant
- ValueVariant.unwrap(encoded)¶
Return the value or throw.
- Arguments:
encoded (boolean)
- Returns:
OutputValue
- ValueVariant.wrap(value, type)¶
wrap a value.
- Arguments:
value (InputValue)
type (Type)
- static ValueVariant.cast(value)¶
Return a variant<T0, …> or throw.
- Arguments:
value (Value)
- Returns:
ValueVariant
- class ValueVec(typeVec, initialValue)¶
- ValueVec(type_vec [, initial_value]).
A class used to represent a value of type vec<element_type, size>. Seamless with a seq[int|real].
Or use Value.create(type_vec [, initial_value]).
exported from
index.d- Extends:
Value
- Arguments:
typeVec (TypeVec)
initialValue (InputValue[] | ValueVec)
- ValueVec.[Symbol․iterator]()¶
- Returns:
Iterator<number>
- ValueVec.at(index, encoded)¶
Return the value at index.
- Arguments:
index (number)
encoded (boolean)
- Returns:
number
- ValueVec.copy()¶
Return a deep copy.
- Returns:
ValueVec
- ValueVec.hash()¶
Return the hash value.
- Returns:
bigint
- ValueVec.set(index, value)¶
Set the value at index.
- Arguments:
index (number)
value (NumericInputValue)
- ValueVec.size()¶
Return the number of elements.
- Returns:
number
- ValueVec.toTuple()¶
Return a tuple.
- Returns:
number[]
- ValueVec.typeVec()¶
Return the type vec<element_type, size>.
- Returns:
TypeVec
- static ValueVec.cast(value)¶
Return a vec<element_type, size> or throw.
- Arguments:
value (Value)
- Returns:
ValueVec
- class ValueVector()¶
- A class used to represent a value of type vector<element_type>.
Seamless with a seq[object].
Or use Value.create(type_vector [, initial_value]).
exported from
index.d- Extends:
DeepKeyPath
Value
- ValueVector.[Symbol․iterator]()¶
- Returns:
Iterator<OutputValue>
- ValueVector.append(value)¶
Append value to the end of the vector.
- Arguments:
value (InputValue)
- ValueVector.at(index, encoded)¶
Return the value at index.
- Arguments:
index (number)
encoded (boolean)
- Returns:
OutputValue
- ValueVector.back(encoded)¶
Return the back element or throw.
- Arguments:
encoded (boolean)
- Returns:
OutputValue
- ValueVector.capacity()¶
Return the capacity.
- Returns:
number
- ValueVector.clear()¶
Remove all items.
- ValueVector.contains(value)¶
Return true if the value is present.
- Arguments:
value (InputValue)
- Returns:
boolean
- ValueVector.copy()¶
Return a deep copy.
- Returns:
ValueVector
- ValueVector.count(value)¶
Return the number of occurrences for the value.
- Arguments:
value (InputValue)
- Returns:
number
- ValueVector.empty()¶
Return true if the container is empty.
- Returns:
boolean
- ValueVector.exchange(idx1, idx2)¶
Exchange the value at idx1 with the value at idx2.
- Arguments:
idx1 (number)
idx2 (number)
- ValueVector.extend(values)¶
Extend the vector by appending the values.
- Arguments:
values (InputValue[] | ValueVector)
- ValueVector.front(encoded)¶
Return the front element or throw.
- Arguments:
encoded (boolean)
- Returns:
OutputValue
- ValueVector.index(value)¶
Return the first index of value.
- Arguments:
value (InputValue)
- Returns:
number
- ValueVector.insert(index, value)¶
Insert object before index.
- Arguments:
index (number)
value (InputValue)
- ValueVector.isPackSized()¶
- Return true if the vector packs elements in a contiguous array of
binary encoded elements.
- Returns:
boolean
- ValueVector.pop(index, encoded)¶
- Remove and return item at index (default last).
Throws error if the vector is empty or the index is out of range.
- Arguments:
index (number)
encoded (boolean)
- Returns:
OutputValue
- ValueVector.remove(value)¶
- Remove first occurrence of value.
Throws error if the value is not present.
- Arguments:
value (InputValue)
- ValueVector.reserve(size)¶
Reserve space for size.
- Arguments:
size (number)
- ValueVector.resize(size)¶
Resize the vector for size.
- Arguments:
size (number)
- ValueVector.set(index, value)¶
Set the value at index.
- Arguments:
index (number)
value (InputValue)
- ValueVector.shrinkToFit()¶
Shrink to fit.
- ValueVector.size()¶
Return the number of elements.
- Returns:
number
- ValueVector.typeVector()¶
Return the type vector<element_type>.
- Returns:
TypeVector
- static ValueVector.cast(value)¶
Return a vector<element_type> or throw.
- Arguments:
value (Value)
- Returns:
ValueVector
- class ValueVectorIter()¶
Iterator for ValueVector elements.
Note: Not directly instantiable.
exported from
index.d- ValueVectorIter.[Symbol․iterator]()¶
- Returns:
Iterator<OutputValue>
- ValueVectorIter.next()¶
- Returns:
{ done: boolean; value: OutputValue; }
- class ValueVoid()¶
- A class used to represent a value of type void. Seamless with Python null. Or
use Value.create(Type.VOID).
Note: Not directly instantiable.
exported from
index.d- Extends:
Value
- ValueVoid.copy()¶
Return a deep copy.
- Returns:
ValueVoid
- ValueVoid.encoded()¶
Return Python null.
- Returns:
Value
- ValueVoid.hash()¶
Return the hash value.
- Returns:
bigint
- static ValueVoid.cast(value)¶
Return void or throw.
- Arguments:
value (Value)
- Returns:
ValueVoid
- class ValueXArray()¶
- A class used to represent a value of type xarray<element_type>.
Seamless with a seq[object].
Or use Value.create(type_xarray [, initial_value]).
exported from
index.d- Extends:
DeepKeyPath
Value
- ValueXArray.END¶
type: readonly ValueUUId
- ValueXArray.[Symbol․iterator]()¶
- Returns:
Iterator<OutputValue>
- ValueXArray.append(value)¶
Append value to the end.
- Arguments:
value (InputValue)
- Returns:
ValueUUId
- ValueXArray.at(position, encoded)¶
Return the element at the position or null.
- Arguments:
position (ValueUUId)
encoded (boolean)
- Returns:
OutputValue | undefined
- ValueXArray.copy()¶
Return a deep copy.
- Returns:
ValueXArray
- ValueXArray.disablePosition(position)¶
Disable the position.
- Arguments:
position (ValueUUId)
- ValueXArray.extend(values)¶
Extend by appending the values.
- Arguments:
values (InputValue[] | ValueVector)
- Returns:
ValueUUId
- ValueXArray.hasPosition(position)¶
Return true if the position exists.
- Arguments:
position (ValueUUId)
- Returns:
boolean
- ValueXArray.index(position)¶
Return the index of the position.
- Arguments:
position (ValueUUId)
- Returns:
number | undefined
- ValueXArray.insert(beforePosition, value, newPosition)¶
- Insert the value before_position and return the new position.
Use new_position if specified, else a new position is created.
- Arguments:
beforePosition (ValueUUId)
value (InputValue)
newPosition (ValueUUId)
- Returns:
ValueUUId
- ValueXArray.insertPosition(beforePosition, newPosition)¶
Insert before_position a new_position.
- Arguments:
beforePosition (ValueUUId)
newPosition (ValueUUId)
- ValueXArray.items()¶
Return the list of positions with a value.
- Returns:
[ValueUUId, Value][]
- ValueXArray.position(index)¶
Return the position for the index or null.
- Arguments:
index (number)
- Returns:
ValueUUId | undefined
- ValueXArray.positionOf(value)¶
Return the position of the value or null.
- Arguments:
value (InputValue)
- Returns:
ValueUUId | undefined
- ValueXArray.positions()¶
Return the list of positions.
- Returns:
ValueUUId[]
- ValueXArray.remove(position)¶
Remove the element at the position.
- Arguments:
position (ValueUUId)
- ValueXArray.set(position, value)¶
Set the value at the position.
- Arguments:
position (ValueUUId)
value (InputValue)
- ValueXArray.toVector()¶
Convert to a vector<element_type>.
- Returns:
ValueVector
- ValueXArray.typeXarray()¶
Return the type xarray<element_type>.
- Returns:
TypeXArray
- static ValueXArray.cast(value)¶
Return a xarray<element_type> or throw.
- Arguments:
value (Value)
- Returns:
ValueXArray
- static ValueXArray.createPosition()¶
Create and return a position.
- Returns:
ValueUUId