ts-data-forge
    Preparing search index...

    Type Alias ISetMapped<K, KM>

    ISetMapped: Iterable<K> & Readonly<ISetMappedInterface<K, KM>>

    Represents an immutable set with custom element transformation and high-performance operations.

    ISetMapped is a specialized persistent data structure that enables using complex objects as set elements while maintaining the performance benefits of JavaScript's native Set. It achieves this by requiring bidirectional transformation functions that convert between your custom element type and a primitive type that can be efficiently stored and compared for uniqueness.

    Key Features:

    • Complex Elements: Use objects, arrays, or any custom type as set elements
    • Immutable: All mutation operations return new instances
    • Type Safe: Full TypeScript support with compile-time element type checking
    • Bidirectional: Maintains ability to reconstruct original elements from mapped keys
    • Set Algebra: Complete support for mathematical set operations

    Use Cases:

    • Sets of entities with complex identifiers
    • Deduplication of objects based on specific properties
    • Performance-critical sets with non-primitive elements
    • Mathematical set operations on complex data structures

    Type Parameters

    • K

      The type of the custom elements in the set.

    • KM extends MapSetKeyType

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