• Find the key for all child nodes

    Example

    import { findChildKeysByKey } from "tree-handle-lib";
    const node = [{
    key: 'A',
    children: [{ key: 'AA', children: [{ key: 'AAA' }] }, { key: 'AB' }]
    }]
    const _result = findChildKeysByKey(node, 'AA');
    // ["AA","AAA"];

    Parameters

    • node: TNode

      the root node of the tree, can be a single node or an array of nodes

    • key: string

      the key of find the destination node

    • childrenName: string = CHILDREN_NAME

      the child key name of the child node in the tree structure, default value is CHILDREN_NAME='children'

    • keyName: string = KEY_NAME

      the key name of the node in the tree structure, default value is KEY_NAME='key'

    Returns string[]

    node | null

Generated using TypeDoc