js-util

Home > rc-js-util > mapPush

mapPush() function

Used with maps that store arrays. Where an array exists for a given key the value will be appended to that array, otherwise a new array will be created containing the value.

Signature:

export declare function mapPush<TKey, TValue>(map: Map<TKey, TValue[]>, key: TKey, value: TValue): void;

Parameters

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

Returns:

void

Remarks

See mapPush().