js-util

Home > rc-js-util > mapReportingAddToSet

mapReportingAddToSet() 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 mapReportingAddToSet<TKey extends object, TValue>(map: WeakMap<TKey, Set<TValue>>, key: TKey, value: TValue): boolean;

Parameters

Parameter Type Description
map WeakMap<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:

boolean

true - If the value was added.

Remarks

See mapReportingAddToSet().