Function walk

  • Recursively execute a callback on this node and all its children, in a depth-first order. If the callback returns a non-undefined value, walking ends and the value is returned

    Parameters

    • node: any
    • callback: ((node, parentPath) => any)
        • (node, parentPath): any
        • Parameters

          • node: Node
          • parentPath: (string | number)[]

          Returns any

    • Optional o: {
          except: Function | Function[];
          only: Function | Function[];
      }
      • except: Function | Function[]

        Ignore nodes that match this

      • only: Function | Function[]

        Only walk nodes that match this

    Returns any

    the value returned by the callback, or undefined if no value was returned

Generated using TypeDoc