• Compares two trees for the same node key

    Example

    import { isEqualTreeNode } from "tree-handle-lib";
    const tree1 = [
    {
    key: "1",
    name: "Node 1",
    children: [
    {
    key: "2",
    name: "Node 2",
    },
    {
    key: "3",
    name: "Node 3",
    },
    ],
    },
    ];

    const tree2 = [
    {
    key: "1",
    name: "Node 1",
    children: [
    {
    key: "2",
    name: "Node 2",
    },
    {
    key: "3",
    name: "Node 3",
    },
    ],
    },
    ];
    const _result= isEqualTreeNode(tree1, tree2)
    // true

    Parameters

    • node1: TNode

      one of the tree node

    • node2: TNode

      the other tree 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 boolean

Generated using TypeDoc