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: any

      AST node or array of nodes

    • mappings: {} | ((arg0, arg1, arg2) => any) | ({} | ((arg0, arg1, arg2) => any))[]

      A map of node types to callbacks, or a single callback that will be called for all node types, or a list of either, which will be applied in order

    • 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 any

Generated using TypeDoc