27 lines
805 B
Markdown
27 lines
805 B
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
|
|
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [getHeadOrDefault](./js-utils.getheadordefault.md)
|
|
|
|
## getHeadOrDefault() function
|
|
|
|
Get the first element from the specified key, within a map of lists, or a default value when the key does not exist or is nil.
|
|
|
|
<b>Signature:</b>
|
|
|
|
```typescript
|
|
export declare function getHeadOrDefault<TKey, TVal>(map: Map<TKey, Array<Optional<TVal>>>, key: TKey, defaultValue: TVal): TVal;
|
|
```
|
|
|
|
## Parameters
|
|
|
|
| Parameter | Type | Description |
|
|
| --- | --- | --- |
|
|
| map | <code>Map<TKey, Array<Optional<TVal>>></code> | |
|
|
| key | <code>TKey</code> | |
|
|
| defaultValue | <code>TVal</code> | |
|
|
|
|
<b>Returns:</b>
|
|
|
|
`TVal`
|
|
|