Function ofSetMutable

Returns a IMapOfMutableExtended that uses a set to hold values. This means that only unique values are stored under each key. By default it uses the JSON representation to compare items.

Options: { hash: toStringFn } }

hash is a Util.ToString function: (object) => string. By default it uses JSON.stringify.

const map = mapOfSetMutable();
map.add(`hello`, [1, 2, 3, 1, 2, 3]);
const hello = map.get(`hello`); // [1, 2, 3]
const hash = (v) => v.name; // Use name as the key
const map = mapOfSetMutable(hash);
map.add(`hello`, {age:40, name: `Mary`});
map.add(`hello`, {age:29, name: `Mary`}); // Value ignored as same name exists