ixfx
    Preparing search index...

    Function immutable

    • Returns an IMapImmutable. Use Maps.mutable as a mutable alternatve.

      Type Parameters

      • K
      • V

      Parameters

      • OptionaldataOrMap: ReadonlyMap<K, V> | EitherKey<K, V>

        Optional initial data in the form of an array of { key: value } or [ key, value ]

      Returns IMapImmutable<K, V>

      // Creating
      let m = map();
      // Add
      m = m.set("name", "sally");
      // Recall
      m.get("name");
      for (const [key, value] of map.entries()) {
      console.log(`${key} = ${value}`);
      }
      // Create
      let m = map();
      // Add as array or key & value pair
      m = m.add(["name" , "sally"]);
      m = m.add({ key: "name", value: "sally" });
      // Add using the more typical set
      m = m.set("name", "sally");
      m.get("name"); // "sally";
      m.has("age"); // false
      m.has("name"); // true
      m.isEmpty; // false
      m = m.delete("name");
      m.entries(); // Iterator of key value pairs

      Since it is immutable, add(), delete() and clear() return a new version with change.