Skip to content

Return children recursively in nested array. #67

@ashoktamang

Description

@ashoktamang

I have a model named Page which can have multiple children, which in return can have its own children (and so on).
I would like to have a functiion like findChildren that would return (given a node/parent) children and its grandchildren in a nested array.

For example:

{
  name: 'parent',
  children: [
    {
      name: 'child1',
    },
    {
      name: 'child2',
      children: [
        {
          name: 'grandchild1',
          children: [*so on*],
        }
      }
    ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions