ts-data-forge
    Preparing search index...

    Type Alias IMapMapped<K, V, KM>

    IMapMapped: Iterable<readonly [K, V]> & IMapMappedInterface<K, V, KM>

    Represents an immutable map with custom key transformation and high-performance operations.

    IMapMapped is a specialized persistent data structure that enables using complex objects as map keys while maintaining the performance benefits of JavaScript's native Map. It achieves this by requiring bidirectional transformation functions that convert between your custom key type and a primitive type that can be efficiently stored and compared.

    Key Features:

    • Complex Keys: Use objects, arrays, or any custom type as map keys
    • Immutable: All mutation operations return new instances
    • Type Safe: Full TypeScript support with compile-time key/value type checking
    • Bidirectional: Maintains ability to reconstruct original keys from mapped keys

    Use Cases:

    • Maps with composite keys (e.g., coordinates, user IDs with metadata)
    • Caching with complex cache keys
    • State management where entities have multi-part identifiers
    • Performance-critical maps with non-primitive keys

    Type Parameters

    • K

      The type of the custom keys in the map.

    • V

      The type of the values in the map.

    • KM extends MapSetKeyType

      The type of the mapped primitive keys (string, number, etc.).