• 按照全路径查找指定元素

    Parameters

    • node: TreeNode[]

      源数组

    • fn: Function

      过滤函数

    • result: any[] = []

      存放查找的结果数组

    Returns TreeNode[] | undefined

    查找到的目标节点

    Example

    const tree = [{ id: '1', children: [{ id: '2', children: [] }] }];
    const result = deepFindPath(tree, node => node.id === '2');
    // 返回 [ { id: '1', ... }, { id: '2', ... } ]

Generated using TypeDoc