Function map

  • Recursively execute a callback 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: ((arg0, arg1, arg2) => Node) | ((arg0, arg1, arg2) => 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