rc-js-util
Version:
A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.
90 lines (42 loc) • 1.23 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [rc-js-util](./rc-js-util.md) > [dictionaryPush](./rc-js-util.dictionarypush.md)
## 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:**
```typescript
export declare function dictionaryPush<TItem>(dict: IDictionary<TItem[]>, key: keyof typeof dict, value: TItem): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
dict
</td><td>
[IDictionary](./rc-js-util.idictionary.md)<!-- --><TItem\[\]>
</td><td>
The object to check. May be modified.
</td></tr>
<tr><td>
key
</td><td>
keyof typeof dict
</td><td>
The key to lookup in `dict`<!-- -->.
</td></tr>
<tr><td>
value
</td><td>
TItem
</td><td>
The value to push.
</td></tr>
</tbody></table>
**Returns:**
void
## Remarks
See [dictionaryPush()](./rc-js-util.dictionarypush.md)<!-- -->.