Function setPath

  • Set the parent property on a node. By default it will skip nodes that already have a parent property, but you can set force = true to prevent that.

    Parameters

    • node: Node

      The node to set the parent on

    • parentPath: {
          node: Node;
          path: (string | number)[];
      }

      An object storing the parent node and the path to the node from the parent

      • node: Node
      • path: (string | number)[]
    • Optional options: {
          force: boolean;
      } = {}
      • force: boolean

        Allow overwriting

    Returns boolean

    false if the parent was already set, and undefined otherwise

Generated using TypeDoc