utilizes.beside
v1.2.6
Published
Put children beside their father
Downloads
9
Readme
beside
Put children beside their father
Usage: beside<T>(tree: Array<T>, prop: keyof T): Array<T>
import { beside } from 'utilizes.beside'
const tree = [
{
level: 0,
id: 1,
children: [
{
level: 1,
id: 2
}
]
},
{
level: 0,
id: 3,
children: [
{
level: 1,
id: 4
}
]
}
]
beside(tree, `children`)
// Output: [{ id:1, ... }, { id:2, ... }, { id:3, ... }, { id:4,... }]
This module exported from utilizes project.