ixfx
    Preparing search index...
    • Returns a Map from an iterable. By default throws an exception if iterable contains duplicate values.

      const data = [
      { fruit: `granny-smith`, family: `apple`, colour: `green` },
      { fruit: `mango`, family: `stone-fruit`, colour: `orange` }
      ];
      const map = fromIterable(data, v => v.fruit);
      map.get(`granny-smith`); // { fruit: `granny-smith`, family: `apple`, colour: `green` }

      Type Parameters

      • V

      Parameters

      • data: Iterable<V>

        Input data

      • keyFunction: (itemToMakeStringFor: V) => string = ...

        Function which returns a string id. By default uses the JSON value of the object.

          • (itemToMakeStringFor: V): string
          • A default converter to string that uses JSON.stringify if its an object, or the thing itself if it's a string

            Parameters

            • itemToMakeStringFor: V

            Returns string

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

        By default, values with same key overwrite previous (overwrite)

      Returns ReadonlyMap<string, V>