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.
70 lines (33 loc) • 1.01 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [rc-js-util](./rc-js-util.md) > [arrayCompactMap](./rc-js-util.arraycompactmap.md)
## arrayCompactMap() function
Like \_Array.map but where the callback returns null it will be omitted from the result.
**Signature:**
```typescript
export declare function arrayCompactMap<TItem, TTransformed>(items: ArrayLike<TItem>, map: (item: TItem, index: number) => TTransformed | null): TTransformed[];
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
items
</td><td>
ArrayLike<TItem>
</td><td>
</td></tr>
<tr><td>
map
</td><td>
(item: TItem, index: number) => TTransformed \| null
</td><td>
</td></tr>
</tbody></table>
**Returns:**
TTransformed\[\]
## Remarks
See [arrayCompactMap()](./rc-js-util.arraycompactmap.md)<!-- -->.