lib/utils/utils.js
function getParent(node, predicate) {
  let currentNode = node;
  while (currentNode) {
    if (predicate(currentNode)) {
      return currentNode;
    }

    currentNode = currentNode.parent;
  }

  return null;
}
function getParent(node, predicate) {
  let currentNode = node;
  while (currentNode) {
    if (predicate(currentNode)) {
      return currentNode;
    }

    currentNode = currentNode.parent;
  }

  return null;
}
function getParent ( node , predicate ) { let currentNode = node ; while ( currentNode ) { if ( predicate ( currentNode ) ) { return currentNode ; } currentNode = currentNode . parent ; } return null ; }
Travels up the ancestors of a given node, if the predicate function returns
truthy for a given node or ancestor, return that node, otherwise return null

@name getParent
@param {Object} node The child node to start at
@param {Function} predicate Function that should return a boolean for a given value
@returns {Object|null} The first node that matches predicate, otherwise null
Travels up the ancestors of a given node if the predicate function returns truthy for a given node or ancestor return that node otherwise return null