• 查找符合条件的第一个元素

    Parameters

    • node: TreeNode[]

      源数组

    • fn: Function

      过滤函数

    • result: any[] = []

      存放查找的结果数组

    Returns TreeNode

    查找到的目标节点

    Example

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

Generated using TypeDoc