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` } Copy
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` }
Input data
Function which returns a string id. By default uses the JSON value of the object.
A default converter to string that uses JSON.stringify if its an object, or the thing itself if it's a string
By default, values with same key overwrite previous (overwrite)
overwrite
Returns a Map from an iterable. By default throws an exception if iterable contains duplicate values.