ixfx
    Preparing search index...

    Function ofArrayMutable

    • Returns a IMapOfMutableExtended to allow storing multiple values under a key, unlike a regular Map.

      Type Parameters

      • V

        Data type of items

      Parameters

      Returns IMapOfMutableExtended<V, readonly V[]>

      IMapOfMutableExtended

      const map = ofArrayMutable();
      map.addKeyedValues(`hello`, [1,2,3,4]); // Adds series of numbers under key `hello`

      const hello = map.get(`hello`); // Get back values

      Takes options:

      A custom Util.ToString function can be provided as the convertToString opion. This is then used when checking value equality (has, without)

      const map = ofArrayMutable({ convertToString:(v) => v.name}); // Compare values based on their `name` field;
      

      Alternatively, a IsEqual function can be used:

      const map = ofArrayMutable({comparer: (a, b) => a.name === b.name });