MCPcopy Create free account
hub / github.com/apitable/apitable / findNode

Function findNode

packages/core/src/utils/tree.ts:43–56  ·  view source on GitHub ↗
(tree: ITreeNode[], nodeId: string)

Source from the content-addressed store, hash-verified

41 * @param nodeId Node ID to look up
42 */
43export const findNode = (tree: ITreeNode[], nodeId: string): ITreeNode | null => {
44 return tree.reduce<ITreeNode | null>((preValue, item) => {
45 if (preValue) {
46 return preValue;
47 }
48 if (item.nodeId === nodeId) {
49 return item;
50 }
51 if (item.children) {
52 return findNode(item.children, nodeId);
53 }
54 return null;
55 }, null);
56};
57
58/**
59 * Generate expansion paths based on nodes

Callers 6

mergeObjFunction · 0.90
addSingleNodeToTreeFunction · 0.90
addMultiNodeToTreeFunction · 0.90
getComponentFunction · 0.90
ShareContentFunction · 0.90
getComponentFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected