code: function findUp(node, type, shouldStop) {
      if (!node || shouldStop(node)) {
          return null;
      }
      if (node.type === type) {
          return node;
      }
      return findUp(node.parent, type, shouldStop);
  }
docs: Finds the nearest parent of node with a given type.
  
  @param {ASTNode} node – The node to search from.
  @param {string} type – The type field of the parent node.
  @param {Function} shouldStop – a predicate that returns true if the traversal should stop, and false otherwise.
  @returns {ASTNode} The closest ancestor with the specified type; null if no such ancestor exists.