ixfx
    Preparing search index...

    Interface IMapImmutable<K, V>

    An immutable map. Rather than changing the map, functions like add and delete return a new map reference which must be captured.

    Immutable data is useful because as it gets passed around your code, it never changes from underneath you. You have what you have.

    let m = map(); // Create
    let m2 = m.set(`hello`, `samantha`);
    // m is still empty, only m2 contains a value.
    interface IMapImmutable<K, V> {
        add(...itemsToAdd: EitherKey<K, V>): IMapImmutable<K, V>;
        clear(): IMapImmutable<K, V>;
        delete(key: K): IMapImmutable<K, V>;
        entries(): IterableIterator<readonly [K, V]>;
        get(key: K): undefined | V;
        has(key: K): boolean;
        isEmpty(): boolean;
        set(key: K, value: V): IMapImmutable<K, V>;
        values(): IterableIterator<V>;
    }

    Type Parameters

    • K

      Type of map keys. Typically string

    • V

      Type of stored values

    Hierarchy

    • IMapBase<K, V>
      • IMapImmutable
    Index

    Methods

    • Iterates over entries (consisting of [key,value])

      Returns IterableIterator<readonly [K, V]>

      for (const [key, value] of map.entries()) {
      // Use key, value...
      }