2020-03-29 13:43:52 +00:00
|
|
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
|
|
|
|
|
|
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [defaultWhen](./js-utils.defaultwhen.md)
|
|
|
|
|
|
|
|
## defaultWhen() function
|
|
|
|
|
2020-03-31 13:49:18 +00:00
|
|
|
Return the first element when `condition` is true and the second element when `condition` is false.
|
|
|
|
|
2020-03-29 13:43:52 +00:00
|
|
|
<b>Signature:</b>
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
export declare function defaultWhen<TVal>(condition: boolean, ...items: Array<TVal>): TVal;
|
|
|
|
```
|
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
|
|
|
| Parameter | Type | Description |
|
|
|
|
| --- | --- | --- |
|
2020-06-29 23:23:16 +00:00
|
|
|
| condition | boolean | |
|
|
|
|
| items | Array<TVal> | |
|
2020-03-29 13:43:52 +00:00
|
|
|
|
|
|
|
<b>Returns:</b>
|
|
|
|
|
2020-06-29 23:23:16 +00:00
|
|
|
TVal
|
2020-03-29 13:43:52 +00:00
|
|
|
|