graycoreio/daffodil

View on GitHub
libs/design/tree/src/utils/expand-tree.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { traverse } from './traverse-tree';
import { DaffTreeUi } from '../interfaces/tree-ui';

/**
 * Expand the tree and its subtrees.
 */
export const expandTree = <T>(tree: DaffTreeUi<T>): DaffTreeUi<T> =>  traverse(tree, (node) => {
  node.open = true;
  return node;
}, 'items');