Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function traverseNodesKey(
rootChildren: React.ReactNode | React.ReactNode[],
callback: (key: string | number | null, node: AntTreeNode) => boolean,
) {
const nodeList: React.ReactNode[] = getNodeChildren(rootChildren) || [];
function processNode(node: React.ReactElement) {
const {
key,
props: { children },
} = node;
if (callback(key, node as any) !== false) {
traverseNodesKey(children, callback);
}
}
nodeList.forEach(processNode);
}