{"version":3,"sources":["../src/tree/getNodeByPath.ts"],"names":["getNodeByPath","treeObj","fullpath","options","result","opts","DefaultTreeOptions","forEachTreeByDfs","node","path","getFullPath","ABORT"],"mappings":";;;;AAoBO,SAASA,EAAoDC,CAAsBC,CAAAA,CAAAA,CAAiBC,EAAgD,CACvJ,IAAIC,EACAC,CAAO,CAAA,MAAA,CAAO,OAAO,EAAC,CAAGC,EAAoBH,CAAW,EAAA,EAAE,CAC9D,CAAA,OAAAI,IAAuBN,CAAQ,CAAA,CAAC,CAAC,IAAA,CAAAO,EAAK,IAAAC,CAAAA,CAAI,IAAI,CAC1C,GAAGC,EAAYD,CAAKJ,CAAAA,CAAAA,CAAK,KAAK,CAAKH,EAAAA,CAAAA,CAC/B,OAAAE,CAASI,CAAAA,CAAAA,CACFG,GAEf,CAAEN,CAAAA,CAAI,EACCD,CACX","file":"chunk-MYD5BQGB.mjs","sourcesContent":["/**\n * \n * 根据路径获取节点对象\n * getByPath(treedata,\"a/b\")\n * \n * getByPath(treedata,\"a/b\",{pathKey:\"name\"})\n * \n */\n\nimport { ABORT } from \"../object\";\nimport { DefaultTreeOptions } from \"./consts\";\nimport { forEachTreeByDfs } from \"./forEachTreeByDfs\";\nimport { TreeNode, TreeNodeBase, TreeNodeOptions } from \"./types\";\nimport { getFullPath } from './utils';\n\n \nexport interface GetNodeByPathOptions extends TreeNodeOptions{\n     \n}\n\nexport function getNodeByPath<Node extends TreeNodeBase = TreeNode>(treeObj:Node | Node[],fullpath: string,options?:GetNodeByPathOptions):Node | undefined {\n    let result:Node | undefined;\n    let opts = Object.assign({}, DefaultTreeOptions ,options || {}) as Required<GetNodeByPathOptions>     \n    forEachTreeByDfs<Node>(treeObj,({node,path})=>{        \n        if(getFullPath(path,opts.idKey) == fullpath){\n            result = node\n            return ABORT    \n        }\n    },opts) \n    return result\n}\n"]}