ixfx
    Preparing search index...
    • Mutates map, adding each value to it using a function to produce a key. Use addValue for an immutable version.

      const map = new Map();
      addValueMutate(map, v=>v.name, { name:`Jane`, size:10 }, { name:`Bob`, size: 9 });
      // Map consists of entries:
      // [ `Jane`, { name:`Jane`, size:10 } ],
      // [ `Bob` { name:`Bob`, size: 9 } ]

      Uses addValueMutator under the hood.

      Type Parameters

      • V

      Parameters

      • map: undefined | Map<string, V>

        Map to modify. If undefined, a new map is created

      • hasher: ToString<V>

        Function to generate a string key for a given object value

      • collisionPolicy: "throw" | "overwrite" | "skip"

        What to do if the key already exists

      • ...values: readonly V[]

        Values to add

      Returns Map<string, V>

      Map instance