UNPKG
reka-ui
Version:
latest (2.9.7)
2.9.7
2.9.6
2.9.5
2.9.4
2.9.3
2.9.2
2.9.1
2.9.0
2.8.2
2.8.0
2.7.0
2.6.2
2.6.1
2.6.0
2.5.1
2.5.0
2.4.1
2.4.0
2.3.2
2.3.1
2.3.0
2.2.1
2.2.0
2.1.1
2.1.0
2.0.2
2.0.1
2.0.0
1.0.0-alpha.11
1.0.0-alpha.10
1.0.0-alpha.9
1.0.0-alpha.8
1.0.0-alpha.7
1.0.0-alpha.6
1.0.0-alpha.5
1.0.0-alpha.4
1.0.0-alpha.3
1.0.0-alpha.2
1.0.0-alpha.1
0.0.2
0.0.0
Vue port for Radix UI Primitives.
github.com/unovue/reka-ui
unovue/reka-ui
reka-ui
/
src
/
Tree
/
utils.ts
13 lines
(9 loc)
•
302 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
export
function
flatten<U, T
extends
{
children
:
any
[] }>(
items
: T[]): U[] {
return
items.
reduce
(
(
acc
:
any
[],
item
: T
) =>
{ acc.
push
(item)
if
(item.
children
) acc.
push
(...
flatten
(item.
children
))
return
acc }, []) }
//
TODO:
expose more utility function to handle flattened item