transform (callback) {
      function _transform (child, path, parent) {
        const replacement = callback(child, path, parent)

        if (replacement !== child) {
          // stop iterating when the node is replaced
          return replacement
        }

        return child.map(_transform)
      }

      return _transform(this, null, null)
    }
Recursively transform a node tree via a transform function.

For example, to replace all nodes of type SymbolNode having name 'x' with
a ConstantNode with value 2:

    const res = Node.transform(function (node, path, parent) {
      if (node && node.isSymbolNode) && (node.name === 'x')) {
        return new ConstantNode(2)
      }
      else {
        return node
      }
    })

@param {function(node: Node, path: string, parent: Node) : Node} callback
         A mapping function accepting a node, and returning
         a replacement for the node or the original node. The "signature"
         of the callback must be:
         callback(node: Node, index: string, parent: Node) : Node
@return {Node} Returns the original node or its replacement