utilizes.beside
TypeScript icon, indicating that this package has built-in type declarations

1.2.6 • Public • Published

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.

Package Sidebar

Install

npm i utilizes.beside

Weekly Downloads

1

Version

1.2.6

License

MIT

Unpacked Size

55.1 kB

Total Files

5

Last publish

Collaborators

  • natqe3