2020-03-29 14:10:40 +00:00
|
|
|
<!-- 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
|
|
|
|
|
2020-03-31 13:29:47 +00:00
|
|
|
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.
|
|
|
|
|
2020-03-29 14:10:40 +00:00
|
|
|
<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`
|
|
|
|
|