Mutates map, adding each value to it using a function to produce a key. Use addValue for an immutable version.
map
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 } ] Copy
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.
Map to modify. If undefined, a new map is created
Function to generate a string key for a given object value
What to do if the key already exists
Values to add
Map instance
Mutates
map
, adding each value to it using a function to produce a key. Use addValue for an immutable version.Uses addValueMutator under the hood.