@supuwoerc/toolkit
    Preparing search index...

    Function getTargetFromTree

    • 在树中查找目标节点(深度优先)

      Find a target node in the tree (depth-first).

      Type Parameters

      • T = Partial<TreeNode>

        节点类型 / node type

      Parameters

      • tree: T[]

        树数组 / tree array

      • target: any

        目标值,用于与节点 id 进行比较 / target value to compare with node id

      • OptionalidKey: keyof T = ...

        表示节点 id 的字段名 / field name for node id

      • OptionalequalFunc: EqualFunc<any> = ...

        自定义相等比较函数 / custom equality function

      • OptionalchildrenKey: keyof T = ...

        子节点字段名 / children field name

      Returns T | null

      找到的节点或 null / found node or null

      // getTargetFromTree(tree, 5)