PropertyDataEntry <T>
Index
Constructors
constructor
Parameters
name: T
metaData: PropertyMetaData[T]
functions: Omit<Entry<T>, metaData>
Returns PropertyDataEntry<T>
Properties
readonlymetaData
readonlyname
staticreadonlyASCIIControlOffset
Character code offset for excluding ASCII control characters.
Methods
compare
Property comparison function
Parameters
prop1: ItemProperties[T]
The firs to-be compared property
prop2: ItemProperties[T]
The firs to-be compared property
itemData: DataBundle
The item data
Returns boolean
whether both properties are equivalent
compress
Compress the passed item property
Parameters
property: ItemProperties[T]
The item property value
itemData: DataBundle
The item data
optionaldefaults: ItemProperties[T] = undefined
The default value of the property (if any)
Returns ItemPropertiesMinimized
The compressed property
compressNumberRecord
Compress an object with layer-specific numeric entries into a string.
The string is of length
<= Asset.Layer.length, with the character code of each substring mapping to their layer-specific numeric entry percharCodeCallback.The utilized UTF16 character code ranges (i.e.
uint16) are as following:[0, 31]reserved; ASCII control character range. The0code is used for padding[32, 2**15 - 1]positive number range[2**15, 2**15 + 31]reserved; mirroring the (offsetted) ASCII control character range[2**15 + 32, 2**16 - 1]negative number range; offset and represented by their absolute value
Floating point values (defined per PropertyDataEntry.metaData.stepSize) are represented with a decimal resolution of 0.01, i.e. multiplied by 100 and rounded to the nearest integer.
Parameters
value: Partial<Record<string, number>>
The to-be compressed value
asset: Asset
The asset
defaults: Partial<Record<string, number>>
Layer-specific default values (if any)
Returns string
The compressed entries
decompress
Decompress the passed item property
Parameters
property: ItemProperties[T] | ItemPropertiesMinimized[T]
The item property value. This property value should be compressed though decompressed value must be handled correctly.
itemData: DataBundle
The item data
Returns ItemProperties
The decompressed property
decompressNumberRecord
Decompress a string back into an object with layer-specific numeric entries
The is expected to be string of length
<= Asset.Layer.length, with the character code of each substring mapping to their layer-specific numeric entry percharCodeCallback.Parameters
value: string
The to-be decompressed value
asset: Asset
The asset
Returns Partial<Record<string, number>>
The decompressed entries
difference
Property difference function.
Parameters
properties: readonly ItemProperties[T][]
The to-be differenced property values
itemData: DataBundle
The item data
Returns ItemProperties[T]
The differenced property
isSubset
Property subset-or-equivalency comparison function
Parameters
subProp: ItemProperties[T]
The firs to-be compared property
superProp: ItemProperties[T]
The firs to-be compared property
itemData: DataBundle
The item data
Returns boolean
whether both properties are equivalent or whether
subProprepresents a property subset ofsuperProp
union
Property union function.
By default, properties follow a "first non-nullish entry wins" approach if no property-specific merge function is available.
Parameters
properties: readonly ItemProperties[T][]
The to-be merged property values
itemData: DataBundle
The item data
Returns ItemProperties[T]
The merged property
validate
Property comparison function
Parameters
prop: ItemProperties[T]
The firs to-be compared property
itemData: DataBundle
The item data
optionaldefaults: ItemProperties[T] = undefined
The default value of the property (if any)
Returns ValidationOutput<ItemProperties[T]>
whether both properties are equivalent
staticcompareSetLikeArrays
Comparison function for set-like arrays
Parameters
value1: readonly T[]
value2: readonly NoInfer<T>[]
Returns boolean
staticcompareShallowObjects
Comparison function for simple objects with scalar values (numbers, strings, etc.)
Parameters
value1: T
value2: Readonly<Record<string, string | number | boolean>>
Returns value2 is T
staticcompressNumber
Compress a number into the
uint16range fromfloat64.Parameters
value: number
optionalfloatResolution: 0.01 | 1 = undefined
Returns number
staticcopyFrom
Construct a new entry via shallow copying and renaming an existing one.
Note that both new- and old-entries must have the same property- and metadata types.
Parameters
fromName: keyof ItemProperties
The old property name of the to-be copied entry object
toName: T
The new property name
optionaloverride: Entry<T> = undefined
Override specific entries from the copied data
Returns PropertyDataEntry<T>
The newly copied entry
staticdecompressNumber
Decompress a number from the
uint16range intofloat64.Parameters
value: number
optionalfloatResolution: 0.01 | 1 = undefined
Returns number
staticunionSetLikeArrays
Comparison function for simple objects with scalar values (numbers, strings, etc.)
Parameters
values: readonly readonly T[][]
Returns T[]
staticunionShallowObjects
Comparison function for simple objects with scalar values (numbers, strings, etc.)
Parameters
values: readonly Readonly<T>[]
Returns T