Skip to content

dfsByLoop

配置项

参数类型是否必选默认值参数描述
nodesArray-源数组
callbackFunction-回调函数

返回值

类型描述
void-

示例

// 待补充

源码

js
export function dfsByLoop(nodes, callback) {
    let node, curTree = nodes;
    while ((node = curTree.shift())) {
        callback(node)
        node.children && curTree.unshift(...node.children)
    }
}