Functions
traverse
- traverse<T>(func: (current: INodeInfo<T>) => any, init: INodeInfo<T>, options?: { depthFirst?: boolean; mode?: "onlyChildren" | "onlyArray" | "anyObject" }): any
-
Type parameters
Parameters
-
func: (current: INodeInfo<T>) => any
-
-
Optional options: { depthFirst?: boolean; mode?: "onlyChildren" | "onlyArray" | "anyObject" }
-
Optional depthFirst?: boolean
-
Optional mode?: "onlyChildren" | "onlyArray" | "anyObject"
Returns any
遍历树
traverse((current) => console.log(current.node.name), { init: rootNode });
traverse((current) => console.log(current.jsonPath), { init: ast }, { mode: 'anyObject' });