js-util

Home > rc-js-util > mapAddToSet

mapAddToSet() function

Used with maps that store sets. Where a set exists for a given key the value will be added to that set, otherwise a new set will be created containing the value.

Signature:

export declare function mapAddToSet<TKey, TValue>(map: Map<TKey, Set<TValue>>, key: TKey, value: TValue): void;

Parameters

Parameter Type Description
map Map<TKey, Set<TValue>> The Map to check. May be modified.
key TKey The key to lookup in map.
value TValue The value to add.

Returns:

void

Remarks

See mapAddToSet().