Skip to main content

PropertyDataEntry <T>

Index

Constructors

constructor

Properties

readonlymetaData

metaData: NonNullable<PropertyMetaData[T]>

readonlyname

name: T

staticreadonlyASCIIControlOffset

ASCIIControlOffset: 32 = ...

Character code offset for excluding ASCII control characters.

Methods

compare

  • compare(prop1, prop2, itemData): boolean
  • Property comparison function


    Parameters

    Returns boolean

    whether both properties are equivalent

compress

compressNumberRecord

  • compressNumberRecord(value, asset, defaults): string
  • 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 per charCodeCallback.

    The utilized UTF16 character code ranges (i.e. uint16) are as following:

    • [0, 31] reserved; ASCII control character range. The 0 code 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

decompressNumberRecord

  • decompressNumberRecord(value, asset): Partial<Record<string, number>>
  • 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 per charCodeCallback.


    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

    Returns ItemProperties[T]

    The differenced property

isSubset

  • isSubset(subProp, superProp, itemData): boolean
  • Property subset-or-equivalency comparison function


    Parameters

    Returns boolean

    whether both properties are equivalent or whether subProp represents a property subset of superProp

union

  • Property union function.

    By default, properties follow a "first non-nullish entry wins" approach if no property-specific merge function is available.


    Parameters

    Returns ItemProperties[T]

    The merged property

validate

staticcompareSetLikeArrays

  • compareSetLikeArrays<T>(value1, value2): boolean
  • Comparison function for set-like arrays


    Parameters

    • value1: readonly T[]
    • value2: readonly NoInfer<T>[]

    Returns boolean

staticcompareShallowObjects

  • compareShallowObjects<T>(value1, value2): value2 is T
  • 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

  • compressNumber(value, floatResolution): number
  • Compress a number into the uint16 range from float64.


    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

  • decompressNumber(value, floatResolution): number
  • Decompress a number from the uint16 range into float64.


    Parameters

    • value: number
    • optionalfloatResolution: 0.01 | 1 = undefined

    Returns number

staticunionSetLikeArrays

  • unionSetLikeArrays<T>(values): T[]
  • Comparison function for simple objects with scalar values (numbers, strings, etc.)


    Parameters

    • values: readonly readonly T[][]

    Returns T[]

staticunionShallowObjects

  • unionShallowObjects<T>(values): T
  • Comparison function for simple objects with scalar values (numbers, strings, etc.)


    Parameters

    • values: readonly Readonly<T>[]

    Returns T