js-util

Home > rc-js-util > dictionaryPush

dictionaryPush() function

Used with dictionary 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 dictionaryPush<TItem>(dict: IDictionary<TItem[]>, key: keyof typeof dict, value: TItem): void;

Parameters

Parameter Type Description
dict IDictionary<TItem[]> The object to check. May be modified.
key keyof typeof dict The key to lookup in dict.
value TItem The value to push.

Returns:

void

Remarks

See dictionaryPush().