turbodombuilder - v0.9.48
    Preparing search index...

    Class TurboNestedMap<ValueType, KeyType, BlockKeyType>

    TurboNestedMap

    Type Parameters

    • ValueType = any

      The type of the nested map's values.

    • KeyType = any

      The per-value key type.

    • BlockKeyType = any

      The block-grouping key type.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    nestedMap: Map<BlockKeyType, Map<KeyType, ValueType>> = ...

    Accessors

    • get defaultBlockKey(): BlockKeyType
      Protected

      Returns BlockKeyType

      Default block key used when none is supplied. It returns the first blockKey if present, otherwise returns the sentinel "__default__".

    Methods

    • Function

      get

      Parameters

      Returns ValueType

      • The associated value, or undefined.

      Retrieve the value at the given key within the optional blockKey.

    • Function

      set

      Parameters

      Returns void

      Set the given value at the given key and optional blockKey.

    • Function

      getFlatKey

      Parameters

      Returns string | number

      • Flattened key, or undefined when value not found.

      Return the first flatKey (global index or flattened string key) for the provided value.

    • Function

      getFromFlatKey

      Parameters

      • flatKey: string | number

        Global index or flattened string key (produced by flattenKey).

      Returns ValueType

      • The value, or undefined if not found.

      Get the value at the given flatKey.

    • Function

      getEntriesForBlock

      Parameters

      Returns [KeyType, ValueType][]

      • Array of pairs for the block.

      Return an array of [key, value] pairs for the given blockKey, alphabetically sorted by the key values (if compatible).

    • Function

      getKeysForBlock

      Parameters

      Returns KeyType[]

      • Array of keys.

      Return the keys for a block alphabetically sorted (if compatible).

    • Function

      getValuesForBlock

      Parameters

      Returns ValueType[]

      • Array of values.

      Return the values for a block alphabetically sorted by their keys (if compatible).

    • Function

      getAllKeys

      Returns KeyType[]

      • Flattened list of all keys.

      Return all keys from all blocks. Blocks are visited in alphabetical order of their blockKey (if compatible).

    • Function

      getAllValues

      Returns ValueType[]

      • Flattened list of all values.

      Return all values from all blocks. Blocks are visited in alphabetical order of their blockKey (if compatible).

    • Function

      hasKey

      Parameters

      Returns boolean

      Whether a value exists.

      Check whether a value exists at the given key inside blockKey.

    • Function

      hasBlock

      Parameters

      Returns boolean

      Whether a block exists.

      Check whether a block exists at blockKey.

    • Function

      getBlockSize

      Parameters

      Returns number

      The size of the block.

      Get the number of entries inside the target block.

    • Function

      removeKey

      Parameters

      Returns void

      Remove the entry at the given key inside blockKey.

    • Function

      remove

      Parameters

      Returns void

      Remove the first entry with the given value.

    • Function

      clear

      Returns void

      Remove all entries and reset internal state.

    • Function

      flattenKey

      Parameters

      Returns string | number

      • The flattened key.

      Produce a stable, serialized representation of (key, blockKey). For numeric block keys the function returns a numeric global index; otherwise it returns a "blockKey|key" string.

    • Function

      scopeKey

      Parameters

      • flatKey: string | number

        Flattened key or global index.

      Returns ScopedKey<KeyType, BlockKeyType>

      • The scoped key.

      Reverse flattenKey: if given a string in the form "blockKey|key", it returns {blockKey, key}`.

    • Parameters

      Returns string | number