Function map

  • Recursively execute a series of mapping callbacks on this node and all its children. If the callback returns a non-undefined value, it will overwrite the node, otherwise it will return a shallow clone.

    Parameters

    • node: Node | Node[]

      or array of nodes

    • mappings: ((node, property, parent, originalNode) => Node) | ((node, property, parent, originalNode) => Node)[]

      One or more transformation functions.

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

        Ignore walking nodes of these types

      • only: string | Function | string[]

        Only walk nodes of this type

    Returns Node | Node[]

    the transformed node or array of nodes

Generated using TypeDoc