@empathyco/x-components
Version:
Empathy X Components
75 lines (36 loc) • 1.08 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [deepFlat](./x-components.deepflat.md)
## deepFlat() function
Flat an `Item[]` deeply using the given `childrenKey` to access to his children.
**Signature:**
```typescript
export declare function deepFlat<Item extends {
[key in Key]?: Item[];
}, Key extends keyof Item>(array: Item[], childrenKey: Key): Item[];
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
array
</td><td>
Item\[\]
</td><td>
The list of items to flat. Each item may have another list of items of the same type to flat.
</td></tr>
<tr><td>
childrenKey
</td><td>
Key
</td><td>
Property name where each of the items of the given array may have another list of items to be flattened.
</td></tr>
</tbody></table>
**Returns:**
Item\[\]
A flat list with all the found items.